diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-05-09 16:53:16 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-05-16 09:50:23 +0200 |
commit | f3a06259e4a58ba7e7b6b55bb595c98867add1bb (patch) | |
tree | 89dd30ae0274e1c219b402e58cfb7b1fa3055c5f /tests | |
parent | e45147d7d623dc9d57e817dd5d625faa7f11ab3b (diff) | |
download | nextcloud-server-f3a06259e4a58ba7e7b6b55bb595c98867add1bb.tar.gz nextcloud-server-f3a06259e4a58ba7e7b6b55bb595c98867add1bb.zip |
newt acceptance tests
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
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 + |