aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2013-04-17 11:46:19 +0300
committerJohn Ahlroos <john@vaadin.com>2013-04-17 14:46:21 +0300
commit0f75f202d333ac507fb3e5efb8e9bd4d4719e098 (patch)
treebd19061fbde6c5cf665b0bd4fcefd1c78567800d /uitest/src/com
parent1c4adacdc2c59a4dd33633806902cb6224141954 (diff)
downloadvaadin-framework-0f75f202d333ac507fb3e5efb8e9bd4d4719e098.tar.gz
vaadin-framework-0f75f202d333ac507fb3e5efb8e9bd4d4719e098.zip
Added test for testing push with different transports #11494
Change-Id: I0296bdee1925ba93ca7e4e65c68215e025d072f6
Diffstat (limited to 'uitest/src/com')
-rw-r--r--uitest/src/com/vaadin/tests/push/BasicPush.java3
-rw-r--r--uitest/src/com/vaadin/tests/push/StreamingPush.html88
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml4
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java30
4 files changed, 125 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/push/BasicPush.java b/uitest/src/com/vaadin/tests/push/BasicPush.java
index 17d107bb8c..43f8236999 100644
--- a/uitest/src/com/vaadin/tests/push/BasicPush.java
+++ b/uitest/src/com/vaadin/tests/push/BasicPush.java
@@ -4,14 +4,17 @@ import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
+import com.vaadin.annotations.Widgetset;
import com.vaadin.data.util.ObjectProperty;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.widgetset.TestingWidgetSet;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+@Widgetset(TestingWidgetSet.NAME)
public class BasicPush extends AbstractTestUI {
private ObjectProperty<Integer> counter = new ObjectProperty<Integer>(0);
diff --git a/uitest/src/com/vaadin/tests/push/StreamingPush.html b/uitest/src/com/vaadin/tests/push/StreamingPush.html
new file mode 100644
index 0000000000..533f571b9c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/StreamingPush.html
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run-push/com.vaadin.tests.push.BasicPush?restartApplication&amp;debug&amp;transport=streaming</td>
+ <td></td>
+</tr>
+<!--Test client initiated push -->
+<tr>
+ <td>assertText</td>
+ <td>id=gwt-uid-5</td>
+ <td>0</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>id=gwt-uid-5</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>id=gwt-uid-5</td>
+ <td>4</td>
+</tr>
+<!--Test server initiated push-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>id=gwt-uid-7</td>
+ <td>0</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>3000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>id=gwt-uid-7</td>
+ <td>1</td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>3000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>id=gwt-uid-7</td>
+ <td>2</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
index 919a4a5d69..1b47a86113 100644
--- a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
+++ b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
@@ -7,5 +7,9 @@
<replace-with class="com.vaadin.tests.widgetset.client.CustomUIConnector">
<when-type-is class="com.vaadin.client.ui.ui.UIConnector" />
</replace-with>
+
+ <replace-with class="com.vaadin.tests.widgetset.client.TestingPushConnection">
+ <when-type-is class="com.vaadin.client.communication.PushConnection" />
+ </replace-with>
</module>
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java b/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java
new file mode 100644
index 0000000000..8453daabcd
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java
@@ -0,0 +1,30 @@
+package com.vaadin.tests.widgetset.client;
+
+import com.google.gwt.user.client.Window;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.communication.PushConnection;
+
+public class TestingPushConnection extends PushConnection {
+
+ private String transport;
+
+ @Override
+ public void init(ApplicationConnection connection) {
+ super.init(connection);
+ transport = Window.Location.getParameter("transport");
+ }
+
+ /*
+ * Force transport
+ */
+ @Override
+ protected AtmosphereConfiguration createConfig() {
+ AtmosphereConfiguration conf = super.createConfig();
+ if (transport != null) {
+ conf.setTransport(transport);
+ conf.setFallbackTransport(transport);
+ }
+ return conf;
+ }
+
+}