diff options
Diffstat (limited to 'uitest/src/com/vaadin/tests')
-rw-r--r-- | uitest/src/com/vaadin/tests/push/PushConfigurationTest.java | 24 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/push/PushLargeData.java | 8 |
2 files changed, 22 insertions, 10 deletions
diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java index 1f8c4c0e38..a8ea9d0010 100644 --- a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java +++ b/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java @@ -15,6 +15,8 @@ */ package com.vaadin.tests.push; +import static org.junit.Assert.assertEquals; + import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebDriver; @@ -27,13 +29,11 @@ import com.vaadin.tests.tb3.WebsocketTest; public class PushConfigurationTest extends WebsocketTest { @Test - public void testWebsocketAndStreaming() { + public void testWebsocketAndStreaming() throws InterruptedException { setDebug(true); openTestURL(); // Websocket - int counter = getServerCounter(); - assertGreaterOrEqual("Counter should be >= 1. Was: " + counter, - counter, 1); + verifyPushDisabled(); new Select(getTransportSelect()).selectByVisibleText("WEBSOCKET"); new Select(getPushModeSelect()).selectByVisibleText("AUTOMATIC"); Assert.assertTrue(vaadinElement( @@ -41,7 +41,7 @@ public class PushConfigurationTest extends WebsocketTest { .getText() .matches( "^[\\s\\S]*fallbackTransport: streaming[\\s\\S]*transport: websocket[\\s\\S]*$")); - counter = getServerCounter(); + int counter = getServerCounter(); final int waitCounter = counter + 2; waitUntil(new ExpectedCondition<Boolean>() { @@ -61,7 +61,7 @@ public class PushConfigurationTest extends WebsocketTest { // Streaming driver.get(getTestUrl()); - Assert.assertEquals(1, getServerCounter()); + verifyPushDisabled(); new Select(getTransportSelect()).selectByVisibleText("STREAMING"); new Select(getPushModeSelect()).selectByVisibleText("AUTOMATIC"); @@ -93,6 +93,18 @@ public class PushConfigurationTest extends WebsocketTest { } + /** + * Verifies that push is currently not enabled. + * + * @throws InterruptedException + */ + private void verifyPushDisabled() throws InterruptedException { + int counter = getServerCounter(); + sleep(2000); + assertEquals("Server count changed without push enabled", counter, + getServerCounter()); + } + private WebElement getPushModeSelect() { return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VNativeSelect[0]/domChild[0]"); } diff --git a/uitest/src/com/vaadin/tests/push/PushLargeData.java b/uitest/src/com/vaadin/tests/push/PushLargeData.java index 93925ffb9f..f43348b5eb 100644 --- a/uitest/src/com/vaadin/tests/push/PushLargeData.java +++ b/uitest/src/com/vaadin/tests/push/PushLargeData.java @@ -34,14 +34,14 @@ import com.vaadin.ui.UI; public abstract class PushLargeData extends AbstractTestUIWithLog { - // 250KB - static final int DEFAULT_SIZE_BYTES = 250 * 1000; + // 200KB + static final int DEFAULT_SIZE_BYTES = 200 * 1000; // Every other second static final int DEFAULT_DELAY_MS = 2000; - // 20 MB is enough for streaming to reconnect - static final int DEFAULT_DATA_TO_PUSH = 20 * 1000 * 1000; + // 3 MB is enough for streaming to reconnect + static final int DEFAULT_DATA_TO_PUSH = 3 * 1000 * 1000; static final int DEFAULT_DURATION_MS = DEFAULT_DATA_TO_PUSH / DEFAULT_SIZE_BYTES * DEFAULT_DELAY_MS; |