From b086a0f007267be306ed9248b1d418fae527c648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Fri, 5 Mar 2021 21:57:47 +0100 Subject: [PATCH] Add explicit locator for "Enable all" bundle button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of looking for the bundle button and then checking its value now the expected value is included in the locator and the button is checked similarly to other elements. No "Disable all" locator was added as it was not currently needed anywhere. Signed-off-by: Daniel Calviño Sánchez --- .../features/bootstrap/AppsManagementContext.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/acceptance/features/bootstrap/AppsManagementContext.php b/tests/acceptance/features/bootstrap/AppsManagementContext.php index 56ec7c6b85..82d4561bd2 100644 --- a/tests/acceptance/features/bootstrap/AppsManagementContext.php +++ b/tests/acceptance/features/bootstrap/AppsManagementContext.php @@ -84,10 +84,10 @@ class AppsManagementContext implements Context, ActorAwareInterface { /** * @return Locator */ - public static function bundleButton($bundle) { - return Locator::forThe()->xpath("//div[@class='apps-header']/h2[normalize-space() = '$bundle']/input")-> + public static function enableAllBundleButton($bundle) { + return Locator::forThe()->xpath("//div[@class='apps-header']/h2[normalize-space() = '$bundle']/input[@value='Enable all']")-> descendantOf(self::appsList())-> - describedAs("Button to enable / disable bundles"); + describedAs("Button to enable bundles"); } /** @@ -245,14 +245,16 @@ class AppsManagementContext implements Context, ActorAwareInterface { * @When /^I enable all apps from the "([^"]*)"$/ */ public function iEnableAllAppsFromThe($bundle) { - $this->actor->find(self::bundleButton($bundle), 2)->click(); + $this->actor->find(self::enableAllBundleButton($bundle), 2)->click(); } /** * @Given /^I see that the "([^"]*)" is disabled$/ */ public function iSeeThatTheIsDisabled($bundle) { - PHPUnit\Framework\Assert::assertEquals('Enable all', $this->actor->find(self::bundleButton($bundle), 2)->getValue()); + PHPUnit_Framework_Assert::assertTrue( + $this->actor->find(self::enableAllBundleButton($bundle), 2)->isVisible() + ); } /**