From b5efe7d243603effd392a6079d639f8b207c13be Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Tue, 12 Jan 2016 13:36:02 +0200 Subject: Add a simple waitForApplication for servlet integration tests This waitForApplication checks if an UI element exists on the page. If not, then it will wait 10 seconds in order for it to appear. This should reduce the amount of false negatives in server tests. Change-Id: I37a398e60c247920fd56fc05b747e0f93f3f2dd2 --- .../vaadin/tests/integration/AbstractIntegrationTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java b/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java index 5dd59a8245..f035ef35f6 100644 --- a/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java +++ b/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java @@ -15,6 +15,8 @@ */ package com.vaadin.tests.integration; +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.UIElement; import com.vaadin.testbench.parallel.TestNameSuffix; import com.vaadin.tests.tb3.PrivateTB3Configuration; @@ -37,4 +39,17 @@ public abstract class AbstractIntegrationTest extends PrivateTB3Configuration { return deploymentUrl; } + @Override + protected void openTestURL() { + super.openTestURL(); + + waitForApplication(); + } + + protected void waitForApplication() { + if (!isElementPresent(UIElement.class)) { + // Wait for UI element. + waitForElementPresent(By.vaadin("//com.vaadin.ui.UI")); + } + } } -- cgit v1.2.3