summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/push
diff options
context:
space:
mode:
authorJonatan Kronqvist <jonatan@vaadin.com>2014-02-07 14:46:31 +0200
committerJonatan Kronqvist <jonatan@vaadin.com>2014-02-07 14:46:31 +0200
commit4a027d600fb2c1f0cfa1e4d6660e6a5645912c70 (patch)
tree9ccf14b094ef0a3b25bf065a6f9d70ac6ca238cb /uitest/src/com/vaadin/tests/push
parent1ca6d0e39bbe2223404df0c275e80c7afa4fd136 (diff)
parentd45785d6763f269b4e00460ace07ab47c712b5ca (diff)
downloadvaadin-framework-4a027d600fb2c1f0cfa1e4d6660e6a5645912c70.tar.gz
vaadin-framework-4a027d600fb2c1f0cfa1e4d6660e6a5645912c70.zip
Merge changes from origin/7.1
74dcb6f Correct assertion message which changed due to #12915 12b6a8b Test for broken Webkit feature which causes extra scrollbars (#12736, #12727) ea46029 Allow excluding test from the standard test suite c171850 Disable client timeout so websockets are not disconnected when idle (#13015) 36fce65 Test for pushing for an extended period of time (24h) 54a5667 Fix compilation error 25fc48c Do not throw NPE if conversion messages is null (#12962) 26b5b67 Timeout redirect timer is reset on server activity (#12446) d45785d Fixes right click selection focus issues in Tree. (#12618) Change-Id: I3cef915ee46b77ca0f188296cfa343cde1ad59e6
Diffstat (limited to 'uitest/src/com/vaadin/tests/push')
-rw-r--r--uitest/src/com/vaadin/tests/push/BasicPushTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/push/ExtremelyLongPushTime.java50
-rw-r--r--uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreaming.java33
-rw-r--r--uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreamingTest.java21
-rw-r--r--uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java67
-rw-r--r--uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocket.java34
-rw-r--r--uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocketTest.java31
-rw-r--r--uitest/src/com/vaadin/tests/push/IdlePushChannelStreamingTest.java23
-rw-r--r--uitest/src/com/vaadin/tests/push/IdlePushChannelTest.java37
-rw-r--r--uitest/src/com/vaadin/tests/push/IdlePushChannelWebsocketTest.java35
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeData.java12
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java4
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java4
-rw-r--r--uitest/src/com/vaadin/tests/push/TogglePushTest.java4
14 files changed, 347 insertions, 10 deletions
diff --git a/uitest/src/com/vaadin/tests/push/BasicPushTest.java b/uitest/src/com/vaadin/tests/push/BasicPushTest.java
index ef40ae09dc..e03262ca7e 100644
--- a/uitest/src/com/vaadin/tests/push/BasicPushTest.java
+++ b/uitest/src/com/vaadin/tests/push/BasicPushTest.java
@@ -25,7 +25,7 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
public abstract class BasicPushTest extends MultiBrowserTest {
@Test
- public void testPush() {
+ public void testPush() throws InterruptedException {
openTestURL();
// Test client initiated push
diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTime.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTime.java
new file mode 100644
index 0000000000..d90394d3b5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTime.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.push;
+
+import com.vaadin.server.VaadinRequest;
+
+public abstract class ExtremelyLongPushTime extends PushLargeData {
+
+ private static final int DURATION_MS = 48 * 60 * 60 * 1000; // 48 H
+ private static int INTERVAL_MS = 60 * 1000; // 1 minute
+ private static int PAYLOAD_SIZE = 100 * 1024; // 100 KB
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+ super.setup(request);
+ duration.setConvertedValue(DURATION_MS);
+ interval.setConvertedValue(INTERVAL_MS);
+ dataSize.setConvertedValue(PAYLOAD_SIZE);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Test which pushes data every minute for 48 hours";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreaming.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreaming.java
new file mode 100644
index 0000000000..3e9582740d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreaming.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+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 ExtremelyLongPushTimeStreaming extends ExtremelyLongPushTime {
+
+ @Override
+ public void init(VaadinRequest request) {
+ super.init(request);
+ // Don't use fallback so we can easier detect failures
+ getPushConfiguration().setParameter(
+ PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreamingTest.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreamingTest.java
new file mode 100644
index 0000000000..17837cb2d3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeStreamingTest.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.push;
+
+public class ExtremelyLongPushTimeStreamingTest extends
+ ExtremelyLongPushTimeTest {
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java
new file mode 100644
index 0000000000..a1ce4b9d8f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.push;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+import com.vaadin.tests.tb3.ExcludeFromSuite;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+@ExcludeFromSuite
+public abstract class ExtremelyLongPushTimeTest extends MultiBrowserTest {
+
+ private static final int ONE_HOUR_IN_MS = 20 * 1000;
+
+ @Test
+ public void test24HourPush() throws Exception {
+ openTestURL();
+
+ // Without this there is a large chance that we will wait for all pushes
+ // to complete before moving on
+ testBench(driver).disableWaitForVaadin();
+
+ // Wait for startButton to be present
+ waitForElementToBePresent(vaadinLocatorById("startButton"));
+
+ String logRow0Id = "Log_row_0";
+ By logRow0 = vaadinLocatorById(logRow0Id);
+
+ // Start the test
+ vaadinElementById("startButton").click();
+
+ // Wait for push to start. Should take 60s
+ waitUntil(ExpectedConditions.textToBePresentInElement(logRow0,
+ "Package "), 120);
+
+ // Check every hour that push is still going on
+ for (int i = 0; i < 24; i++) {
+ sleep(ONE_HOUR_IN_MS);
+ ensureStillPushing(logRow0);
+ }
+
+ }
+
+ private void ensureStillPushing(By logRow0) {
+ String logValue = getDriver().findElement(logRow0).getText();
+ // Wait for the log value to change. Should take max 60s
+ waitUntilNot(
+ ExpectedConditions.textToBePresentInElement(logRow0, logValue),
+ 120);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocket.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocket.java
new file mode 100644
index 0000000000..8346d49234
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocket.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+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.WEBSOCKET)
+public class ExtremelyLongPushTimeWebsocket extends ExtremelyLongPushTime {
+
+ @Override
+ public void init(VaadinRequest request) {
+ super.init(request);
+ // Don't use fallback so we can easier detect if websocket fails
+ getPushConfiguration().setParameter(
+ PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocketTest.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocketTest.java
new file mode 100644
index 0000000000..23d773c7da
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeWebsocketTest.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.push;
+
+import java.util.List;
+
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.tests.tb3.WebsocketTest;
+
+public class ExtremelyLongPushTimeWebsocketTest extends
+ ExtremelyLongPushTimeTest {
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ return WebsocketTest.getWebsocketBrowsers();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/push/IdlePushChannelStreamingTest.java b/uitest/src/com/vaadin/tests/push/IdlePushChannelStreamingTest.java
new file mode 100644
index 0000000000..f9a0a722e5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/IdlePushChannelStreamingTest.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.push;
+
+public class IdlePushChannelStreamingTest extends IdlePushChannelTest {
+ @Override
+ protected Class<?> getUIClass() {
+ return BasicPushStreaming.class;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/push/IdlePushChannelTest.java b/uitest/src/com/vaadin/tests/push/IdlePushChannelTest.java
new file mode 100644
index 0000000000..4dcc8a680d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/IdlePushChannelTest.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.push;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public abstract class IdlePushChannelTest extends MultiBrowserTest {
+
+ private static final int SEVEN_MINUTES_IN_MS = 7 * 60 * 1000;
+
+ @Test
+ public void longWaitBetweenActions() throws Exception {
+ openTestURL();
+ BasicPushTest.getIncrementButton(this).click();
+ Assert.assertEquals(1, BasicPushTest.getClientCounter(this));
+ sleep(SEVEN_MINUTES_IN_MS);
+ BasicPushTest.getIncrementButton(this).click();
+ Assert.assertEquals(2, BasicPushTest.getClientCounter(this));
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/IdlePushChannelWebsocketTest.java b/uitest/src/com/vaadin/tests/push/IdlePushChannelWebsocketTest.java
new file mode 100644
index 0000000000..3fd9c616fb
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/IdlePushChannelWebsocketTest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.push;
+
+import java.util.List;
+
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.tests.tb3.WebsocketTest;
+
+public class IdlePushChannelWebsocketTest extends IdlePushChannelTest {
+
+ @Override
+ protected Class<?> getUIClass() {
+ return BasicPushWebsocket.class;
+ }
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ return WebsocketTest.getWebsocketBrowsers();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeData.java b/uitest/src/com/vaadin/tests/push/PushLargeData.java
index 3b72424b32..83f573ed2c 100644
--- a/uitest/src/com/vaadin/tests/push/PushLargeData.java
+++ b/uitest/src/com/vaadin/tests/push/PushLargeData.java
@@ -51,14 +51,20 @@ public abstract class PushLargeData extends AbstractTestUIWithLog {
private final ExecutorService executor = Executors
.newSingleThreadExecutor();
+ protected TextField dataSize;
+
+ protected TextField interval;
+
+ protected TextField duration;
+
@Override
protected void setup(VaadinRequest request) {
dataLabel.setSizeUndefined();
- final TextField dataSize = new TextField("Data size");
+ dataSize = new TextField("Data size");
dataSize.setConverter(Integer.class);
- final TextField interval = new TextField("Interval (ms)");
+ interval = new TextField("Interval (ms)");
interval.setConverter(Integer.class);
- final TextField duration = new TextField("Duration (ms)");
+ duration = new TextField("Duration (ms)");
duration.setConverter(Integer.class);
dataSize.setValue(DEFAULT_SIZE_BYTES + "");
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java
index 8f10f0fbba..0d71c21118 100644
--- a/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java
+++ b/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java
@@ -24,7 +24,7 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
public class PushLargeDataStreamingTest extends MultiBrowserTest {
@Test
- public void testStreamingLargeData() {
+ public void testStreamingLargeData() throws InterruptedException {
openTestURL();
// Without this there is a large chance that we will wait for all pushes
@@ -38,7 +38,7 @@ public class PushLargeDataStreamingTest extends MultiBrowserTest {
}
- private void push() {
+ private void push() throws InterruptedException {
// Wait for startButton to be present
waitForElementToBePresent(vaadinLocatorById("startButton"));
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java
index 70a94f743e..cc8668a729 100644
--- a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java
+++ b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java
@@ -24,7 +24,7 @@ import com.vaadin.tests.tb3.WebsocketTest;
public class PushLargeDataWebsocketTest extends WebsocketTest {
@Test
- public void testWebsocketLargeData() {
+ public void testWebsocketLargeData() throws Exception {
openTestURL();
// Without this timing will be completly off as pushing "start" can
@@ -38,7 +38,7 @@ public class PushLargeDataWebsocketTest extends WebsocketTest {
}
- private void push() {
+ private void push() throws Exception {
// Wait for startButton to be present
waitForElementToBePresent(vaadinLocatorById("startButton"));
diff --git a/uitest/src/com/vaadin/tests/push/TogglePushTest.java b/uitest/src/com/vaadin/tests/push/TogglePushTest.java
index 68d6f52b9f..1867f4a63a 100644
--- a/uitest/src/com/vaadin/tests/push/TogglePushTest.java
+++ b/uitest/src/com/vaadin/tests/push/TogglePushTest.java
@@ -24,7 +24,7 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
public class TogglePushTest extends MultiBrowserTest {
@Test
- public void togglePushInInit() {
+ public void togglePushInInit() throws Exception {
setPush(true);
String url = getTestUrl();
@@ -58,7 +58,7 @@ public class TogglePushTest extends MultiBrowserTest {
}
@Test
- public void togglePush() {
+ public void togglePush() throws InterruptedException {
setPush(true);
openTestURL();
getDelayedCounterUpdateButton().click();