diff options
Diffstat (limited to 'tests/acceptance/features')
-rw-r--r-- | tests/acceptance/features/app-theming.feature | 11 | ||||
-rw-r--r-- | tests/acceptance/features/bootstrap/SettingsMenuContext.php | 2 | ||||
-rw-r--r-- | tests/acceptance/features/bootstrap/ThemingAppContext.php | 19 |
3 files changed, 21 insertions, 11 deletions
diff --git a/tests/acceptance/features/app-theming.feature b/tests/acceptance/features/app-theming.feature index 375e2bc1cae..268b9a04a2f 100644 --- a/tests/acceptance/features/app-theming.feature +++ b/tests/acceptance/features/app-theming.feature @@ -5,10 +5,13 @@ Feature: app-theming And I visit the settings page And I open the "Theming" section And I see that the color selector in the Theming app has loaded - And I see that the header color is "#0082C9" + # The "eventually" part is not really needed here, as the colour is not + # being animated at this point, but there is no need to create a specific + # step just for this. + And I see that the header color is eventually "#0082C9" When I set the "Color" parameter in the Theming app to "#C9C9C9" Then I see that the parameters in the Theming app are eventually saved - And I see that the header color is "#C9C9C9" + And I see that the header color is eventually "#C9C9C9" Scenario: resetting the color updates the header color Given I am logged in as the admin @@ -17,7 +20,7 @@ Feature: app-theming And I see that the color selector in the Theming app has loaded And I set the "Color" parameter in the Theming app to "#C9C9C9" And I see that the parameters in the Theming app are eventually saved - And I see that the header color is "#C9C9C9" + And I see that the header color is eventually "#C9C9C9" When I reset the "Color" parameter in the Theming app to its default value Then I see that the parameters in the Theming app are eventually saved - And I see that the header color is "#0082C9" + And I see that the header color is eventually "#0082C9" diff --git a/tests/acceptance/features/bootstrap/SettingsMenuContext.php b/tests/acceptance/features/bootstrap/SettingsMenuContext.php index 6187d9f6c10..fd9b9424c9d 100644 --- a/tests/acceptance/features/bootstrap/SettingsMenuContext.php +++ b/tests/acceptance/features/bootstrap/SettingsMenuContext.php @@ -79,7 +79,7 @@ class SettingsMenuContext implements Context, ActorAwareInterface { * @return Locator */ private static function settingsPanelFor($itemText) { - return Locator::forThe()->xpath("//div[@id = 'app-navigation']//ul//li[@class = 'settings-caption' and normalize-space() = '$itemText']")-> + return Locator::forThe()->xpath("//div[@id = 'app-navigation']//ul//li[@class = 'app-navigation-caption' and normalize-space() = '$itemText']")-> describedAs($itemText . " item in Settings panel"); } diff --git a/tests/acceptance/features/bootstrap/ThemingAppContext.php b/tests/acceptance/features/bootstrap/ThemingAppContext.php index e8a8a301ed7..4791a70e813 100644 --- a/tests/acceptance/features/bootstrap/ThemingAppContext.php +++ b/tests/acceptance/features/bootstrap/ThemingAppContext.php @@ -125,13 +125,20 @@ class ThemingAppContext implements Context, ActorAwareInterface { } /** - * @Then I see that the header color is :color + * @Then I see that the header color is eventually :color */ - public function iSeeThatTheHeaderColorIs($color) { - $headerColor = $this->actor->getSession()->evaluateScript("return $('#header').css('background-color');"); - $headerColor = $this->getRGBArray($headerColor); - $color = $this->getRGBArray($color); - PHPUnit_Framework_Assert::assertEquals($color, $headerColor); + public function iSeeThatTheHeaderColorIsEventually($color) { + $headerColorMatchesCallback = function() use($color) { + $headerColor = $this->actor->getSession()->evaluateScript("return $('#header').css('background-color');"); + $headerColor = $this->getRGBArray($headerColor); + $color = $this->getRGBArray($color); + + return $headerColor == $color; + }; + + if (!Utils::waitFor($headerColorMatchesCallback, $timeout = 10 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) { + PHPUnit_Framework_Assert::fail("The header color is not $color yet after $timeout seconds"); + } } /** |