diff options
Diffstat (limited to 'tests/acceptance/features')
-rw-r--r-- | tests/acceptance/features/bootstrap/UsersSettingsContext.php | 91 | ||||
-rw-r--r-- | tests/acceptance/features/users.feature | 18 |
2 files changed, 73 insertions, 36 deletions
diff --git a/tests/acceptance/features/bootstrap/UsersSettingsContext.php b/tests/acceptance/features/bootstrap/UsersSettingsContext.php index 56dce822359..d42b49cbf2d 100644 --- a/tests/acceptance/features/bootstrap/UsersSettingsContext.php +++ b/tests/acceptance/features/bootstrap/UsersSettingsContext.php @@ -1,9 +1,10 @@ <?php /** - * + * * @copyright Copyright (c) 2017, Daniel Calviño Sánchez (danxuliu@gmail.com) * @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> + * @copyright Copyright (c) 2019, Greta Doci <gretadoci@gmail.com> * * @license GNU AGPL version 3 or any later version * @@ -33,7 +34,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public static function newUserForm() { return Locator::forThe()->id("new-user")-> - describedAs("New user form in Users Settings"); + describedAs("New user form in Users Settings"); } /** @@ -41,7 +42,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public static function userNameFieldForNewUser() { return Locator::forThe()->field("newusername")-> - describedAs("User name field for new user in Users Settings"); + describedAs("User name field for new user in Users Settings"); } /** @@ -49,7 +50,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public static function displayNameFieldForNewUser() { return Locator::forThe()->field("newdisplayname")-> - describedAs("Display name field for new user in Users Settings"); + describedAs("Display name field for new user in Users Settings"); } /** @@ -57,7 +58,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public static function passwordFieldForNewUser() { return Locator::forThe()->field("newuserpassword")-> - describedAs("Password field for new user in Users Settings"); + describedAs("Password field for new user in Users Settings"); } /** @@ -65,7 +66,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public static function newUserButton() { return Locator::forThe()->id("new-user-button")-> - describedAs("New user button in Users Settings"); + describedAs("New user button in Users Settings"); } /** @@ -73,26 +74,26 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public static function createNewUserButton() { return Locator::forThe()->xpath("//form[@id = 'new-user']//input[@type = 'submit']")-> - describedAs("Create user button in Users Settings"); + describedAs("Create user button in Users Settings"); } /** * @return Locator */ public static function rowForUser($user) { - return Locator::forThe()->xpath("//div[@id='app-content']/div/div[normalize-space() = '$user']/..")-> - describedAs("Row for user $user in Users Settings"); + return Locator::forThe()->css("div.user-list-grid div.row[data-id=$user]")-> + describedAs("Row for user $user in Users Settings"); } /** * Warning: you need to watch out for the proper classes order - * + * * @return Locator */ public static function classCellForUser($class, $user) { return Locator::forThe()->xpath("//*[contains(concat(' ', normalize-space(@class), ' '), ' $class ')]")-> - descendantOf(self::rowForUser($user))-> - describedAs("$class cell for user $user in Users Settings"); + descendantOf(self::rowForUser($user))-> + describedAs("$class cell for user $user in Users Settings"); } /** @@ -100,8 +101,8 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public static function inputForUserInCell($cell, $user) { return Locator::forThe()->css("input")-> - descendantOf(self::classCellForUser($cell, $user))-> - describedAs("$cell input for user $user in Users Settings"); + descendantOf(self::classCellForUser($cell, $user))-> + describedAs("$cell input for user $user in Users Settings"); } /** @@ -116,8 +117,8 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public static function optionInInputForUser($cell, $user) { return Locator::forThe()->css(".multiselect__option--highlight")-> - descendantOf(self::classCellForUser($cell, $user))-> - describedAs("Selected $cell option in $cell input for user $user in Users Settings"); + descendantOf(self::classCellForUser($cell, $user))-> + describedAs("Selected $cell option in $cell input for user $user in Users Settings"); } /** @@ -125,8 +126,8 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public static function actionsMenuOf($user) { return Locator::forThe()->css(".icon-more")-> - descendantOf(self::rowForUser($user))-> - describedAs("Actions menu for user $user in Users Settings"); + descendantOf(self::rowForUser($user))-> + describedAs("Actions menu for user $user in Users Settings"); } /** @@ -134,8 +135,8 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public static function theAction($action, $user) { return Locator::forThe()->xpath("//button[normalize-space() = '$action']")-> - descendantOf(self::rowForUser($user))-> - describedAs("$action action for the user $user row in Users Settings"); + descendantOf(self::rowForUser($user))-> + describedAs("$action action for the user $user row in Users Settings"); } /** @@ -143,7 +144,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public static function theColumn($column) { return Locator::forThe()->xpath("//div[@class='user-list-grid']//div[normalize-space() = '$column']")-> - describedAs("The $column column in Users Settings"); + describedAs("The $column column in Users Settings"); } /** @@ -151,8 +152,25 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public static function selectedSelectOption($cell, $user) { return Locator::forThe()->css(".multiselect__single")-> - descendantOf(self::classCellForUser($cell, $user))-> - describedAs("The selected option of the $cell select for the user $user in Users Settings"); + descendantOf(self::classCellForUser($cell, $user))-> + describedAs("The selected option of the $cell select for the user $user in Users Settings"); + } + + /** + * @return Locator + */ + public static function editModeToggle($user) { + return Locator::forThe()->css(".toggleUserActions button.icon-rename")-> + descendantOf(self::rowForUser($user))-> + describedAs("The edit toggle button for the user $user in Users Settings"); + } + + /** + * @return Locator + */ + public static function editModeOn($user) { + return Locator::forThe()->css("div.user-list-grid div.row.row--editable[data-id=$user]")-> + describedAs("I see the edit mode is on for the user $user in Users Settings"); } /** @@ -205,6 +223,13 @@ class UsersSettingsContext implements Context, ActorAwareInterface { } /** + * @When I toggle the edit mode for the user :user + */ + public function iToggleTheEditModeForUser($user) { + $this->actor->find(self::editModeToggle($user), 10)->click(); + } + + /** * @When I create user :user with password :password */ public function iCreateUserWithPassword($user, $password) { @@ -258,7 +283,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public function iSeeThatTheNewUserFormIsShown() { PHPUnit_Framework_Assert::assertTrue( - $this->actor->find(self::newUserForm(), 10)->isVisible()); + $this->actor->find(self::newUserForm(), 10)->isVisible()); } /** @@ -266,7 +291,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public function iSeeTheAction($action, $user) { PHPUnit_Framework_Assert::assertTrue( - $this->actor->find(self::theAction($action, $user), 10)->isVisible()); + $this->actor->find(self::theAction($action, $user), 10)->isVisible()); } /** @@ -274,7 +299,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { */ public function iSeeThatTheColumnIsShown($column) { PHPUnit_Framework_Assert::assertTrue( - $this->actor->find(self::theColumn($column), 10)->isVisible()); + $this->actor->find(self::theColumn($column), 10)->isVisible()); } /** @@ -289,15 +314,16 @@ class UsersSettingsContext implements Context, ActorAwareInterface { * @Then I see that the display name for the user :user is :displayName */ public function iSeeThatTheDisplayNameForTheUserIs($user, $displayName) { - PHPUnit_Framework_Assert::assertEquals($displayName, $this->actor->find(self::displayNameCellForUser($user), 10)->getValue()); + PHPUnit_Framework_Assert::assertEquals( + $displayName, $this->actor->find(self::displayNameCellForUser($user), 10)->getValue()); } /** * @Then I see that the :cell cell for user :user is done loading */ public function iSeeThatTheCellForUserIsDoneLoading($cell, $user) { - WaitFor::elementToBeEventuallyShown($this->actor, self::classCellForUser($cell.' icon-loading-small', $user)); - WaitFor::elementToBeEventuallyNotShown($this->actor, self::classCellForUser($cell.' icon-loading-small', $user)); + WaitFor::elementToBeEventuallyShown($this->actor, self::classCellForUser($cell . ' icon-loading-small', $user)); + WaitFor::elementToBeEventuallyNotShown($this->actor, self::classCellForUser($cell . ' icon-loading-small', $user)); } /** @@ -307,6 +333,11 @@ class UsersSettingsContext implements Context, ActorAwareInterface { PHPUnit_Framework_Assert::assertEquals( $this->actor->find(self::selectedSelectOption('quota', $user), 2)->getText(), $quota); } - + /** + * @Then I see that the edit mode is on for user :user + */ + public function iSeeThatTheEditModeIsOn($user) { + WaitFor::elementToBeEventuallyShown($this->actor, self::editModeOn($user)); + } } diff --git a/tests/acceptance/features/users.feature b/tests/acceptance/features/users.feature index 263e9fddfc0..c4cfa3b69bf 100644 --- a/tests/acceptance/features/users.feature +++ b/tests/acceptance/features/users.feature @@ -63,18 +63,20 @@ Feature: users 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 - # disabled because we need the TAB patch: + When I toggle the edit mode for the user user0 + Then I see that the edit mode is on for user user0 + # disabled because we need the TAB patch: # https://github.com/minkphp/MinkSelenium2Driver/pull/244 # When I assign the user user0 to the group admin # Then I see that the section Admins is shown # And I see that the section Admins has a count of 2 - + Scenario: create and delete a group 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 - # disabled because we need the TAB patch: + # 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 @@ -112,7 +114,7 @@ Feature: users Then I see that the "Storage location" column is shown When I toggle the showUserBackend checkbox in the settings Then I see that the "User backend" column is shown - + # Scenario: change display name # Given I act as Jane # And I am logged in as the admin @@ -128,6 +130,8 @@ Feature: users 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 + When I toggle the edit mode for the user user0 + Then I see that the edit mode is on for user user0 And I see that the password of user0 is "" When I set the password for user0 to 123456 And I see that the password cell for user user0 is done loading @@ -149,8 +153,10 @@ Feature: users 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 + When I toggle the edit mode for the user user0 + Then I see that the edit mode is on for user user0 And I see that the user quota of user0 is Unlimited - # disabled because we need the TAB patch: + # disabled because we need the TAB patch: # https://github.com/minkphp/MinkSelenium2Driver/pull/244 # When I set the user user0 quota to 1GB # And I see that the quota cell for user user0 is done loading @@ -163,4 +169,4 @@ Feature: users # Then I see that the user quota of user0 is "0 B" # When I set the user user0 quota to Default # And I see that the quota cell for user user0 is done loading - # Then I see that the user quota of user0 is "Default quota"
\ No newline at end of file + # Then I see that the user quota of user0 is "Default quota" |