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 @@ -27,6 +27,14 @@ class UsersSettingsContext implements Context, ActorAwareInterface { use ActorAware; + /** + * @return Locator + */ + public static function newUserForm() { + return Locator::forThe()->id("newuserHeader")-> + describedAs("New user form in Users Settings"); + } + /** * @return Locator */ @@ -43,6 +51,14 @@ class UsersSettingsContext implements Context, ActorAwareInterface { describedAs("Password field for new user in Users Settings"); } + /** + * @return Locator + */ + public static function newUserButton() { + return Locator::forThe()->id("new-user-button")-> + describedAs("New user button in Users Settings"); + } + /** * @return Locator */ @@ -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"); } @@ -75,6 +91,13 @@ class UsersSettingsContext implements Context, ActorAwareInterface { describedAs("Password input for user $user in Users Settings"); } + /** + * @When I click the New user button + */ + public function iClickTheNewUserButton() { + $this->actor->find(self::newUserButton())->click(); + } + /** * @When I create user :user with password :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