From 37e0f85ad0a9f488e80e0a619c03752ea65ad29c Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Wed, 18 Jul 2018 23:10:35 +0200 Subject: Adds tests for testing removing an empty group Signed-off-by: Michael Weimann --- .../features/bootstrap/AppNavigationContext.php | 14 +++++++++++++- .../features/bootstrap/UsersSettingsContext.php | 3 +++ tests/acceptance/features/users.feature | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/features/bootstrap/AppNavigationContext.php b/tests/acceptance/features/bootstrap/AppNavigationContext.php index e6e6bcc8479..356ac0afa46 100644 --- a/tests/acceptance/features/bootstrap/AppNavigationContext.php +++ b/tests/acceptance/features/bootstrap/AppNavigationContext.php @@ -112,6 +112,18 @@ class AppNavigationContext implements Context, ActorAwareInterface { */ public function iSeeThatTheSectionHasACountOf($section, $count) { PHPUnit_Framework_Assert::assertEquals($this->actor->find(self::counterForTheSection($section), 10)->getText(), $count); - } + } + + /** + * @Then I see that the section :section does not have a count + */ + public function iSeeThatTheSectionDoesNotHaveACount($section) { + if (!WaitFor::elementToBeEventuallyNotShown( + $this->actor, + self::counterForTheSection($section), + $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { + PHPUnit_Framework_Assert::fail("The counter for section $section is still shown after $timeout seconds"); + } + } } diff --git a/tests/acceptance/features/bootstrap/UsersSettingsContext.php b/tests/acceptance/features/bootstrap/UsersSettingsContext.php index 995bbdd8725..e2eff7e2db0 100644 --- a/tests/acceptance/features/bootstrap/UsersSettingsContext.php +++ b/tests/acceptance/features/bootstrap/UsersSettingsContext.php @@ -178,7 +178,10 @@ class UsersSettingsContext implements Context, ActorAwareInterface { } /** + * Assigning/withdrawing is the same action (it toggles). + * * @When I assign the user :user to the group :group + * @When I withdraw the user :user from the group :group */ public function iAssignTheUserToTheGroup($user, $group) { $this->actor->find(self::inputForUserInCell('groups', $user))->setValue($group); diff --git a/tests/acceptance/features/users.feature b/tests/acceptance/features/users.feature index 841c6a4ac09..a49b00949d9 100644 --- a/tests/acceptance/features/users.feature +++ b/tests/acceptance/features/users.feature @@ -56,6 +56,21 @@ Feature: users # When I click the "Yes" button of the confirmation dialog # Then I see that the section Group1 is not shown + Scenario: delete an empty group + Given I act as Jane + And I am logged in as the admin + And I open the User settings + # disabled because we need the TAB patch: + # https://github.com/minkphp/MinkSelenium2Driver/pull/244 + # And I assign the user user0 to the group Group1 + # And I see that the section Group1 is shown + # And I withdraw the user user0 from the group Group1 + # And I see that the section Group1 does not have a count + # And I click the "icon-delete" button on the Group1 section + # And I see that the confirmation dialog is shown + # When I click the "Yes" button of the confirmation dialog + # Then I see that the section Group1 is not shown + Scenario: change columns visibility Given I act as Jane And I am logged in as the admin -- cgit v1.2.3