Adjust theming acceptance tests to new header colour transition
Before, the acceptance tests checked the header colour just once, as the header colour was immediately changed once the new theming colour was saved. This is no longer the case, as currently a transition is used to change between the original colour and the new one, so now the acceptance tests check repeteadly for the expected header colour until it matches or the timeout expires. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
e01f004a13
commit
2cfb3832fa
2 changed files with 20 additions and 10 deletions
|
@ -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"
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue