Fix and extend acceptance tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
8a8e78d439
commit
26ca563545
3 changed files with 55 additions and 6 deletions
|
@ -1,11 +1,10 @@
|
|||
Feature: access-levels
|
||||
|
||||
Scenario: regular users can not see admin-level items in the Settings menu
|
||||
Scenario: regular users cannot see admin-level items in the Settings menu
|
||||
Given I am logged in
|
||||
When I open the Settings menu
|
||||
Then I see that the Settings menu is shown
|
||||
And I see that the "Personal" item in the Settings menu is shown
|
||||
And I see that the "Admin" item in the Settings menu is not shown
|
||||
And I see that the "Settings" item in the Settings menu is shown
|
||||
And I see that the "Users" item in the Settings menu is not shown
|
||||
And I see that the "Help" item in the Settings menu is shown
|
||||
And I see that the "Log out" item in the Settings menu is shown
|
||||
|
@ -14,8 +13,19 @@ Feature: access-levels
|
|||
Given I am logged in as the admin
|
||||
When I open the Settings menu
|
||||
Then I see that the Settings menu is shown
|
||||
And I see that the "Personal" item in the Settings menu is shown
|
||||
And I see that the "Admin" item in the Settings menu is shown
|
||||
And I see that the "Settings" item in the Settings menu is shown
|
||||
And I see that the "Users" item in the Settings menu is shown
|
||||
And I see that the "Help" item in the Settings menu is shown
|
||||
And I see that the "Log out" item in the Settings menu is shown
|
||||
|
||||
Scenario: regular users cannot see amdin-level items on the Settings page
|
||||
Given I am logged in
|
||||
When I visit the settings page
|
||||
Then I see that the "Personal" settings panel is shown
|
||||
And I see that the "Administration" settings panel is not shown
|
||||
|
||||
Scenario: admin users can see amdin-level items on the Settings page
|
||||
Given I am logged in as the admin
|
||||
When I visit the settings page
|
||||
Then I see that the "Personal" settings panel is shown
|
||||
And I see that the "Administration" settings panel is shown
|
||||
|
|
|
@ -66,6 +66,15 @@ class SettingsMenuContext implements Context, ActorAwareInterface {
|
|||
describedAs($itemText . " item in Settings menu");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $itemText
|
||||
* @return Locator
|
||||
*/
|
||||
private static function settingsPanelFor($itemText) {
|
||||
return Locator::forThe()->xpath("//div[@id = 'app-navigation']//ul//li[@class = 'settings-caption' and normalize-space() = '$itemText']")->
|
||||
describedAs($itemText . " item in Settings panel");
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I open the Settings menu
|
||||
*/
|
||||
|
@ -73,6 +82,7 @@ class SettingsMenuContext implements Context, ActorAwareInterface {
|
|||
$this->actor->find(self::settingsMenuButton(), 10)->click();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @When I open the User settings
|
||||
*/
|
||||
|
@ -82,6 +92,14 @@ class SettingsMenuContext implements Context, ActorAwareInterface {
|
|||
$this->actor->find(self::usersMenuItem(), 2)->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I visit the settings page
|
||||
*/
|
||||
public function iVisitTheSettingsPage() {
|
||||
$this->iOpenTheSettingsMenu();
|
||||
$this->actor->find(self::menuItemFor('Settings'), 20)->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I log out
|
||||
*/
|
||||
|
@ -120,4 +138,25 @@ class SettingsMenuContext implements Context, ActorAwareInterface {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I see that the :itemText settings panel is shown
|
||||
*/
|
||||
public function iSeeThatTheItemSettingsPanelIsShown($itemText) {
|
||||
PHPUnit_Framework_Assert::assertTrue(
|
||||
$this->actor->find(self::settingsPanelFor($itemText), 10)->isVisible()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I see that the :itemText settings panel is not shown
|
||||
*/
|
||||
public function iSeeThatTheItemSettingsPanelIsNotShown($itemText) {
|
||||
try {
|
||||
PHPUnit_Framework_Assert::assertFalse(
|
||||
$this->actor->find(self::settingsPanelFor($itemText), 10)->isVisible()
|
||||
);
|
||||
} catch (NoSuchElementException $exception) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ class ElementWrapper {
|
|||
/**
|
||||
* Returns whether the wrapped element is visible or not.
|
||||
*
|
||||
* @return boolbean true if the wrapped element is visible, false otherwise.
|
||||
* @return bool true if the wrapped element is visible, false otherwise.
|
||||
*/
|
||||
public function isVisible() {
|
||||
$commandCallback = function() {
|
||||
|
|
Loading…
Reference in a new issue