From f92a216dcf80a2e5cfbe2a956dfbc1abd0a1add6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Fri, 5 Mar 2021 22:00:22 +0100 Subject: [PATCH] Assert also element visibility instead of just finding it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although if the element could not be found an exception would be thrown and the test aborted if an element is in the DOM but hidden it would be found and the test would pass. Signed-off-by: Daniel Calviño Sánchez --- .../features/bootstrap/AppsManagementContext.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/features/bootstrap/AppsManagementContext.php b/tests/acceptance/features/bootstrap/AppsManagementContext.php index 82d4561bd2..332c3b020e 100644 --- a/tests/acceptance/features/bootstrap/AppsManagementContext.php +++ b/tests/acceptance/features/bootstrap/AppsManagementContext.php @@ -170,7 +170,9 @@ class AppsManagementContext implements Context, ActorAwareInterface { */ public function iSeeThatTheAppHasBeenEnabled($app) { // TODO: Find a way to check if the enable button is removed - $this->actor->find(self::disableButtonForApp($app), 10); + PHPUnit_Framework_Assert::assertTrue( + $this->actor->find(self::disableButtonForApp($app), 10)->isVisible() + ); } /** @@ -178,7 +180,9 @@ class AppsManagementContext implements Context, ActorAwareInterface { */ public function iSeeThatTheAppHasBeenDisabled($app) { // TODO: Find a way to check if the disable button is removed - $this->actor->find(self::enableButtonForApp($app), 10); + PHPUnit_Framework_Assert::assertTrue( + $this->actor->find(self::enableButtonForApp($app), 10)->isVisible() + ); } /** @@ -237,8 +241,12 @@ class AppsManagementContext implements Context, ActorAwareInterface { * @Given /^I see the app bundles$/ */ public function iSeeTheAppBundles() { - $this->actor->find(self::rowForApp('Auditing / Logging'), 2); - $this->actor->find(self::rowForApp('LDAP user and group backend'), 2); + PHPUnit_Framework_Assert::assertTrue( + $this->actor->find(self::rowForApp('Auditing / Logging'), 2)->isVisible() + ); + PHPUnit_Framework_Assert::assertTrue( + $this->actor->find(self::rowForApp('LDAP user and group backend'), 2)->isVisible() + ); } /**