diff options
-rw-r--r-- | tests/acceptance/features/bootstrap/UsersSettingsContext.php | 33 | ||||
-rw-r--r-- | tests/acceptance/features/login.feature | 2 |
2 files changed, 34 insertions, 1 deletions
diff --git a/tests/acceptance/features/bootstrap/UsersSettingsContext.php b/tests/acceptance/features/bootstrap/UsersSettingsContext.php index 93ab7246eb6..9ddea57f413 100644 --- a/tests/acceptance/features/bootstrap/UsersSettingsContext.php +++ b/tests/acceptance/features/bootstrap/UsersSettingsContext.php @@ -30,6 +30,14 @@ class UsersSettingsContext implements Context, ActorAwareInterface { /** * @return Locator */ + public static function newUserForm() { + return Locator::forThe()->id("newuserHeader")-> + describedAs("New user form in Users Settings"); + } + + /** + * @return Locator + */ public static function userNameFieldForNewUser() { return Locator::forThe()->field("newusername")-> describedAs("User name field for new user in Users Settings"); @@ -46,6 +54,14 @@ class UsersSettingsContext implements Context, ActorAwareInterface { /** * @return Locator */ + public static function newUserButton() { + return Locator::forThe()->id("new-user-button")-> + describedAs("New user button in Users Settings"); + } + + /** + * @return Locator + */ public static function createNewUserButton() { return Locator::forThe()->xpath("//form[@id = 'newuser']//input[@type = 'submit']")-> describedAs("Create user button in Users Settings"); @@ -55,7 +71,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface { * @return Locator */ public static function rowForUser($user) { - return Locator::forThe()->xpath("//table[@id = 'userlist']//th[normalize-space() = '$user']/..")-> + return Locator::forThe()->xpath("//table[@id = 'userlist']//td[normalize-space() = '$user']/..")-> describedAs("Row for user $user in Users Settings"); } @@ -76,6 +92,13 @@ class UsersSettingsContext implements Context, ActorAwareInterface { } /** + * @When I click the New user button + */ + public function iClickTheNewUserButton() { + $this->actor->find(self::newUserButton())->click(); + } + + /** * @When I create user :user with password :password */ public function iCreateUserWithPassword($user, $password) { @@ -99,4 +122,12 @@ class UsersSettingsContext implements Context, ActorAwareInterface { PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::rowForUser($user), 10)); } + /** + * @Then I see that the new user form is shown + */ + public function iSeeThatTheNewUserFormIsShown() { + PHPUnit_Framework_Assert::assertTrue( + $this->actor->find(self::newUserForm(), 10)->isVisible()); + } + } diff --git a/tests/acceptance/features/login.feature b/tests/acceptance/features/login.feature index e414209206e..3db8c4945ec 100644 --- a/tests/acceptance/features/login.feature +++ b/tests/acceptance/features/login.feature @@ -35,6 +35,8 @@ Feature: login When I act as Jane And I am logged in as the admin And I open the User settings + And I click the New user button + And I see that the new user form is shown And I create user unknownUser with password 123456acb And I see that the list of users contains the user unknownUser And I act as John |