summaryrefslogtreecommitdiffstats
path: root/tests/acceptance
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-04-19 00:24:34 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-07-31 13:40:47 +0200
commit029b33a664ee8fa071946f24176ab804cb4acfaa (patch)
treedb62fdf599e0e3bbd9dfaa50f7377d98bb28945c /tests/acceptance
parentab6688fe0b4b380dc25916679f8f77f12380c12f (diff)
downloadnextcloud-server-029b33a664ee8fa071946f24176ab804cb4acfaa.tar.gz
nextcloud-server-029b33a664ee8fa071946f24176ab804cb4acfaa.zip
Add acceptance test for creating a user with a custom display name
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests/acceptance')
-rw-r--r--tests/acceptance/features/bootstrap/UsersSettingsContext.php50
-rw-r--r--tests/acceptance/features/users.feature12
2 files changed, 62 insertions, 0 deletions
diff --git a/tests/acceptance/features/bootstrap/UsersSettingsContext.php b/tests/acceptance/features/bootstrap/UsersSettingsContext.php
index e2eff7e2db0..e087ac1993b 100644
--- a/tests/acceptance/features/bootstrap/UsersSettingsContext.php
+++ b/tests/acceptance/features/bootstrap/UsersSettingsContext.php
@@ -47,6 +47,14 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function displayNameFieldForNewUser() {
+ return Locator::forThe()->field("newdisplayname")->
+ describedAs("Display name field for new user in Users Settings");
+ }
+
+ /**
+ * @return Locator
+ */
public static function passwordFieldForNewUser() {
return Locator::forThe()->field("newuserpassword")->
describedAs("Password field for new user in Users Settings");
@@ -99,6 +107,13 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function displayNameCellForUser($user) {
+ return self::inputForUserInCell("displayName", $user);
+ }
+
+ /**
+ * @return Locator
+ */
public static function optionInInputForUser($cell, $user) {
return Locator::forThe()->css(".multiselect__option--highlight")->
descendantOf(self::classCellForUser($cell, $user))->
@@ -162,6 +177,34 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
}
/**
+ * @When I set the user name for the new user to :user
+ */
+ public function iSetTheUserNameForTheNewUserTo($user) {
+ $this->actor->find(self::userNameFieldForNewUser(), 10)->setValue($user);
+ }
+
+ /**
+ * @When I set the display name for the new user to :displayName
+ */
+ public function iSetTheDisplayNameForTheNewUserTo($displayName) {
+ $this->actor->find(self::displayNameFieldForNewUser(), 10)->setValue($displayName);
+ }
+
+ /**
+ * @When I set the password for the new user to :password
+ */
+ public function iSetThePasswordForTheNewUserTo($password) {
+ $this->actor->find(self::passwordFieldForNewUser(), 10)->setValue($password);
+ }
+
+ /**
+ * @When I create the new user
+ */
+ public function iCreateTheNewUser() {
+ $this->actor->find(self::createNewUserButton(), 10)->click();
+ }
+
+ /**
* @When I create user :user with password :password
*/
public function iCreateUserWithPassword($user, $password) {
@@ -243,6 +286,13 @@ 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());
+ }
+
+ /**
* @Then I see that the :cell cell for user :user is done loading
*/
public function iSeeThatTheCellForUserIsDoneLoading($cell, $user) {
diff --git a/tests/acceptance/features/users.feature b/tests/acceptance/features/users.feature
index 1adc2e1f396..6baf3063631 100644
--- a/tests/acceptance/features/users.feature
+++ b/tests/acceptance/features/users.feature
@@ -9,6 +9,18 @@ Feature: users
When I create user unknownUser with password 123456acb
Then I see that the list of users contains the user unknownUser
+ Scenario: create a new user with a custom display name
+ Given I am logged in as the admin
+ And I open the User settings
+ When I click the New user button
+ And I see that the new user form is shown
+ And I set the user name for the new user to "test"
+ And I set the display name for the new user to "Test display name"
+ And I set the password for the new user to "123456acb"
+ And I create the new user
+ Then I see that the list of users contains the user "test"
+ And I see that the display name for the user "test" is "Test display name"
+
Scenario: delete a user
Given I act as Jane
And I am logged in as the admin