diff options
-rw-r--r-- | tests/acceptance/features/app-theming.feature | 11 | ||||
-rw-r--r-- | tests/acceptance/features/bootstrap/ThemingAppContext.php | 19 |
2 files changed, 20 insertions, 10 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/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"); + } } /** |