summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-05-11 09:57:13 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-05-16 09:50:24 +0200
commit549940ddb9643a57a0900aa002b49276e5d20d9b (patch)
tree956eddc3e1f521bc25aa8c2fd6ff8e2e81a6793d /tests
parenta62c796f0709dacc332b7d9328e3f6ab151991f3 (diff)
downloadnextcloud-server-549940ddb9643a57a0900aa002b49276e5d20d9b.tar.gz
nextcloud-server-549940ddb9643a57a0900aa002b49276e5d20d9b.zip
Fixed root url detection, new tests, default new user group to current
opened group and user removal update fix Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/acceptance/features/bootstrap/UsersSettingsContext.php98
-rw-r--r--tests/acceptance/features/users.feature42
2 files changed, 107 insertions, 33 deletions
diff --git a/tests/acceptance/features/bootstrap/UsersSettingsContext.php b/tests/acceptance/features/bootstrap/UsersSettingsContext.php
index cede55caacf..995bbdd8725 100644
--- a/tests/acceptance/features/bootstrap/UsersSettingsContext.php
+++ b/tests/acceptance/features/bootstrap/UsersSettingsContext.php
@@ -77,50 +77,40 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
}
/**
+ * Warning: you need to watch out for the proper classes order
+ *
* @return Locator
*/
- public static function passwordCellForUser($user) {
- return Locator::forThe()->css(".password")->descendantOf(self::rowForUser($user))->
- describedAs("Password cell for user $user in Users Settings");
- }
-
- /**
- * @return Locator
- */
- public static function groupsCellForUser($user) {
- return Locator::forThe()->css(".groups")->descendantOf(self::rowForUser($user))->
- describedAs("Groups cell for user $user in Users Settings");
- }
-
- /**
- * @return Locator
- */
- public static function passwordInputForUser($user) {
- return Locator::forThe()->css("input")->descendantOf(self::passwordCellForUser($user))->
- describedAs("Password input for user $user in Users Settings");
+ public static function classCellForUser($class, $user) {
+ return Locator::forThe()->xpath("//*[@class='$class']")->
+ descendantOf(self::rowForUser($user))->
+ describedAs("$class cell for user $user in Users Settings");
}
/**
* @return Locator
*/
- public static function groupsInputForUser($user) {
- return Locator::forThe()->css("input")->descendantOf(self::groupsCellForUser($user))->
- describedAs("Groups input for user $user in Users Settings");
+ 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");
}
/**
* @return Locator
*/
- public static function groupOptionInInputForUser($user) {
- return Locator::forThe()->css(".multiselect__option--highlight")->descendantOf(self::groupsCellForUser($user))->
- describedAs("Group option for input for user $user in Users Settings");
+ 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");
}
/**
* @return Locator
*/
public static function actionsMenuOf($user) {
- return Locator::forThe()->css(".icon-more")->descendantOf(self::rowForUser($user))->
+ return Locator::forThe()->css(".icon-more")->
+ descendantOf(self::rowForUser($user))->
describedAs("Actions menu for user $user in Users Settings");
}
@@ -130,7 +120,7 @@ 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");
+ describedAs("$action action for the user $user row in Users Settings");
}
/**
@@ -138,7 +128,16 @@ 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");
+ describedAs("The $column column in Users Settings");
+ }
+
+ /**
+ * @return Locator
+ */
+ 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");
}
/**
@@ -172,18 +171,26 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
}
/**
- * @When I set the password for :user to :password
+ * @When I set the :field for :user to :value
*/
- public function iSetThePasswordForUserTo($user, $password) {
- $this->actor->find(self::passwordInputForUser($user), 2)->setValue($password . "\r");
+ public function iSetTheFieldForUserTo($field, $user, $value) {
+ $this->actor->find(self::inputForUserInCell($field, $user), 2)->setValue($value . "\r");
}
/**
* @When I assign the user :user to the group :group
*/
public function iAssignTheUserToTheGroup($user, $group) {
- $this->actor->find(self::groupsInputForUser($user))->setValue($group);
- $this->actor->find(self::groupOptionInInputForUser($user))->click();
+ $this->actor->find(self::inputForUserInCell('groups', $user))->setValue($group);
+ $this->actor->find(self::optionInInputForUser('groups', $user))->click();
+ }
+
+ /**
+ * @When I set the user :user quota to :quota
+ */
+ public function iSetTheUserQuotaTo($user, $quota) {
+ $this->actor->find(self::inputForUserInCell('quota', $user))->setValue($quota);
+ $this->actor->find(self::optionInInputForUser('quota', $user))->click();
}
/**
@@ -224,4 +231,29 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
$this->actor->find(self::theColumn($column), 10)->isVisible());
}
+ /**
+ * @Then I see that the :field of :user is :value
+ */
+ public function iSeeThatTheFieldOfUserIs($field, $user, $value) {
+ PHPUnit_Framework_Assert::assertEquals(
+ $this->actor->find(self::inputForUserInCell($field, $user), 10)->getValue(), $value);
+ }
+
+ /**
+ * @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));
+ }
+
+ /**
+ * @Then I see that the user quota of :user is :quota
+ */
+ public function iSeeThatTheuserQuotaIs($user, $quota) {
+ PHPUnit_Framework_Assert::assertEquals(
+ $this->actor->find(self::selectedSelectOption('quota', $user), 2)->getText(), $quota);
+ }
+
+
}
diff --git a/tests/acceptance/features/users.feature b/tests/acceptance/features/users.feature
index 7b0839d1b90..9bce32a2daa 100644
--- a/tests/acceptance/features/users.feature
+++ b/tests/acceptance/features/users.feature
@@ -71,3 +71,45 @@ Feature: users
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
+ And I open the User settings
+ And I see that the list of users contains the user user0
+ And I see that the displayName of user0 is user0
+ When I set the displayName for user0 to user1
+ And I see that the displayName cell for user user0 is done loading
+ Then I see that the displayName of user0 is user1
+
+ Scenario: change password
+ 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 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
+ # password input is emptied on change
+ Then I see that the password of user0 is ""
+
+ Scenario: change email
+ 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 see that the mailAddress of user0 is ""
+ When I set the mailAddress for user0 to "test@nextcloud.com"
+ And I see that the mailAddress cell for user user0 is done loading
+ Then I see that the mailAddress of user0 is "test@nextcloud.com"
+
+ Scenario: change user quota
+ 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 see that the user quota of user0 is Unlimited
+ # 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
+ # Then I see that the user quota of user0 is "1 GB" \ No newline at end of file