aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--uitest/src/com/vaadin/tests/application/ResynchronizeUITest.java8
-rw-r--r--uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResourceTest.java11
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java16
-rw-r--r--uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java17
-rw-r--r--uitest/src/com/vaadin/tests/themes/ThemeChangeFaviconTest.java15
-rw-r--r--uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java17
6 files changed, 26 insertions, 58 deletions
diff --git a/uitest/src/com/vaadin/tests/application/ResynchronizeUITest.java b/uitest/src/com/vaadin/tests/application/ResynchronizeUITest.java
index 4dd8292e23..726616d7b8 100644
--- a/uitest/src/com/vaadin/tests/application/ResynchronizeUITest.java
+++ b/uitest/src/com/vaadin/tests/application/ResynchronizeUITest.java
@@ -48,13 +48,7 @@ public class ResynchronizeUITest extends SingleBrowserTest {
// Click causes repaint, after this the old button element should no
// longer be available
// Ensure that the theme has changed
- waitUntil(new ExpectedCondition<Boolean>() {
- @Override
- public Boolean apply(WebDriver input) {
- WebElement app = input.findElement(By.className("v-app"));
- return hasCssClass(app, "runo");
- }
- });
+ waitForThemeToChange("runo");
try {
button.click();
Assert.fail("The old button element should have been removed by the click and replaced by a new one.");
diff --git a/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResourceTest.java b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResourceTest.java
index dc4dd341f4..f892775ea3 100644
--- a/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResourceTest.java
+++ b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResourceTest.java
@@ -80,12 +80,16 @@ public class EmbeddedThemeResourceTest extends SingleBrowserTest {
@Test
public void testUpdatedTheme() {
- EmbeddedElement embedded = $(EmbeddedElement.class).first();
- final ImageElement image = $(ImageElement.class).first();
- final String initial = image.getAttribute("src");
+ final String initial = $(ImageElement.class).first()
+ .getAttribute("src");
// update theme
$(ButtonElement.class).first().click();
+ waitForThemeToChange("reindeer");
+
+ EmbeddedElement embedded = $(EmbeddedElement.class).first();
+ // Re fetch as theme change creates new elements
+ final ImageElement image = $(ImageElement.class).first();
waitUntil(new ExpectedCondition<Boolean>() {
@Override
@@ -107,4 +111,5 @@ public class EmbeddedThemeResourceTest extends SingleBrowserTest {
embedded.findElement(By.tagName("img")).getAttribute("src"),
is(image.getAttribute("src")));
}
+
}
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index 2e3854cb2b..9bcaf4598b 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -1195,4 +1195,20 @@ public abstract class AbstractTB3Test extends ParallelTest {
return (WebElement) executeScript("return document.activeElement;");
}
+
+ protected void waitForThemeToChange(final String theme) {
+
+ final WebElement rootDiv = findElement(By
+ .xpath("//div[contains(@class,'v-app')]"));
+ waitUntil(new ExpectedCondition<Boolean>() {
+
+ @Override
+ public Boolean apply(WebDriver input) {
+ String rootClass = rootDiv.getAttribute("class").trim();
+
+ return rootClass.contains(theme);
+ }
+ }, 30);
+ }
+
}
diff --git a/uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java b/uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java
index 3c992f3af5..8062fdbf39 100644
--- a/uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java
+++ b/uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java
@@ -20,10 +20,8 @@ import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
-import org.openqa.selenium.support.ui.ExpectedCondition;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.ComboBoxElement;
@@ -159,19 +157,4 @@ public class LegacyComponentThemeChangeTest extends MultiBrowserTest {
waitForThemeToChange(theme);
}
- private void waitForThemeToChange(final String theme) {
-
- final WebElement rootDiv = findElement(By
- .xpath("//div[contains(@class,'v-app')]"));
- waitUntil(new ExpectedCondition<Boolean>() {
-
- @Override
- public Boolean apply(WebDriver input) {
- String rootClass = rootDiv.getAttribute("class").trim();
-
- return rootClass.contains(theme);
- }
- }, 30);
- }
-
}
diff --git a/uitest/src/com/vaadin/tests/themes/ThemeChangeFaviconTest.java b/uitest/src/com/vaadin/tests/themes/ThemeChangeFaviconTest.java
index e4788f93f5..cb5e9d07c7 100644
--- a/uitest/src/com/vaadin/tests/themes/ThemeChangeFaviconTest.java
+++ b/uitest/src/com/vaadin/tests/themes/ThemeChangeFaviconTest.java
@@ -21,10 +21,8 @@ import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
-import org.openqa.selenium.support.ui.ExpectedCondition;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.parallel.Browser;
@@ -55,18 +53,7 @@ public class ThemeChangeFaviconTest extends SingleBrowserTest {
private void changeTheme(final String theme) {
$(ButtonElement.class).caption(theme).first().click();
-
- final WebElement rootDiv = findElement(By
- .xpath("//div[contains(@class,'v-app')]"));
- waitUntil(new ExpectedCondition<Boolean>() {
-
- @Override
- public Boolean apply(WebDriver input) {
- String rootClass = rootDiv.getAttribute("class").trim();
-
- return rootClass.contains(theme);
- }
- }, 30);
+ waitForThemeToChange(theme);
}
private void assertFavicon(String theme) {
diff --git a/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java b/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java
index 211a908ccb..caf264abf1 100644
--- a/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java
+++ b/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java
@@ -23,10 +23,8 @@ import java.util.List;
import org.junit.Test;
import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
-import org.openqa.selenium.support.ui.ExpectedCondition;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -91,21 +89,6 @@ public class ThemeChangeOnTheFlyTest extends MultiBrowserTest {
}
}
- private void waitForThemeToChange(final String theme) {
-
- final WebElement rootDiv = findElement(By
- .xpath("//div[contains(@class,'v-app')]"));
- waitUntil(new ExpectedCondition<Boolean>() {
-
- @Override
- public Boolean apply(WebDriver input) {
- String rootClass = rootDiv.getAttribute("class").trim();
-
- return rootClass.contains(theme);
- }
- }, 30);
- }
-
private void assertOverlayTheme(String theme) {
final WebElement overlayContainerDiv = findElement(By
.xpath("//div[contains(@class,'v-overlay-container')]"));