Fix acceptance tests

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2018-02-27 18:48:14 +01:00 committed by Daniel Calviño Sánchez
parent 8af3b5d377
commit 907234fde2
2 changed files with 34 additions and 1 deletions

View file

@ -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());
}
}

View file

@ -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