diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/acceptance/features/bootstrap/UsersSettingsContext.php | 46 | ||||
-rw-r--r-- | tests/acceptance/features/users.feature | 21 |
2 files changed, 67 insertions, 0 deletions
diff --git a/tests/acceptance/features/bootstrap/UsersSettingsContext.php b/tests/acceptance/features/bootstrap/UsersSettingsContext.php index d65c58ecabe..1f488e4f52b 100644 --- a/tests/acceptance/features/bootstrap/UsersSettingsContext.php +++ b/tests/acceptance/features/bootstrap/UsersSettingsContext.php @@ -92,6 +92,23 @@ class UsersSettingsContext implements Context, ActorAwareInterface { } /** + * @return Locator + */ + public static function actionsMenuOf($user) { + return Locator::forThe()->css(".icon-more")->descendantOf(self::rowForUser($user))-> + describedAs("Actions menu for user $user in Users Settings"); + } + + /** + * @return Locator + */ + public static function theAction($action, $user) { + return Locator::forThe()->xpath("//button/span[normalize-space() = '$action']/..")-> + descendantOf(self::rowForUser($user))-> + describedAs("$action action for the user $user"); + } + + /** * @When I click the New user button */ public function iClickTheNewUserButton() { @@ -99,6 +116,20 @@ class UsersSettingsContext implements Context, ActorAwareInterface { } /** + * @When I click the $action action in the $user actions menu + */ + public function iClickTheAction($action, $user) { + $this->actor->find(self::theAction($action, $user))->click(); + } + + /** + * @When I open the actions menu for the user :user + */ + public function iOpenTheActionsMenuOf($user) { + $this->actor->find(self::actionsMenuOf($user))->click(); + } + + /** * @When I create user :user with password :password */ public function iCreateUserWithPassword($user, $password) { @@ -123,6 +154,13 @@ class UsersSettingsContext implements Context, ActorAwareInterface { } /** + * @Then I see that the list of users does not contains the user :user + */ + public function iSeeThatTheListOfUsersDoesNotContainsTheUser($user) { + PHPUnit_Framework_Assert::assertNull($this->actor->find(self::rowForUser($user), 10)); + } + + /** * @Then I see that the new user form is shown */ public function iSeeThatTheNewUserFormIsShown() { @@ -130,4 +168,12 @@ class UsersSettingsContext implements Context, ActorAwareInterface { $this->actor->find(self::newUserForm(), 10)->isVisible()); } + /** + * @Then I see the $action action in the $user actions menu + */ + public function iSeeTheAction($action, $user) { + PHPUnit_Framework_Assert::assertTrue( + $this->actor->find(self::theAction($action, $user), 10)->isVisible()); + } + } diff --git a/tests/acceptance/features/users.feature b/tests/acceptance/features/users.feature new file mode 100644 index 00000000000..3b916285501 --- /dev/null +++ b/tests/acceptance/features/users.feature @@ -0,0 +1,21 @@ +Feature: users + + Scenario: create a new user + Given I act as Jane + And I am logged in as the admin + And I open the User settings + And I click the New user button + And I see that the new user form is shown + When I create user unknownUser with password 123456acb + Then I see that the list of users contains the user unknownUser + + Scenario: delete a user + Given I act as Jane + And I am logged in as the admin + And I open the User settings + And I see that the list of users contains the user user0 + And I open the actions menu for the user user0 + And I see the "Delete user" action in the user0 actions menu + When I click the "Delete user" action in the user0 actions menu + Then I see that the list of users does not contains the user user0 + |