diff options
author | Greta Doci <gretadoci@gmail.com> | 2019-09-23 13:00:04 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-12-12 12:25:13 +0100 |
commit | c864bc832172dfc3696c4873fd7021bf5f981836 (patch) | |
tree | 206391723972dd28b14e080361dd438338c34ac5 /tests/acceptance/features/bootstrap | |
parent | c6e51924c8615166c2533f83ecc6399d9cc56cbd (diff) | |
download | nextcloud-server-c864bc832172dfc3696c4873fd7021bf5f981836.tar.gz nextcloud-server-c864bc832172dfc3696c4873fd7021bf5f981836.zip |
Move users management to multi line
Signed-off-by: Greta Doci <gretadoci@gmail.com>
Diffstat (limited to 'tests/acceptance/features/bootstrap')
-rw-r--r-- | tests/acceptance/features/bootstrap/UsersSettingsContext.php | 91 |
1 files changed, 61 insertions, 30 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)); + } } |