summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2017-09-07 16:15:25 +0300
committerHenri Sara <henri.sara@gmail.com>2017-09-08 09:44:40 +0300
commit7206862fa41890d4addb9073ce167bf9c7df430e (patch)
tree6cd90decc7c822cc17ab2550bdbbcab27cc67115 /test
parentd8f000c129f5258de853c4ce3d249871bc2ef86c (diff)
downloadvaadin-framework-7206862fa41890d4addb9073ce167bf9c7df430e.tar.gz
vaadin-framework-7206862fa41890d4addb9073ce167bf9c7df430e.zip
Add wait for UI load to test
Diffstat (limited to 'test')
-rw-r--r--test/servlet-containers/karaf/karaf-run/src/test/java/com/vaadin/test/osgi/KarafIntegrationIT.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/test/servlet-containers/karaf/karaf-run/src/test/java/com/vaadin/test/osgi/KarafIntegrationIT.java b/test/servlet-containers/karaf/karaf-run/src/test/java/com/vaadin/test/osgi/KarafIntegrationIT.java
index d2d8e54a9c..6cede7b3af 100644
--- a/test/servlet-containers/karaf/karaf-run/src/test/java/com/vaadin/test/osgi/KarafIntegrationIT.java
+++ b/test/servlet-containers/karaf/karaf-run/src/test/java/com/vaadin/test/osgi/KarafIntegrationIT.java
@@ -15,15 +15,20 @@
*/
package com.vaadin.test.osgi;
-import com.vaadin.testbench.TestBenchTestCase;
+import static org.junit.Assert.assertEquals;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.phantomjs.PhantomJSDriver;
+import org.openqa.selenium.support.ui.WebDriverWait;
-import static org.junit.Assert.assertEquals;
+import com.google.common.base.Predicate;
+import com.vaadin.testbench.TestBenchTestCase;
+import com.vaadin.testbench.elements.TextFieldElement;
public class KarafIntegrationIT extends TestBenchTestCase {
@@ -31,11 +36,10 @@ public class KarafIntegrationIT extends TestBenchTestCase {
private static final String APP1_URL = URL_PREFIX + "myapp1";
private static final String APP2_URL = URL_PREFIX + "myapp2";
-
@Test
public void testApp1() {
runBasicTest(APP1_URL, "bar");
- //App theme should make a button pink
+ // App theme should make a button pink
WebElement element = getDriver().findElement(By.className("v-button"));
String buttonColor = element.getCssValue("color");
assertEquals("rgba(255, 128, 128, 1)", buttonColor);
@@ -48,13 +52,16 @@ public class KarafIntegrationIT extends TestBenchTestCase {
private void runBasicTest(String app1Url, String text) {
getDriver().navigate().to(app1Url);
+ Predicate<WebDriver> isTrue = driver -> isElementPresent(
+ TextFieldElement.class);
+ new WebDriverWait(getDriver(), 5000).until(isTrue);
getDriver().findElement(By.className("v-textfield")).sendKeys(text);
getDriver().findElement(By.className("v-button")).click();
- String foundText = getDriver().findElement(By.className("v-label")).getText();
+ String foundText = getDriver().findElement(By.className("v-label"))
+ .getText();
assertEquals("Thanks " + text + ", it works!", foundText);
}
-
@Before
public void setup() {
setDriver(new PhantomJSDriver());