diff options
Diffstat (limited to 'tests/acceptance/features/bootstrap/SettingsMenuContext.php')
-rw-r--r-- | tests/acceptance/features/bootstrap/SettingsMenuContext.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/acceptance/features/bootstrap/SettingsMenuContext.php b/tests/acceptance/features/bootstrap/SettingsMenuContext.php index 1ff5d94e98f..29b959fa92a 100644 --- a/tests/acceptance/features/bootstrap/SettingsMenuContext.php +++ b/tests/acceptance/features/bootstrap/SettingsMenuContext.php @@ -67,12 +67,22 @@ class SettingsMenuContext implements Context, ActorAwareInterface { } /** + * @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 */ public function iOpenTheSettingsMenu() { $this->actor->find(self::settingsMenuButton(), 10)->click(); } + /** * @When I open the User settings */ @@ -83,6 +93,14 @@ class SettingsMenuContext implements Context, ActorAwareInterface { } /** + * @When I visit the settings page + */ + public function iVisitTheSettingsPage() { + $this->iOpenTheSettingsMenu(); + $this->actor->find(self::menuItemFor('Settings'), 20)->click(); + } + + /** * @When I log out */ public function iLogOut() { @@ -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) { + } + } + } |