summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-10-22 23:24:44 +0300
committerVaadin Code Review <review@vaadin.com>2013-10-23 13:06:25 +0000
commit2c6d010d90b96b0a087af589af27d9dd11ceca33 (patch)
treedc08bbe34e0fb2b0c62ae13ead2471f227e0718f
parentc464dcf9217ac6763e4bf7aec18fbf13dff29308 (diff)
downloadvaadin-framework-2c6d010d90b96b0a087af589af27d9dd11ceca33.tar.gz
vaadin-framework-2c6d010d90b96b0a087af589af27d9dd11ceca33.zip
Fixes test issues preventing it from passing
Ensure push is enabled correctly without a fallback and made test more stable Change-Id: I6c653a96375e05c6ad18e1f5b697c6a584c6c53f
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeData.java18
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeDataStreaming.java6
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java20
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeDataWebsocket.java7
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java14
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java5
6 files changed, 51 insertions, 19 deletions
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeData.java b/uitest/src/com/vaadin/tests/push/PushLargeData.java
index 8ad005df81..1a9bf16de6 100644
--- a/uitest/src/com/vaadin/tests/push/PushLargeData.java
+++ b/uitest/src/com/vaadin/tests/push/PushLargeData.java
@@ -34,6 +34,18 @@ import com.vaadin.ui.UI;
public abstract class PushLargeData extends AbstractTestUIWithLog {
+ // 1MB
+ static final int DEFAULT_SIZE_BYTES = 1000 * 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;
+
+ static final int DEFAULT_DURATION_MS = DEFAULT_DATA_TO_PUSH
+ / DEFAULT_SIZE_BYTES * DEFAULT_DELAY_MS;
+
private Label dataLabel = new Label();
private final ExecutorService executor = Executors
@@ -49,9 +61,9 @@ public abstract class PushLargeData extends AbstractTestUIWithLog {
final TextField duration = new TextField("Duration (ms)");
duration.setConverter(Integer.class);
- dataSize.setValue((1000 * 1000) + "");
- interval.setValue(2000 + "");
- duration.setValue(40 * 1000 + "");
+ dataSize.setValue(DEFAULT_SIZE_BYTES + "");
+ interval.setValue(DEFAULT_DELAY_MS + "");
+ duration.setValue(DEFAULT_DURATION_MS + "");
addComponent(dataSize);
addComponent(interval);
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataStreaming.java b/uitest/src/com/vaadin/tests/push/PushLargeDataStreaming.java
index 464cbcc757..7706aa90c6 100644
--- a/uitest/src/com/vaadin/tests/push/PushLargeDataStreaming.java
+++ b/uitest/src/com/vaadin/tests/push/PushLargeDataStreaming.java
@@ -15,15 +15,19 @@
*/
package com.vaadin.tests.push;
+import com.vaadin.annotations.Push;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.ui.Transport;
+import com.vaadin.shared.ui.ui.UIState.PushConfigurationState;
+@Push(transport = Transport.STREAMING)
public class PushLargeDataStreaming extends PushLargeData {
@Override
protected void setup(VaadinRequest request) {
super.setup(request);
getPushConfiguration().setTransport(Transport.STREAMING);
- getPushConfiguration().setFallbackTransport(Transport.STREAMING);
+ getPushConfiguration().setParameter(
+ PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
}
}
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java
index c716a6fc7e..8f10f0fbba 100644
--- a/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java
+++ b/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java
@@ -19,12 +19,12 @@ import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
-import com.vaadin.tests.tb3.WebsocketTest;
+import com.vaadin.tests.tb3.MultiBrowserTest;
-public class PushLargeDataStreamingTest extends WebsocketTest {
+public class PushLargeDataStreamingTest extends MultiBrowserTest {
@Test
- public void testWebsocketLargeData() {
+ public void testStreamingLargeData() {
openTestURL();
// Without this there is a large chance that we will wait for all pushes
@@ -39,17 +39,23 @@ public class PushLargeDataStreamingTest extends WebsocketTest {
}
private void push() {
+ // Wait for startButton to be present
+ waitForElementToBePresent(vaadinLocatorById("startButton"));
+
String logRow0Id = "Log_row_0";
By logRow0 = vaadinLocatorById(logRow0Id);
vaadinElementById("startButton").click();
- waitUntil(ExpectedConditions.not(ExpectedConditions
- .textToBePresentInElement(logRow0, "Push complete")));
+ // Wait for push to start
+ waitUntil(ExpectedConditions.textToBePresentInElement(logRow0,
+ "Package "));
- // Pushes each 2000ms for 40s
- sleep(40000);
+ // Wait for until push should be done
+ sleep(PushLargeData.DEFAULT_DURATION_MS);
+ // Wait until push is actually done
waitUntil(ExpectedConditions.textToBePresentInElement(logRow0,
"Push complete"));
}
+
}
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocket.java b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocket.java
index 974dc880f9..4115a825d1 100644
--- a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocket.java
+++ b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocket.java
@@ -19,14 +19,15 @@ package com.vaadin.tests.push;
import com.vaadin.annotations.Push;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.ui.Transport;
+import com.vaadin.shared.ui.ui.UIState.PushConfigurationState;
-@Push
+@Push(transport = Transport.WEBSOCKET)
public class PushLargeDataWebsocket extends PushLargeData {
@Override
protected void setup(VaadinRequest request) {
super.setup(request);
- getPushConfiguration().setTransport(Transport.WEBSOCKET);
- getPushConfiguration().setFallbackTransport(Transport.WEBSOCKET);
+ getPushConfiguration().setParameter(
+ PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
}
}
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java
index 83f9efc8dd..70a94f743e 100644
--- a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java
+++ b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java
@@ -39,17 +39,21 @@ public class PushLargeDataWebsocketTest extends WebsocketTest {
}
private void push() {
+ // Wait for startButton to be present
+ waitForElementToBePresent(vaadinLocatorById("startButton"));
+
String logRow0Id = "Log_row_0";
By logRow0 = vaadinLocatorById(logRow0Id);
- testBench(driver).waitForVaadin();
vaadinElementById("startButton").click();
- waitUntil(ExpectedConditions.not(ExpectedConditions
- .textToBePresentInElement(logRow0, "Push complete")));
+ // Wait for push to start
+ waitUntil(ExpectedConditions.textToBePresentInElement(logRow0,
+ "Package"));
- // Pushes each 2000ms for 40s
- sleep(40000);
+ // Wait for until push should be done
+ sleep(PushLargeData.DEFAULT_DURATION_MS);
+ // Wait until push is actually done
waitUntil(ExpectedConditions.textToBePresentInElement(logRow0,
"Push complete"));
}
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index 712ef94397..218c532beb 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -328,6 +328,11 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
new WebDriverWait(driver, 10).until(ExpectedConditions.not(condition));
}
+ protected void waitForElementToBePresent(By by) {
+ waitUntil(ExpectedConditions.not(ExpectedConditions
+ .invisibilityOfElementLocated(by)));
+ }
+
/**
* For tests extending {@link AbstractTestUIWithLog}, returns the element
* for the Nth log row