summaryrefslogtreecommitdiffstats
path: root/tests/acceptance/features/bootstrap/UsersSettingsContext.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/acceptance/features/bootstrap/UsersSettingsContext.php')
-rw-r--r--tests/acceptance/features/bootstrap/UsersSettingsContext.php98
1 files changed, 65 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);
+ }
+
+
}