summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-11-29 18:18:04 +0200
committerVaadin Code Review <review@vaadin.com>2013-12-02 09:24:57 +0000
commitc171850a2c6fab38a81b2d0ab92d3433b2cf558c (patch)
tree95241869930db868deb17b8090c9c8a705dc51f8 /uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
parentea46029ea154cc018525219f06095817339607e8 (diff)
downloadvaadin-framework-c171850a2c6fab38a81b2d0ab92d3433b2cf558c.tar.gz
vaadin-framework-c171850a2c6fab38a81b2d0ab92d3433b2cf558c.zip
Disable client timeout so websockets are not disconnected when idle (#13015)
Updated sleep method to ensure that long sleeps can be performed without losing the connection to the browser Change-Id: I4f29d946e7a9a400e303e3a574876e1bc2d56773
Diffstat (limited to 'uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java')
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index d7b7cd050f..f6fce18fae 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -74,6 +74,11 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
*/
private static final int SCREENSHOT_WIDTH = 1500;
+ /**
+ * Timeout used by the TB grid
+ */
+ private static final int BROWSER_TIMEOUT_IN_MS = 30 * 1000;
+
private DesiredCapabilities desiredCapabilities;
private boolean debug = false;
@@ -641,17 +646,21 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
}
/**
- * Helper method for sleeping X ms in a test. Catches and ignores
- * InterruptedExceptions
+ * Sleeps for the given number of ms but ensures that the browser connection
+ * does not time out.
*
* @param timeoutMillis
* Number of ms to wait
+ * @throws InterruptedException
*/
- protected void sleep(int timeoutMillis) {
- try {
- Thread.sleep(timeoutMillis);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
+ protected void sleep(int timeoutMillis) throws InterruptedException {
+ while (timeoutMillis > 0) {
+ int d = Math.min(BROWSER_TIMEOUT_IN_MS, timeoutMillis);
+ Thread.sleep(d);
+ timeoutMillis -= d;
+
+ // Do something to keep the connection alive
+ getDriver().getTitle();
}
}