summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-06-15 10:51:39 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-06-20 19:21:54 +0200
commit2cfb3832fa35b496f8f47e308fda0fc6c2f5d0a2 (patch)
treefc478c23f07a5bdd6dc3a637fd606c6fafc37c24
parente01f004a130cc305ba7dcd8f7b82a8867ee54462 (diff)
downloadnextcloud-server-2cfb3832fa35b496f8f47e308fda0fc6c2f5d0a2.tar.gz
nextcloud-server-2cfb3832fa35b496f8f47e308fda0fc6c2f5d0a2.zip
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>
-rw-r--r--tests/acceptance/features/app-theming.feature11
-rw-r--r--tests/acceptance/features/bootstrap/ThemingAppContext.php19
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");
+ }
}
/**