diff --git a/.drone.yml b/.drone.yml index 3a0d5ade9ee1c..71ce09370c5f8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -594,6 +594,13 @@ pipeline: when: matrix: TESTS-ACCEPTANCE: login + acceptance-settings-users: + image: nextcloudci/acceptance-php7.1:acceptance-php7.1-2 + commands: + - tests/acceptance/run-local.sh --timeout-multiplier 10 --nextcloud-server-domain acceptance-settings-users --selenium-server selenium:4444 allow-git-repository-modifications features/settings-users.feature + when: + matrix: + TESTS-ACCEPTANCE: settings-users nodb-codecov: image: nextcloudci/php7.0:php7.0-19 commands: diff --git a/tests/acceptance/features/bootstrap/UsersSettingsContext.php b/tests/acceptance/features/bootstrap/UsersSettingsContext.php index 9ddea57f41391..ff187bbb7256a 100644 --- a/tests/acceptance/features/bootstrap/UsersSettingsContext.php +++ b/tests/acceptance/features/bootstrap/UsersSettingsContext.php @@ -43,6 +43,14 @@ public static function userNameFieldForNewUser() { describedAs("User name field for new user in Users Settings"); } + /** + * @return Locator + */ + public static function displayNameFieldForNewUser() { + return Locator::forThe()->field("newdisplayname")-> + describedAs("Display name field for new user in Users Settings"); + } + /** * @return Locator */ @@ -75,6 +83,14 @@ public static function rowForUser($user) { describedAs("Row for user $user in Users Settings"); } + /** + * @return Locator + */ + public static function displayNameCellForUser($user) { + return Locator::forThe()->css(".displayName")->descendantOf(self::rowForUser($user))-> + describedAs("Display name cell for user $user in Users Settings"); + } + /** * @return Locator */ @@ -98,6 +114,34 @@ public function iClickTheNewUserButton() { $this->actor->find(self::newUserButton())->click(); } + /** + * @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 */ @@ -122,6 +166,13 @@ public function iSeeThatTheListOfUsersContainsTheUser($user) { PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::rowForUser($user), 10)); } + /** + * @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)->getText()); + } + /** * @Then I see that the new user form is shown */ diff --git a/tests/acceptance/features/settings-users.feature b/tests/acceptance/features/settings-users.feature new file mode 100644 index 0000000000000..bc1d9466517c1 --- /dev/null +++ b/tests/acceptance/features/settings-users.feature @@ -0,0 +1,13 @@ +Feature: settings-users + + 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"