newt acceptance tests
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
e45147d7d6
commit
f3a06259e4
|
@ -91,6 +91,23 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
|
|||
describedAs("Password input for user $user in Users Settings");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Locator
|
||||
*/
|
||||
public static function actionsMenuOf($user) {
|
||||
return Locator::forThe()->css(".icon-more")->descendantOf(self::rowForUser($user))->
|
||||
describedAs("Actions menu for user $user in Users Settings");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Locator
|
||||
*/
|
||||
public static function theAction($action, $user) {
|
||||
return Locator::forThe()->xpath("//button/span[normalize-space() = '$action']/..")->
|
||||
descendantOf(self::rowForUser($user))->
|
||||
describedAs("$action action for the user $user");
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I click the New user button
|
||||
*/
|
||||
|
@ -98,6 +115,20 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
|
|||
$this->actor->find(self::newUserButton())->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I click the $action action in the $user actions menu
|
||||
*/
|
||||
public function iClickTheAction($action, $user) {
|
||||
$this->actor->find(self::theAction($action, $user))->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I open the actions menu for the user :user
|
||||
*/
|
||||
public function iOpenTheActionsMenuOf($user) {
|
||||
$this->actor->find(self::actionsMenuOf($user))->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I create user :user with password :password
|
||||
*/
|
||||
|
@ -122,6 +153,13 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
|
|||
PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::rowForUser($user), 10));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I see that the list of users does not contains the user :user
|
||||
*/
|
||||
public function iSeeThatTheListOfUsersDoesNotContainsTheUser($user) {
|
||||
PHPUnit_Framework_Assert::assertNull($this->actor->find(self::rowForUser($user), 10));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I see that the new user form is shown
|
||||
*/
|
||||
|
@ -130,4 +168,12 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
|
|||
$this->actor->find(self::newUserForm(), 10)->isVisible());
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I see the $action action in the $user actions menu
|
||||
*/
|
||||
public function iSeeTheAction($action, $user) {
|
||||
PHPUnit_Framework_Assert::assertTrue(
|
||||
$this->actor->find(self::theAction($action, $user), 10)->isVisible());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
Feature: users
|
||||
|
||||
Scenario: create a new user
|
||||
Given 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
|
||||
When I create user unknownUser with password 123456acb
|
||||
Then I see that the list of users contains the user unknownUser
|
||||
|
||||
Scenario: delete a user
|
||||
Given I act as Jane
|
||||
And I am logged in as the admin
|
||||
And I open the User settings
|
||||
And I see that the list of users contains the user user0
|
||||
And I open the actions menu for the user user0
|
||||
And I see the "Delete user" action in the user0 actions menu
|
||||
When I click the "Delete user" action in the user0 actions menu
|
||||
Then I see that the list of users does not contains the user user0
|
||||
|
Loading…
Reference in New Issue