summaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2014-02-12 15:49:31 +0200
committerLeif Åstrand <leif@vaadin.com>2014-02-12 15:49:49 +0200
commit42f2387165471d08bbd24d4c3ae4a271d2cda4c5 (patch)
tree4418a7610edf326d308f65ee0d79d4d09c341a93 /uitest/src
parent50381a619458017d69b044435a22fae457a5d4c1 (diff)
parent40e07d0172532ebf5750b8c2aab5ec892e42cdab (diff)
downloadvaadin-framework-42f2387165471d08bbd24d4c3ae4a271d2cda4c5.tar.gz
vaadin-framework-42f2387165471d08bbd24d4c3ae4a271d2cda4c5.zip
Merge remote-tracking branch 'origin/master' into grid
Change-Id: I8f1f412eeb450688bba58b715eba6db9e4ae43ae
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java2
-rw-r--r--uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java1
-rw-r--r--uitest/src/com/vaadin/tests/application/calculator/Calc.java268
-rw-r--r--uitest/src/com/vaadin/tests/applicationservlet/NoApplicationClass.html26
-rw-r--r--uitest/src/com/vaadin/tests/applicationservlet/NoApplicationClassTest.java49
-rw-r--r--uitest/src/com/vaadin/tests/browserfeatures/WebkitPositionAbsoluteScrollbarsTest.java39
-rw-r--r--uitest/src/com/vaadin/tests/componentlocator/TestDetachedNotPresent.html (renamed from uitest/src/com/vaadin/tests/gwtadapter/componentlocator/TestDetachedNotPresent.html)0
-rw-r--r--uitest/src/com/vaadin/tests/components/AbstractTestUI.java34
-rw-r--r--uitest/src/com/vaadin/tests/components/UnknownComponentConnector.java47
-rw-r--r--uitest/src/com/vaadin/tests/components/UnknownComponentConnectorTest.html27
-rw-r--r--uitest/src/com/vaadin/tests/components/UnknownComponentConnectorTest.java42
-rw-r--r--uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSource.java114
-rw-r--r--uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSourceTest.java83
-rw-r--r--uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHover.java46
-rw-r--r--uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java54
-rw-r--r--uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionTooltip.html33
-rw-r--r--uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChanges.java63
-rw-r--r--uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChangesTest.java100
-rw-r--r--uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.html47
-rw-r--r--uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.java75
-rw-r--r--uitest/src/com/vaadin/tests/components/table/ExpandingContainer.java429
-rw-r--r--uitest/src/com/vaadin/tests/components/table/ExpandingContainerVisibleRowRaceCondition.java67
-rw-r--r--uitest/src/com/vaadin/tests/components/table/ExpandingContainerVisibleRowRaceConditionTest.java90
-rw-r--r--uitest/src/com/vaadin/tests/components/table/SelectAllRows.java83
-rw-r--r--uitest/src/com/vaadin/tests/components/table/SelectAllRowsTest.java105
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCalls.java226
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCallsTest.java55
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java71
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java61
-rw-r--r--uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediate.java147
-rw-r--r--uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediateTest.java109
-rw-r--r--uitest/src/com/vaadin/tests/components/textfield/TextFieldTruncatesUnderscoresInModalDialogs.java65
-rw-r--r--uitest/src/com/vaadin/tests/components/textfield/TextFieldTruncatesUnderscoresInModalDialogsTest.java16
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnRightClick.java53
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnRightClickTest.java69
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetset.java (renamed from uitest/src/com/vaadin/tests/components/ui/TestUIWidgetset.java)6
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetsetTest.java41
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetset.java (renamed from uitest/src/com/vaadin/tests/components/ui/TestUIWidgetset2.java)6
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java42
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/TestUIWidgetset.html36
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivity.java74
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java85
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/UIAccess.java361
-rw-r--r--uitest/src/com/vaadin/tests/components/upload/UploadNoSelection.java83
-rw-r--r--uitest/src/com/vaadin/tests/components/upload/UploadNoSelectionTest.java56
-rw-r--r--uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpened.java58
-rw-r--r--uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java47
-rw-r--r--uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java3
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TooltipInWindow.html86
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java7
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java98
-rw-r--r--uitest/src/com/vaadin/tests/integration/JSPIntegrationTest.java100
-rw-r--r--uitest/src/com/vaadin/tests/push/BasicPushLongPolling.java34
-rw-r--r--uitest/src/com/vaadin/tests/push/BasicPushLongPollingTest.java19
-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/LongPollingReconnectTest.java25
-rw-r--r--uitest/src/com/vaadin/tests/push/PushFromInit.java53
-rw-r--r--uitest/src/com/vaadin/tests/push/PushFromInitTest.java28
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeData.java12
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeDataLongPolling.java32
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java61
-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
-rw-r--r--uitest/src/com/vaadin/tests/serialization/SerializerTest.html116
-rw-r--r--uitest/src/com/vaadin/tests/serialization/SerializerTest.java15
-rw-r--r--uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java81
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java60
-rw-r--r--uitest/src/com/vaadin/tests/tb3/ExcludeFromSuite.java28
-rw-r--r--uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java18
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/ClientRpcClassConnector.java36
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/ClientRpcClassWidget.java33
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java6
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/SerializerTestRpc.java2
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/ClientRpcClass.java47
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/ClientRpcClassComponent.java29
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/ClientRpcClassTest.java35
86 files changed, 4292 insertions, 808 deletions
diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
index a2f3c59f07..47d3a19fde 100644
--- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
+++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
@@ -280,7 +280,7 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet {
}
- throw new ClassNotFoundException();
+ throw new ClassNotFoundException(baseName);
}
private Logger getLogger() {
diff --git a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java
index a8d639cbc8..20e187c187 100644
--- a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java
+++ b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java
@@ -217,7 +217,6 @@ public class DevelopmentServerLauncher {
Socket accept = serverSocket.accept();
// First stop listening to the port
serverSocket.close();
- final Thread stopThread = Thread.currentThread();
// Start a thread that kills the JVM if
// server.stop() doesn't have any effect
diff --git a/uitest/src/com/vaadin/tests/application/calculator/Calc.java b/uitest/src/com/vaadin/tests/application/calculator/Calc.java
new file mode 100644
index 0000000000..7911556f4e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/application/calculator/Calc.java
@@ -0,0 +1,268 @@
+/*
+ * 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.application.calculator;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.ColumnHeaderMode;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+
+@SuppressWarnings("serial")
+public class Calc extends AbstractTestUI {
+
+ private class Log extends VerticalLayout {
+
+ private Table table;
+ private Button addCommentButton;
+ private int line = 0;
+
+ public Log() {
+ super();
+
+ table = new Table();
+ table.setSizeFull();
+
+ setWidth("200px");
+ setHeight("100%");
+
+ table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
+ table.addContainerProperty("Operation", String.class, "");
+
+ addComponent(table);
+
+ addCommentButton = new Button("Add Comment");
+ addCommentButton.setWidth("100%");
+
+ addCommentButton.addClickListener(new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+
+ final Window w = new Window("Add comment");
+ VerticalLayout vl = new VerticalLayout();
+ vl.setMargin(true);
+
+ final TextField tf = new TextField();
+ tf.setSizeFull();
+ vl.addComponent(tf);
+
+ HorizontalLayout hl = new HorizontalLayout();
+
+ Button okButton = new Button("OK");
+ okButton.setWidth("100%");
+ okButton.addClickListener(new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ addRow("[ " + tf.getValue() + " ]");
+ tf.setValue("");
+ w.close();
+ removeWindow(w);
+ }
+ });
+
+ Button cancelButton = new Button("Cancel");
+ cancelButton.setWidth("100%");
+ cancelButton.addClickListener(new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ tf.setValue("");
+ w.close();
+ removeWindow(w);
+ }
+ });
+
+ hl.addComponent(cancelButton);
+ hl.addComponent(okButton);
+ hl.setSpacing(true);
+ hl.setWidth("100%");
+
+ vl.addComponent(hl);
+ vl.setSpacing(true);
+
+ w.setContent(vl);
+ addWindow(w);
+ }
+ });
+
+ addComponent(addCommentButton);
+
+ setExpandRatio(table, 1);
+ setSpacing(true);
+ }
+
+ public void addRow(String row) {
+ Integer id = ++line;
+ table.addItem(new Object[] { row }, id);
+ table.setCurrentPageFirstItemIndex(line + 1);
+ }
+
+ }
+
+ // All variables are automatically stored in the session.
+ private Double current = 0.0;
+ private double stored = 0.0;
+ private char lastOperationRequested = 'C';
+ private VerticalLayout topLayout = new VerticalLayout();
+
+ // User interface components
+ private final TextField display = new TextField();
+
+ private final Log log = new Log();
+
+ // Calculator "business logic" implemented here to keep the example
+ // minimal
+ private double calculate(char requestedOperation) {
+ if ('0' <= requestedOperation && requestedOperation <= '9') {
+ if (current == null) {
+ current = 0.0;
+ }
+ current = current * 10
+ + Double.parseDouble("" + requestedOperation);
+ return current;
+ }
+
+ if (current == null) {
+ current = stored;
+ }
+ switch (lastOperationRequested) {
+ case '+':
+ stored += current;
+ break;
+ case '-':
+ stored -= current;
+ break;
+ case '/':
+ stored /= current;
+ break;
+ case '*':
+ stored *= current;
+ break;
+ default:
+ stored = current;
+ break;
+ }
+
+ switch (requestedOperation) {
+ case '+':
+ log.addRow(current + " +");
+ break;
+ case '-':
+ log.addRow(current + " -");
+ break;
+ case '/':
+ log.addRow(current + " /");
+ break;
+ case '*':
+ log.addRow(current + " x");
+ break;
+ case '=':
+ log.addRow(current + " =");
+ log.addRow("------------");
+ log.addRow("" + stored);
+ break;
+ }
+
+ lastOperationRequested = requestedOperation;
+ current = null;
+ if (requestedOperation == 'C') {
+ log.addRow("0.0");
+ stored = 0.0;
+ }
+ return stored;
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ setContent(topLayout);
+
+ // Create the main layout for our application (4 columns, 5 rows)
+ final GridLayout layout = new GridLayout(4, 5);
+
+ topLayout.setMargin(true);
+ topLayout.setSpacing(true);
+ Label title = new Label("Calculator");
+ topLayout.addComponent(title);
+ topLayout.addComponent(log);
+
+ HorizontalLayout horizontalLayout = new HorizontalLayout();
+ horizontalLayout.setSpacing(true);
+ horizontalLayout.addComponent(layout);
+ horizontalLayout.addComponent(log);
+ topLayout.addComponent(horizontalLayout);
+
+ // Create a result label that over all 4 columns in the first row
+ layout.setSpacing(true);
+ layout.addComponent(display, 0, 0, 3, 0);
+ layout.setComponentAlignment(display, Alignment.MIDDLE_RIGHT);
+ display.setSizeFull();
+ display.setId("display");
+ display.setValue("0.0");
+
+ // The operations for the calculator in the order they appear on the
+ // screen (left to right, top to bottom)
+ String[] operations = new String[] { "7", "8", "9", "/", "4", "5", "6",
+ "*", "1", "2", "3", "-", "0", "=", "C", "+" };
+
+ for (String caption : operations) {
+
+ // Create a button and use this application for event handling
+ Button button = new Button(caption);
+ button.setWidth("40px");
+ button.addClickListener(new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ // Get the button that was clicked
+ Button button = event.getButton();
+
+ // Get the requested operation from the button caption
+ char requestedOperation = button.getCaption().charAt(0);
+
+ // Calculate the new value
+ double newValue = calculate(requestedOperation);
+
+ // Update the result label with the new value
+ display.setValue("" + newValue);
+ }
+ });
+ button.setId("button_" + caption);
+
+ // Add the button to our main layout
+ layout.addComponent(button);
+ }
+
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Provide test application for generic testing purposes";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12444;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/applicationservlet/NoApplicationClass.html b/uitest/src/com/vaadin/tests/applicationservlet/NoApplicationClass.html
deleted file mode 100644
index 6ed410fdb6..0000000000
--- a/uitest/src/com/vaadin/tests/applicationservlet/NoApplicationClass.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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/ClassThatIsNotPresent?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>//pre[2]</td>
- <td>*java.lang.InstantiationException: Failed to load application class: ClassThatIsNotPresent*</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/applicationservlet/NoApplicationClassTest.java b/uitest/src/com/vaadin/tests/applicationservlet/NoApplicationClassTest.java
new file mode 100644
index 0000000000..9d1b052182
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/applicationservlet/NoApplicationClassTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.applicationservlet;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class NoApplicationClassTest extends MultiBrowserTest {
+
+ @Test
+ public void testInvalidApplicationClass() {
+ openTestURL();
+ String exceptionMessage = getDriver().findElement(By.xpath("//pre[2]"))
+ .getText();
+ Assert.assertTrue(exceptionMessage
+ .contains("ServletException: java.lang.ClassNotFoundException: ClassThatIsNotPresent"));
+ }
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ return Collections.singletonList(Browser.CHROME
+ .getDesiredCapabilities());
+ }
+
+ @Override
+ protected String getDeploymentPath() {
+ return "/run/ClassThatIsNotPresent";
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/browserfeatures/WebkitPositionAbsoluteScrollbarsTest.java b/uitest/src/com/vaadin/tests/browserfeatures/WebkitPositionAbsoluteScrollbarsTest.java
new file mode 100644
index 0000000000..54fb7212ca
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/browserfeatures/WebkitPositionAbsoluteScrollbarsTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.browserfeatures;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class WebkitPositionAbsoluteScrollbarsTest extends MultiBrowserTest {
+
+ @Override
+ protected String getDeploymentPath() {
+ return "/statictestfiles/browserfeatures/WebkitPositionAbsoluteScrollbars.html";
+ }
+
+ @Test
+ public void testWebkitScrollbarProblem() throws Exception {
+ openTestURL();
+ getDriver().findElement(By.id("step1")).click();
+ getDriver().findElement(By.id("step2")).click();
+ getDriver().findElement(By.id("step3")).click();
+ getDriver().findElement(By.id("step4")).click();
+ compareScreen("no-scrollbars");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/gwtadapter/componentlocator/TestDetachedNotPresent.html b/uitest/src/com/vaadin/tests/componentlocator/TestDetachedNotPresent.html
index 24e5e992ca..24e5e992ca 100644
--- a/uitest/src/com/vaadin/tests/gwtadapter/componentlocator/TestDetachedNotPresent.html
+++ b/uitest/src/com/vaadin/tests/componentlocator/TestDetachedNotPresent.html
diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java
index 8f92ff3118..5c7076c07e 100644
--- a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java
+++ b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java
@@ -113,27 +113,27 @@ public abstract class AbstractTestUI extends UI {
protected void setTransport(VaadinRequest request) {
String transport = request.getParameter("transport");
PushConfiguration config = getPushConfiguration();
- PushMode mode = config.getPushMode();
if ("xhr".equals(transport)) {
config.setPushMode(PushMode.DISABLED);
} else if ("websocket".equals(transport)) {
- if (!mode.isEnabled()) {
- config.setPushMode(PushMode.AUTOMATIC);
- }
- config.setTransport(Transport.WEBSOCKET);
- // Ensure no fallback is used
- getPushConfiguration().setParameter(
- PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
+ enablePush(Transport.WEBSOCKET);
} else if ("streaming".equals(transport)) {
- if (!mode.isEnabled()) {
- config.setPushMode(PushMode.AUTOMATIC);
- }
- config.setTransport(Transport.STREAMING);
- // Ensure no fallback is used
- getPushConfiguration().setParameter(
- PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
+ enablePush(Transport.STREAMING);
+ } else if ("long-polling".equals(transport)) {
+ enablePush(Transport.LONG_POLLING);
+ }
+ }
+
+ protected void enablePush(Transport transport) {
+ PushConfiguration config = getPushConfiguration();
+ if (!config.getPushMode().isEnabled()) {
+ config.setPushMode(PushMode.AUTOMATIC);
}
+ config.setTransport(transport);
+ // Ensure no fallback is used
+ getPushConfiguration().setParameter(
+ PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
}
private VerticalLayout layout;
@@ -148,6 +148,10 @@ public abstract class AbstractTestUI extends UI {
getLayout().addComponent(c);
}
+ public void addComponents(Component... c) {
+ getLayout().addComponents(c);
+ }
+
public void removeComponent(Component c) {
getLayout().removeComponent(c);
}
diff --git a/uitest/src/com/vaadin/tests/components/UnknownComponentConnector.java b/uitest/src/com/vaadin/tests/components/UnknownComponentConnector.java
new file mode 100644
index 0000000000..b6358b6c56
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/UnknownComponentConnector.java
@@ -0,0 +1,47 @@
+/*
+ * 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.components;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.AbstractComponent;
+
+public class UnknownComponentConnector extends AbstractTestUI {
+
+ public static class ComponentWithoutConnector extends AbstractComponent {
+
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ ComponentWithoutConnector component = new ComponentWithoutConnector();
+ component.setId("no-connector-component");
+ addComponent(component);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/UnknownComponentConnectorTest.html b/uitest/src/com/vaadin/tests/components/UnknownComponentConnectorTest.html
deleted file mode 100644
index 20f0e8e71e..0000000000
--- a/uitest/src/com/vaadin/tests/components/UnknownComponentConnectorTest.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<?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="" />
-<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/com.vaadin.tests.components.UnknownComponentConnectorTest?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentsUnknownComponentConnectorTest::/VVerticalLayout[0]/VVerticalLayout[0]/VUnknownComponent[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>Widgetset does not contain implementation for com.vaadin.tests.components.UnknownComponentConnectorTest.ComponentWithoutConnector. Check its component connector's @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/UnknownComponentConnectorTest.java b/uitest/src/com/vaadin/tests/components/UnknownComponentConnectorTest.java
index ff113d631e..49a3c29e2d 100644
--- a/uitest/src/com/vaadin/tests/components/UnknownComponentConnectorTest.java
+++ b/uitest/src/com/vaadin/tests/components/UnknownComponentConnectorTest.java
@@ -13,33 +13,29 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-
package com.vaadin.tests.components;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.ui.AbstractComponent;
-
-public class UnknownComponentConnectorTest extends AbstractTestUI {
+import static org.junit.Assert.assertTrue;
- public static class ComponentWithoutConnector extends AbstractComponent {
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
- }
-
- @Override
- protected void setup(VaadinRequest request) {
- addComponent(new ComponentWithoutConnector());
- }
+import com.vaadin.tests.tb3.MultiBrowserTest;
- @Override
- protected String getTestDescription() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected Integer getTicketNumber() {
- // TODO Auto-generated method stub
- return null;
+/**
+ * Tests that a user is notified about a missing component from the widgetset
+ */
+public class UnknownComponentConnectorTest extends MultiBrowserTest {
+
+ @Test
+ public void testConnectorNotFoundInWidgetset() throws Exception {
+ openTestURL();
+ WebElement component = vaadinElementById("no-connector-component");
+ assertTrue(component
+ .getText()
+ .startsWith(
+ "Widgetset 'com.vaadin.DefaultWidgetSet' does not contain "
+ + "implementation for com.vaadin.tests.components.UnknownComponentConnector."
+ + "ComponentWithoutConnector."));
}
-
}
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSource.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSource.java
new file mode 100644
index 0000000000..5e81750e58
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSource.java
@@ -0,0 +1,114 @@
+/*
+ * 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.components.calendar;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.vaadin.event.Action;
+import com.vaadin.event.Action.Handler;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Calendar;
+import com.vaadin.ui.Calendar.TimeFormat;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventResizeHandler;
+import com.vaadin.ui.components.calendar.event.BasicEvent;
+import com.vaadin.ui.components.calendar.event.CalendarEvent;
+import com.vaadin.ui.components.calendar.event.CalendarEventProvider;
+
+public class CalendarActionEventSource extends AbstractTestUI {
+
+ private Calendar calendar;
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ calendar = new Calendar(new CalendarEventProvider() {
+
+ @Override
+ public List<com.vaadin.ui.components.calendar.event.CalendarEvent> getEvents(
+ Date startDate, Date endDate) {
+
+ List<CalendarEvent> events = new ArrayList<CalendarEvent>();
+
+ CalendarEvent event = null;
+ try {
+ event = new BasicEvent("NAME", "TOOLTIP",
+ new SimpleDateFormat("yyyy-MM-dd hh:mm")
+ .parse("2013-01-01 07:00"),
+ new SimpleDateFormat("yyyy-MM-dd hh:mm")
+ .parse("2013-01-01 11:00"));
+ } catch (ParseException e) {
+ // Nothing to do
+ }
+ events.add(event);
+
+ return events;
+ }
+
+ });
+ try {
+ calendar.setStartDate(new SimpleDateFormat("yyyy-MM-dd")
+ .parse("2013-01-01"));
+ calendar.setEndDate(new SimpleDateFormat("yyyy-MM-dd")
+ .parse("2013-01-31"));
+ } catch (ParseException e) {
+ // Nothing to do
+ }
+ calendar.setImmediate(true);
+ calendar.setFirstVisibleHourOfDay(6);
+ calendar.setLastVisibleHourOfDay(22);
+ calendar.setTimeFormat(TimeFormat.Format24H);
+ calendar.setHandler((EventResizeHandler) null);
+
+ setEnabled(true);
+ calendar.addActionHandler(new Handler() {
+ @Override
+ public void handleAction(Action action, Object sender, Object target) {
+ Label label1 = new Label(calendar.toString());
+ label1.setId("calendarlabel");
+ addComponent(label1);
+
+ Label label2 = new Label(sender.toString());
+ label2.setId("senderlabel");
+ addComponent(label2);
+ }
+
+ @Override
+ public Action[] getActions(Object target, Object sender) {
+ return new Action[] { new Action("ACTION") };
+ }
+ });
+ addComponent(calendar);
+ calendar.setSizeFull();
+ setSizeFull();
+
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Calendar action event source should be the calendar itself";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 13191;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSourceTest.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSourceTest.java
new file mode 100644
index 0000000000..6fbe77040f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionEventSourceTest.java
@@ -0,0 +1,83 @@
+/*
+ * 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.components.calendar;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.tests.tb3.PrivateTB3Configuration;
+
+/**
+ * Test that calendar action event source is the calendar, not a private nested
+ * class in it.
+ *
+ * The related code is not browser dependent so only running on a single
+ * browser.
+ *
+ * @author Vaadin Ltd
+ */
+public class CalendarActionEventSourceTest extends PrivateTB3Configuration {
+ @Test
+ public void testActionEventSourceIsCalendarForEmptyCell() throws Exception {
+ openTestURL();
+
+ // perform action on empty cell
+ WebElement element = getDriver().findElement(
+ By.className("v-calendar-spacer"));
+ performAction(element);
+
+ checkEventSourceIsCalendar();
+ }
+
+ @Test
+ public void testActionEventSourceIsCalendarForEvent() throws Exception {
+ openTestURL();
+
+ // perform action on calendar event
+ WebElement element = getDriver().findElement(
+ By.className("v-calendar-event"));
+ performAction(element);
+
+ checkEventSourceIsCalendar();
+ }
+
+ private void performAction(WebElement element) {
+ // right click
+ new Actions(getDriver()).contextClick(element).perform();
+ WebElement menuItem = getDriver().findElement(
+ By.className("gwt-MenuItem"));
+ menuItem.click();
+ }
+
+ private void checkEventSourceIsCalendar() {
+ String calendarObject = getDriver().findElement(By.id("calendarlabel"))
+ .getText();
+ String actionSourceObject = getDriver().findElement(
+ By.id("senderlabel")).getText();
+ Assert.assertEquals(
+ "Calendar action event source must be the calendar itself",
+ calendarObject, actionSourceObject);
+ }
+
+ @Override
+ protected Class<?> getUIClass() {
+ return CalendarActionEventSource.class;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHover.java b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHover.java
new file mode 100644
index 0000000000..e9b022eac2
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHover.java
@@ -0,0 +1,46 @@
+/*
+ * 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.components.orderedlayout;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ * Test hovering over nested layout caption
+ *
+ * @author Vaadin Ltd
+ */
+public class NestedLayoutCaptionHover extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ VerticalLayout test = new VerticalLayout();
+ test.setCaption("inner layout");
+ addComponent(new VerticalLayout(new VerticalLayout(new VerticalLayout(
+ test))));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Hovering over nested layout caption should not freeze the browser";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12469;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java
new file mode 100644
index 0000000000..95a2c9f493
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionHoverTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.components.orderedlayout;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.HasInputDevices;
+import org.openqa.selenium.interactions.internal.Coordinates;
+import org.openqa.selenium.internal.Locatable;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests hovering over caption in nested layout
+ */
+public class NestedLayoutCaptionHoverTest extends MultiBrowserTest {
+
+ @Test
+ public void testTooltipInNestedLayout() throws Exception {
+ openTestURL();
+
+ WebElement caption = getDriver().findElement(
+ By.className("v-captiontext"));
+
+ assertEquals("inner layout", caption.getText());
+
+ // Hover over the caption
+ Coordinates coords = ((Locatable) caption).getCoordinates();
+ ((HasInputDevices) getDriver()).getMouse().mouseMove(coords);
+ sleep(1000);
+
+ // Verify that there's no error notification
+ WebElement error = vaadinElement("Root/VNotification[0]");
+ assertNull("No error should be found", error);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionTooltip.html b/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionTooltip.html
deleted file mode 100644
index 4f574a92c7..0000000000
--- a/uitest/src/com/vaadin/tests/components/orderedlayout/NestedLayoutCaptionTooltip.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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="" />
-<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/com.vaadin.tests.applicationcontext.CloseSession?restartApplication&amp;debug</td>
- <td></td>
-</tr>
-<!-- Show tooltip for the Events caption -->
-<tr>
- <td>showTooltip</td>
- <td>//div[@id='gwt-uid-4']/span</td>
- <td></td>
-</tr>
-<!-- Verify that there's no error notification -->
-<tr>
- <td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestsapplicationcontextCloseSession::Root/VNotification[0]</td>
- <td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChanges.java b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChanges.java
new file mode 100644
index 0000000000..1e7d817094
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChanges.java
@@ -0,0 +1,63 @@
+/*
+ * 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.components.orderedlayout;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class VerticalLayoutFocusWithDOMChanges extends AbstractTestUI implements
+ ValueChangeListener {
+
+ Button dummyButton = new Button("Just a button");
+ TextField listenedTextField = new TextField();
+ TextField changingTextField = new TextField();
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ VerticalLayout content = new VerticalLayout();
+ setSizeFull();
+ listenedTextField.addValueChangeListener(this);
+ listenedTextField.setImmediate(true);
+ changingTextField.setImmediate(true);
+ content.addComponent(dummyButton);
+ content.addComponent(listenedTextField);
+ content.addComponent(changingTextField);
+ content.setMargin(true);
+ content.setSpacing(true);
+ setContent(content);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Check that creating or removing caption wrap doesn't lose focus";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12967;
+ }
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ changingTextField.setRequired(!changingTextField.isRequired());
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChangesTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChangesTest.java
new file mode 100644
index 0000000000..14c26a0e17
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChangesTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.components.orderedlayout;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class VerticalLayoutFocusWithDOMChangesTest extends MultiBrowserTest {
+
+ private String initialText = "Some";
+ private String incrementalText = " text";
+
+ @Test
+ public void inputTextAndChangeFocus() throws InterruptedException {
+ openTestURL();
+ List<WebElement> textFields = getDriver().findElements(
+ By.tagName("input"));
+ WebElement tf1 = textFields.get(0);
+ WebElement tf2 = textFields.get(1);
+ tf1.sendKeys(initialText);
+ new Actions(getDriver()).moveToElement(tf2).click().build().perform();
+
+ WebElement activeElement = getFocusedElement();
+ Assert.assertEquals("input", activeElement.getTagName());
+ Assert.assertEquals("", activeElement.getAttribute("value"));
+
+ tf1.sendKeys(incrementalText);
+ new Actions(getDriver())
+ .moveToElement(
+ getDriver().findElement(By.className("v-button")))
+ .click().build().perform();
+ activeElement = getFocusedElement();
+ Assert.assertEquals("Just a button", activeElement.getText());
+
+ DesiredCapabilities capabilities = getDesiredCapabilities();
+ if (capabilities.equals(BrowserUtil.ie(8))
+ || capabilities.equals(BrowserUtil.ie(9))) {
+ // IE8 and IE9 insert cursor in the start of input instead of end.
+ Assert.assertEquals(incrementalText + initialText,
+ tf1.getAttribute("value"));
+ } else {
+ Assert.assertEquals(initialText + incrementalText,
+ tf1.getAttribute("value"));
+ }
+ }
+
+ @Test
+ public void moveFocusAndChangeFieldWithValue() {
+ openTestURL();
+ List<WebElement> textFields = getDriver().findElements(
+ By.tagName("input"));
+ WebElement tf1 = textFields.get(0);
+ WebElement tf2 = textFields.get(1);
+
+ String firstText = "This is";
+ String secondText = " default value";
+
+ tf2.sendKeys(firstText);
+ tf1.sendKeys(initialText);
+ new Actions(getDriver()).moveToElement(tf2).click().build().perform();
+
+ WebElement activeElement = getFocusedElement();
+ Assert.assertEquals("input", activeElement.getTagName());
+ Assert.assertEquals(firstText, activeElement.getAttribute("value"));
+
+ new Actions(getDriver()).sendKeys(secondText).build().perform();
+ DesiredCapabilities capabilities = getDesiredCapabilities();
+ if (capabilities.equals(BrowserUtil.ie(8))
+ || capabilities.equals(BrowserUtil.ie(9))) {
+ // IE8 and IE9 insert cursor in the start of input instead of end.
+ Assert.assertEquals(secondText + firstText,
+ tf2.getAttribute("value"));
+ } else {
+ Assert.assertEquals(firstText + secondText,
+ tf2.getAttribute("value"));
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.html b/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.html
new file mode 100644
index 0000000000..2f8532de61
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.html
@@ -0,0 +1,47 @@
+<?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="" />
+<title>SelectItemCaptionRefresh</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">SelectItemCaptionRefresh</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.select.SelectItemCaptionRefresh?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsselectSelectItemCaptionRefresh::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VFilterSelect[0]#button</td>
+ <td>10,14</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[2]/td/span</td>
+ <td>16,11</td>
+</tr>
+<tr>
+ <td>verifyValue</td>
+ <td>vaadin=runcomvaadintestscomponentsselectSelectItemCaptionRefresh::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VFilterSelect[0]#textbox</td>
+ <td>start</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsselectSelectItemCaptionRefresh::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyValue</td>
+ <td>vaadin=runcomvaadintestscomponentsselectSelectItemCaptionRefresh::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VFilterSelect[0]#textbox</td>
+ <td>0</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.java b/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.java
new file mode 100644
index 0000000000..de068ed230
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.java
@@ -0,0 +1,75 @@
+/*
+ * 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.components.select;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Select;
+
+public class SelectItemCaptionRefresh extends AbstractTestUI {
+
+ final Object itemId = new Object();
+ Select select;
+
+ Button.ClickListener clickListener = new Button.ClickListener() {
+ Integer i = Integer.valueOf(0);
+
+ @Override
+ public void buttonClick(final ClickEvent event) {
+ select.setItemCaption(itemId, (i++).toString());
+ }
+ };
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+ select = new Select("Foo");
+
+ select.addItem(itemId);
+ select.setItemCaption(itemId, "start");
+
+ addComponent(select);
+ addComponent(new Button("Update item's caption", clickListener));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "Selected option should be updated when item caption changes in the Select.";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 9250;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/ExpandingContainer.java b/uitest/src/com/vaadin/tests/components/table/ExpandingContainer.java
new file mode 100644
index 0000000000..829c29b95b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/ExpandingContainer.java
@@ -0,0 +1,429 @@
+package com.vaadin.tests.components.table;
+
+import java.util.AbstractList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Logger;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+import com.vaadin.data.util.AbstractContainer;
+import com.vaadin.data.util.BeanItem;
+import com.vaadin.server.VaadinSession;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Label;
+
+@SuppressWarnings("serial")
+public class ExpandingContainer extends AbstractContainer implements
+ Container.Ordered, Container.Indexed, Container.ItemSetChangeNotifier {
+
+ public static final List<String> PROPERTY_IDS = Arrays.asList("id",
+ "column1", "column2");
+
+ private final Label sizeLabel;
+ private final Logger log = Logger.getLogger(this.getClass().getName());
+
+ private int currentSize = 300;
+
+ private boolean loggingEnabled;
+
+ public ExpandingContainer(Label sizeLabel) {
+ this.sizeLabel = sizeLabel;
+ updateLabel();
+ }
+
+ private void log(String message) {
+ if (loggingEnabled) {
+ log.info(message);
+ }
+ }
+
+ // Expand container if we scroll past 85%
+ public int checkExpand(int index) {
+ log("checkExpand(" + index + ")");
+ if (index >= currentSize * 0.85) {
+ final int oldsize = currentSize;
+ currentSize = (int) (oldsize * 1.3333);
+ log("*** getSizeWithHint(" + index + "): went past 85% of size="
+ + oldsize + ", new size=" + currentSize);
+ updateLabel();
+ }
+ return currentSize;
+ };
+
+ @Override
+ public void fireItemSetChange() {
+ super.fireItemSetChange();
+ }
+
+ private void updateLabel() {
+ sizeLabel.setValue("Container size: " + currentSize);
+ }
+
+ public void triggerItemSetChange() {
+ log("*** triggerItemSetChange(): scheduling item set change event");
+ final VaadinSession session = VaadinSession.getCurrent();
+ new Thread() {
+ @Override
+ public void run() {
+ ExpandingContainer.this.invoke(session, new Runnable() {
+ @Override
+ public void run() {
+ log("*** Firing item set change event");
+ ExpandingContainer.this.fireItemSetChange();
+ }
+ });
+ }
+ }.start();
+ }
+
+ private void invoke(VaadinSession session, Runnable action) {
+ session.lock();
+ VaadinSession previousSession = VaadinSession.getCurrent();
+ VaadinSession.setCurrent(session);
+ try {
+ action.run();
+ } finally {
+ session.unlock();
+ VaadinSession.setCurrent(previousSession);
+ }
+ }
+
+ // Container
+
+ @Override
+ public BeanItem<MyBean> getItem(Object itemId) {
+ if (!(itemId instanceof Integer)) {
+ return null;
+ }
+ final int index = ((Integer) itemId).intValue();
+ return new BeanItem<MyBean>(new MyBean(index));
+ }
+
+ @Override
+ public Collection<Integer> getItemIds() {
+ return new IntList(size());
+ }
+
+ @Override
+ public List<String> getContainerPropertyIds() {
+ return PROPERTY_IDS;
+ }
+
+ @Override
+ @SuppressWarnings("rawtypes")
+ public Property/* <?> */getContainerProperty(Object itemId,
+ Object propertyId) {
+ BeanItem<MyBean> item = getItem(itemId);
+ return item != null ? item.getItemProperty(propertyId) : null;
+ }
+
+ @Override
+ public Class<?> getType(Object propertyId) {
+ return Component.class;
+ }
+
+ @Override
+ public int size() {
+ return currentSize;
+ }
+
+ @Override
+ public boolean containsId(Object itemId) {
+ if (!(itemId instanceof Integer)) {
+ return false;
+ }
+ int index = ((Integer) itemId).intValue();
+ checkExpand(index);
+ return index >= 0 && index < currentSize;
+ }
+
+ /**
+ * @throws UnsupportedOperationException
+ * always
+ */
+ @Override
+ public Item addItem(Object itemId) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @throws UnsupportedOperationException
+ * always
+ */
+ @Override
+ public Item addItem() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @throws UnsupportedOperationException
+ * always
+ */
+ @Override
+ public boolean removeItem(Object itemId) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @throws UnsupportedOperationException
+ * always
+ */
+ @Override
+ public boolean addContainerProperty(Object propertyId, Class<?> type,
+ Object defaultValue) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @throws UnsupportedOperationException
+ * always
+ */
+ @Override
+ public boolean removeContainerProperty(Object propertyId) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @throws UnsupportedOperationException
+ * always
+ */
+ @Override
+ public boolean removeAllItems() {
+ throw new UnsupportedOperationException();
+ }
+
+ // Container.Indexed
+
+ /**
+ * @throws UnsupportedOperationException
+ * always
+ */
+ @Override
+ public Object addItemAt(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @throws UnsupportedOperationException
+ * always
+ */
+ @Override
+ public Item addItemAt(int index, Object newItemId) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Integer getIdByIndex(int index) {
+ if (index < 0) {
+ throw new IndexOutOfBoundsException("index < " + index);
+ }
+ final int size = currentSize;
+ if (index >= size) {
+ throw new IndexOutOfBoundsException("index=" + index + " but size="
+ + size);
+ }
+ checkExpand(index);
+ return index;
+ }
+
+ @Override
+ public List<Integer> getItemIds(int startIndex, int numberOfItems) {
+ if (numberOfItems < 0) {
+ throw new IllegalArgumentException("numberOfItems < 0");
+ }
+ final int size = currentSize;
+ checkExpand(startIndex);
+ if (startIndex < 0 || startIndex > size) {
+ throw new IndexOutOfBoundsException("startIndex=" + startIndex
+ + " but size=" + size);
+ }
+ if (startIndex + numberOfItems > size) {
+ numberOfItems = size - startIndex;
+ }
+ return new IntList(startIndex, numberOfItems);
+ }
+
+ @Override
+ public int indexOfId(Object itemId) {
+ if (!(itemId instanceof Integer)) {
+ return -1;
+ }
+ final int index = ((Integer) itemId).intValue();
+ checkExpand(index);
+ if (index < 0 || index >= currentSize) {
+ return -1;
+ }
+ return index;
+ }
+
+ // Container.Ordered
+
+ @Override
+ public Integer nextItemId(Object itemId) {
+ if (!(itemId instanceof Integer)) {
+ return null;
+ }
+ int index = ((Integer) itemId).intValue();
+ checkExpand(index);
+ if (index < 0 || index + 1 >= currentSize) {
+ return null;
+ }
+ return index + 1;
+ }
+
+ @Override
+ public Integer prevItemId(Object itemId) {
+ if (!(itemId instanceof Integer)) {
+ return null;
+ }
+ int index = ((Integer) itemId).intValue();
+ checkExpand(index);
+ if (index - 1 < 0 || index >= currentSize) {
+ return null;
+ }
+ return index - 1;
+ }
+
+ @Override
+ public Integer firstItemId() {
+ return currentSize == 0 ? null : 0;
+ }
+
+ @Override
+ public Integer lastItemId() {
+ final int size = currentSize;
+ return size == 0 ? null : size - 1;
+ }
+
+ @Override
+ public boolean isFirstId(Object itemId) {
+ if (!(itemId instanceof Integer)) {
+ return false;
+ }
+ final int index = ((Integer) itemId).intValue();
+ checkExpand(index);
+ final int size = currentSize;
+ return size > 0 && index == 0;
+ }
+
+ @Override
+ public boolean isLastId(Object itemId) {
+ if (!(itemId instanceof Integer)) {
+ return false;
+ }
+ int index = ((Integer) itemId).intValue();
+ checkExpand(index);
+ int size = currentSize;
+ return size > 0 && index == size - 1;
+ }
+
+ /**
+ * @throws UnsupportedOperationException
+ * always
+ */
+ @Override
+ public Item addItemAfter(Object previousItemId) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @throws UnsupportedOperationException
+ * always
+ */
+ @Override
+ public Item addItemAfter(Object previousItemId, Object newItemId) {
+ throw new UnsupportedOperationException();
+ }
+
+ // Container.ItemSetChangeNotifier
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public void addListener(Container.ItemSetChangeListener listener) {
+ super.addListener(listener);
+ }
+
+ @Override
+ public void addItemSetChangeListener(
+ Container.ItemSetChangeListener listener) {
+ super.addItemSetChangeListener(listener);
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public void removeListener(Container.ItemSetChangeListener listener) {
+ super.removeListener(listener);
+ }
+
+ @Override
+ public void removeItemSetChangeListener(
+ Container.ItemSetChangeListener listener) {
+ super.removeItemSetChangeListener(listener);
+ }
+
+ // IntList
+
+ private static class IntList extends AbstractList<Integer> {
+
+ private final int min;
+ private final int size;
+
+ public IntList(int size) {
+ this(0, size);
+ }
+
+ public IntList(int min, int size) {
+ if (size < 0) {
+ throw new IllegalArgumentException("size < 0");
+ }
+ this.min = min;
+ this.size = size;
+ }
+
+ @Override
+ public int size() {
+ return size;
+ }
+
+ @Override
+ public Integer get(int index) {
+ if (index < 0 || index >= size) {
+ throw new IndexOutOfBoundsException();
+ }
+ return min + index;
+ }
+ }
+
+ // MyBean
+ public class MyBean {
+
+ private final int index;
+
+ public MyBean(int index) {
+ this.index = index;
+ }
+
+ public String getId() {
+ return "ROW #" + index;
+ }
+
+ public String getColumn1() {
+ return genText();
+ }
+
+ public String getColumn2() {
+ return genText();
+ }
+
+ private String genText() {
+ return "this is a line of text in row #" + index;
+ }
+ }
+
+ public void logDetails(boolean enabled) {
+ loggingEnabled = enabled;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/ExpandingContainerVisibleRowRaceCondition.java b/uitest/src/com/vaadin/tests/components/table/ExpandingContainerVisibleRowRaceCondition.java
new file mode 100644
index 0000000000..8ad2d7f9c7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/ExpandingContainerVisibleRowRaceCondition.java
@@ -0,0 +1,67 @@
+package com.vaadin.tests.components.table;
+
+import java.util.Map;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+@SuppressWarnings("serial")
+public class ExpandingContainerVisibleRowRaceCondition extends UI {
+
+ static final String TABLE = "table";
+
+ @Override
+ public void init(VaadinRequest request) {
+ final VerticalLayout rootLayout = new VerticalLayout();
+
+ rootLayout.setSpacing(true);
+ rootLayout.setSizeFull();
+ rootLayout.setMargin(true);
+
+ final Label sizeLabel = new Label();
+ final ExpandingContainer container = new ExpandingContainer(sizeLabel);
+ container.logDetails(false);
+
+ Table table = new Table(null, container) {
+ @Override
+ public void changeVariables(Object source,
+ Map<String, Object> variables) {
+ if (variables.containsKey("firstvisible")) {
+ int index = (Integer) variables.get("firstvisible");
+ container.checkExpand(index);
+ }
+ if (variables.containsKey("reqfirstrow")
+ || variables.containsKey("reqrows")) {
+ try {
+ int index = ((Integer) variables
+ .get("lastToBeRendered")).intValue();
+ container.checkExpand(index);
+ } catch (Exception e) {
+ // do nothing
+ }
+ }
+ super.changeVariables(source, variables);
+ }
+ };
+ table.setId(TABLE);
+ table.setCacheRate(0);
+ table.setSizeFull();
+ table.setVisibleColumns(ExpandingContainer.PROPERTY_IDS
+ .toArray(new String[ExpandingContainer.PROPERTY_IDS.size()]));
+
+ table.setCurrentPageFirstItemIndex(120);
+
+ rootLayout.addComponent(table);
+ rootLayout.setExpandRatio(table, 1);
+
+ rootLayout.addComponent(sizeLabel);
+
+ setContent(rootLayout);
+
+ container.checkExpand(300);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/ExpandingContainerVisibleRowRaceConditionTest.java b/uitest/src/com/vaadin/tests/components/table/ExpandingContainerVisibleRowRaceConditionTest.java
new file mode 100644
index 0000000000..73dd7b1f81
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/ExpandingContainerVisibleRowRaceConditionTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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.components.table;
+
+import static com.vaadin.tests.components.table.ExpandingContainerVisibleRowRaceCondition.TABLE;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class ExpandingContainerVisibleRowRaceConditionTest extends
+ MultiBrowserTest {
+
+ private static final int ROW_HEIGHT = 20;
+
+ @Test
+ public void testScrollingWorksWithoutJumpingWhenItemSetChangeOccurs() {
+ openTestURL();
+ sleep(1000);
+
+ WebElement table = vaadinElementById(TABLE);
+ assertFirstRowIdIs("ROW #120");
+
+ testBenchElement(table.findElement(By.className("v-scrollable")))
+ .scroll(320 * ROW_HEIGHT);
+ sleep(1000);
+
+ assertRowIdIsInThePage("ROW #330");
+ assertScrollPositionIsNotVisible();
+ }
+
+ @Override
+ protected void sleep(int milliseconds) {
+ try {
+ super.sleep(milliseconds);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void assertFirstRowIdIs(String expected) {
+ List<WebElement> cellsOfFirstColumn = getCellsOfFirstColumn();
+ WebElement first = cellsOfFirstColumn.get(0);
+ assertEquals(expected, first.getText());
+ }
+
+ private void assertRowIdIsInThePage(String expected) {
+ List<WebElement> cellsOfFirstColumn = getCellsOfFirstColumn();
+ for (WebElement rowId : cellsOfFirstColumn) {
+ if (expected.equals(rowId.getText())) {
+ return;
+ }
+ }
+ fail("Expected row was not found");
+ }
+
+ private void assertScrollPositionIsNotVisible() {
+ WebElement table = vaadinElementById(TABLE);
+ WebElement scrollPosition = table.findElement(By
+ .className("v-table-scrollposition"));
+ assertFalse(scrollPosition.isDisplayed());
+ }
+
+ private List<WebElement> getCellsOfFirstColumn() {
+ WebElement table = vaadinElementById(TABLE);
+ List<WebElement> firstCellOfRows = table.findElements(By
+ .cssSelector(".v-table-table tr > td"));
+ return firstCellOfRows;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/SelectAllRows.java b/uitest/src/com/vaadin/tests/components/table/SelectAllRows.java
new file mode 100644
index 0000000000..6007ea2984
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/SelectAllRows.java
@@ -0,0 +1,83 @@
+/*
+ * 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.components.table;
+
+import java.util.Set;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+
+public class SelectAllRows extends AbstractTestUI {
+
+ static final String TABLE = "table";
+ static final String COUNT_SELECTED_BUTTON = "button";
+ static final int TOTAL_NUMBER_OF_ROWS = 300;
+ static final String COUNT_OF_SELECTED_ROWS_LABEL = "label";
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ layout.setSpacing(true);
+ setContent(layout);
+
+ final Table table = new Table();
+ table.setId(TABLE);
+ table.setImmediate(true);
+ table.setMultiSelect(true);
+ table.setSelectable(true);
+ table.addContainerProperty("row", String.class, null);
+ layout.addComponent(table);
+
+ Button button = new Button("Count");
+ button.setId(COUNT_SELECTED_BUTTON);
+ layout.addComponent(button);
+
+ final Label label = new Label();
+ label.setId(COUNT_OF_SELECTED_ROWS_LABEL);
+ label.setCaption("Selected count:");
+ layout.addComponent(label);
+
+ button.addClickListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ Set selected = (Set) table.getValue();
+ label.setValue(String.valueOf(selected.size()));
+ }
+ });
+
+ for (int i = 0; i < TOTAL_NUMBER_OF_ROWS; i++) {
+ Object itemId = table.addItem();
+ table.getContainerProperty(itemId, "row").setValue("row " + i);
+ }
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Selecting all rows does not work by selecting first row, press shift then select last row";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 13008;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/SelectAllRowsTest.java b/uitest/src/com/vaadin/tests/components/table/SelectAllRowsTest.java
new file mode 100644
index 0000000000..664b36fa75
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/SelectAllRowsTest.java
@@ -0,0 +1,105 @@
+/*
+ * 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.components.table;
+
+import static com.vaadin.tests.components.table.SelectAllRows.COUNT_OF_SELECTED_ROWS_LABEL;
+import static com.vaadin.tests.components.table.SelectAllRows.COUNT_SELECTED_BUTTON;
+import static com.vaadin.tests.components.table.SelectAllRows.TABLE;
+import static com.vaadin.tests.components.table.SelectAllRows.TOTAL_NUMBER_OF_ROWS;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class SelectAllRowsTest extends MultiBrowserTest {
+
+ private final static String TABLE_ROW = "v-table-row";
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ // Pressing Shift modifier key does not work with TestBench and IE
+ // (#8621)
+ return Arrays.asList(Browser.FIREFOX.getDesiredCapabilities(),
+ Browser.CHROME.getDesiredCapabilities());
+ }
+
+ @Test
+ public void testAllRowsAreSelected() {
+ openTestURL();
+
+ selectAllRowsInTable();
+ int selectedRows = countSelectedItems();
+
+ assertEquals(TOTAL_NUMBER_OF_ROWS, selectedRows);
+ }
+
+ private int countSelectedItems() {
+ WebElement countButton = vaadinElementById(COUNT_SELECTED_BUTTON);
+ countButton.click();
+ WebElement countOfSelectedRows = vaadinElementById(COUNT_OF_SELECTED_ROWS_LABEL);
+ String count = countOfSelectedRows.getText();
+ return Integer.parseInt(count);
+ }
+
+ private void selectAllRowsInTable() {
+ clickFirstRow();
+ scrollTableToBottom();
+ new Actions(getDriver()).keyDown(Keys.SHIFT).perform();
+ clickLastRow();
+ new Actions(getDriver()).keyUp(Keys.SHIFT).perform();
+ }
+
+ private void clickLastRow() {
+ List<WebElement> rows = allVisibleTableRows();
+ WebElement lastRow = rows.get(rows.size() - 1);
+ lastRow.click();
+ }
+
+ private void clickFirstRow() {
+ WebElement firstRow = allVisibleTableRows().get(0);
+ firstRow.click();
+ }
+
+ private void scrollTableToBottom() {
+ WebElement table = vaadinElementById(TABLE);
+ testBenchElement(table.findElement(By.className("v-scrollable")))
+ .scroll(TOTAL_NUMBER_OF_ROWS * 30);
+
+ // Wait for scrolling to complete. Otherwise, clicking last row will
+ // fail with Chrome
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private List<WebElement> allVisibleTableRows() {
+ WebElement table = vaadinElementById(TABLE);
+ List<WebElement> rows = table.findElements(By
+ .cssSelector(".v-table-table tr"));
+ return rows;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCalls.java b/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCalls.java
index 6e4b62e4f7..ab0198f39c 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCalls.java
+++ b/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCalls.java
@@ -16,26 +16,217 @@
package com.vaadin.tests.components.table;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.json.JSONObject;
+
import com.vaadin.annotations.Push;
-import com.vaadin.event.ItemClickEvent;
-import com.vaadin.event.ItemClickEvent.ItemClickListener;
+import com.vaadin.server.ClientConnector;
+import com.vaadin.server.StreamVariable;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.ConnectorTracker;
import com.vaadin.ui.Table;
@Push
public class TableRemovedQuicklySendsInvalidRpcCalls extends AbstractTestUI {
+ public static final String SUCCESS_CAPTION = "Success!";
+ public static final String BUTTON_ID = "blinkbutton";
+ public static final String FAILURE_CAPTION = "Test failed";
+
+ private class WrappedConnectorTracker extends ConnectorTracker {
+ private ConnectorTracker tracker;
+
+ private boolean initialDirtyHasBeenCalled = false;
+
+ public WrappedConnectorTracker(ConnectorTracker tracker) {
+ super(TableRemovedQuicklySendsInvalidRpcCalls.this);
+ this.tracker = tracker;
+ }
+
+ @Override
+ public void markAllConnectorsDirty() {
+ tracker.markAllConnectorsDirty();
+ if (initialDirtyHasBeenCalled) {
+ button.setCaption(FAILURE_CAPTION);
+ }
+ initialDirtyHasBeenCalled = true;
+ }
+
+ // DELEGATED METHODS BELOW:
+
+ @Override
+ public void registerConnector(ClientConnector connector) {
+ tracker.registerConnector(connector);
+ }
+
+ @Override
+ public void unregisterConnector(ClientConnector connector) {
+ tracker.unregisterConnector(connector);
+ }
+
+ @Override
+ public boolean isClientSideInitialized(ClientConnector connector) {
+ return tracker.isClientSideInitialized(connector);
+ }
+
+ @Override
+ public void markClientSideInitialized(ClientConnector connector) {
+ tracker.markClientSideInitialized(connector);
+ }
+
+ @Override
+ public void markAllClientSidesUninitialized() {
+ tracker.markAllClientSidesUninitialized();
+ }
+
+ @Override
+ public ClientConnector getConnector(String connectorId) {
+ return tracker.getConnector(connectorId);
+ }
+
+ @Override
+ public void cleanConnectorMap() {
+ tracker.cleanConnectorMap();
+ }
+
+ @Override
+ public void markDirty(ClientConnector connector) {
+ tracker.markDirty(connector);
+ }
+
+ @Override
+ public void markClean(ClientConnector connector) {
+ tracker.markClean(connector);
+ }
+
+ @Override
+ public void markAllConnectorsClean() {
+ tracker.markAllConnectorsClean();
+ }
+
+ @Override
+ public Collection<ClientConnector> getDirtyConnectors() {
+ return tracker.getDirtyConnectors();
+ }
+
+ @Override
+ public boolean hasDirtyConnectors() {
+ return tracker.hasDirtyConnectors();
+ }
+
+ @Override
+ public ArrayList<ClientConnector> getDirtyVisibleConnectors() {
+ return tracker.getDirtyVisibleConnectors();
+ }
+
+ @Override
+ public JSONObject getDiffState(ClientConnector connector) {
+ return tracker.getDiffState(connector);
+ }
+
+ @Override
+ public void setDiffState(ClientConnector connector, JSONObject diffState) {
+ tracker.setDiffState(connector, diffState);
+ }
+
+ @Override
+ public boolean isDirty(ClientConnector connector) {
+ return tracker.isDirty(connector);
+ }
+
+ @Override
+ public boolean isWritingResponse() {
+ return tracker.isWritingResponse();
+ }
+
+ @Override
+ public void setWritingResponse(boolean writingResponse) {
+ tracker.setWritingResponse(writingResponse);
+ }
+
+ @Override
+ public StreamVariable getStreamVariable(String connectorId,
+ String variableName) {
+ return tracker.getStreamVariable(connectorId, variableName);
+ }
+
+ @Override
+ public void addStreamVariable(String connectorId, String variableName,
+ StreamVariable variable) {
+ tracker.addStreamVariable(connectorId, variableName, variable);
+ }
+
+ @Override
+ public void cleanStreamVariable(String connectorId, String variableName) {
+ tracker.cleanStreamVariable(connectorId, variableName);
+ }
+
+ @Override
+ public String getSeckey(StreamVariable variable) {
+ return tracker.getSeckey(variable);
+ }
+
+ @Override
+ public boolean connectorWasPresentAsRequestWasSent(String connectorId,
+ long lastSyncIdSeenByClient) {
+ return tracker.connectorWasPresentAsRequestWasSent(connectorId,
+ lastSyncIdSeenByClient);
+ }
+
+ @Override
+ public int getCurrentSyncId() {
+ return tracker.getCurrentSyncId();
+ }
+
+ @Override
+ public void cleanConcurrentlyRemovedConnectorIds(
+ int lastSyncIdSeenByClient) {
+ tracker.cleanConcurrentlyRemovedConnectorIds(lastSyncIdSeenByClient);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return tracker.equals(obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return tracker.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return tracker.toString();
+ }
+ }
+
+ private Button button;
+ private WrappedConnectorTracker wrappedTracker = null;
+
@Override
protected void setup(VaadinRequest request) {
- addComponent(new Button("Blink a table", new Button.ClickListener() {
+ button = new Button("Blink a table", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
blinkTable();
}
- }));
+ });
+ button.setId(BUTTON_ID);
+ addComponent(button);
+ }
+
+ @Override
+ public ConnectorTracker getConnectorTracker() {
+ if (wrappedTracker == null) {
+ wrappedTracker = new WrappedConnectorTracker(
+ super.getConnectorTracker());
+ }
+ return wrappedTracker;
}
private void blinkTable() {
@@ -47,25 +238,6 @@ public class TableRemovedQuicklySendsInvalidRpcCalls extends AbstractTestUI {
table.addItem(new Object[] { "Row" }, new Object());
}
- table.addItemClickListener(new ItemClickListener() {
- private int i;
-
- @Override
- public void itemClick(ItemClickEvent event) {
- /*
- * Ignore implementation. This is only an easy way to make the
- * client-side update table's variables (by furiously clicking
- * on the table row.
- *
- * This way, we get variable changes queued. The push call will
- * then remove the Table, while the variable changes being still
- * in the queue, leading to the issue as described in the
- * ticket.
- */
- System.out.println("clicky " + (++i));
- }
- });
-
System.out.println("adding component");
addComponent(table);
@@ -80,6 +252,7 @@ public class TableRemovedQuicklySendsInvalidRpcCalls extends AbstractTestUI {
public void run() {
System.out.println("removing component");
removeComponent(table);
+ button.setCaption(SUCCESS_CAPTION);
}
});
} catch (InterruptedException e) {
@@ -87,7 +260,7 @@ public class TableRemovedQuicklySendsInvalidRpcCalls extends AbstractTestUI {
} finally {
getSession().unlock();
}
- };
+ }
}.start();
}
@@ -96,8 +269,9 @@ public class TableRemovedQuicklySendsInvalidRpcCalls extends AbstractTestUI {
return "Adding and subsequently quickly removing a table "
+ "should not leave any pending RPC calls waiting "
+ "in a Timer. Issue can be reproduced by "
- + "1) pressing the button 2) clicking furiously "
- + "on a row in the table.";
+ + "1) pressing the button 2) checking the server "
+ + "log for any error messages starting with "
+ + "\"RPC call to...\" .";
}
@Override
diff --git a/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCallsTest.java b/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCallsTest.java
new file mode 100644
index 0000000000..68c8dc9884
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableRemovedQuicklySendsInvalidRpcCallsTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.components.table;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TableRemovedQuicklySendsInvalidRpcCallsTest extends
+ MultiBrowserTest {
+
+ private static final String BUTTON_ID = TableRemovedQuicklySendsInvalidRpcCalls.BUTTON_ID;
+ private static final String FAILURE_CAPTION = TableRemovedQuicklySendsInvalidRpcCalls.FAILURE_CAPTION;
+ private static final String SUCCESS_CAPTION = TableRemovedQuicklySendsInvalidRpcCalls.SUCCESS_CAPTION;
+
+ @Test
+ public void test() throws Exception {
+ setDebug(true);
+ openTestURL();
+
+ assertFalse("Test started with the error present.", button().getText()
+ .equals(FAILURE_CAPTION));
+ assertFalse("Test jumped the gun.",
+ button().getText().equals(SUCCESS_CAPTION));
+
+ button().click();
+ Thread.sleep(5000);
+
+ assertFalse("Test failed after trying to trigger the error.", button()
+ .getText().equals(FAILURE_CAPTION));
+ assertTrue("Test didn't end up in correct success state.", button()
+ .getText().equals(SUCCESS_CAPTION));
+ }
+
+ private WebElement button() {
+ return vaadinElementById(BUTTON_ID);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java
new file mode 100644
index 0000000000..81648c1b52
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.components.tabsheet;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TabSheetFocusedTabTest extends MultiBrowserTest {
+
+ @Override
+ protected Class<?> getUIClass() {
+ return TabsheetScrolling.class;
+ }
+
+ @Test
+ public void clickingChangesFocusedTab() throws Exception {
+ openTestURL();
+
+ getTab(1).click();
+
+ assertTrue(isFocused(getTab(1)));
+
+ new Actions(getDriver()).sendKeys(Keys.RIGHT).perform();
+
+ assertFalse(isFocused(getTab(1)));
+ assertTrue(isFocused(getTab(3)));
+
+ getTab(5).click();
+
+ assertFalse(isFocused(getTab(3)));
+ assertTrue(isFocused(getTab(5)));
+
+ getTab(1).click();
+
+ assertFalse(isFocused(getTab(5)));
+ assertTrue(isFocused(getTab(1)));
+ }
+
+ private WebElement getTab(int index) {
+ return getDriver()
+ .findElement(
+ By.xpath("(//table[contains(@class, 'v-tabsheet-tabs')])[1]/tbody/tr/td["
+ + (index + 1) + "]/div"));
+ }
+
+ private boolean isFocused(WebElement tab) {
+ return tab.getAttribute("class").contains("v-tabsheet-tabitem-focus");
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java
new file mode 100644
index 0000000000..b55f1057b5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.components.tabsheet;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TabsheetScrollingTest extends MultiBrowserTest {
+
+ @Test
+ public void keyboardScrolling() {
+ openTestURL();
+ getTab(1).click();
+ for (int i = 0; i < 10; i++) {
+ sendKey(Keys.ARROW_RIGHT);
+ }
+ sendKey(Keys.SPACE);
+ Assert.assertEquals("Hide this tab (21)", getHideButtonText());
+ }
+
+ private WebElement getTab(int index) {
+ return getDriver().findElement(
+ By.vaadin("/VVerticalLayout[0]/Slot[1]"
+ + "/VVerticalLayout[0]/Slot[0]/VTabsheet[0]"
+ + "/domChild[0]/domChild[0]/domChild[0]"
+ + "/domChild[0]/domChild[" + index + "]"));
+
+ }
+
+ private String getHideButtonText() {
+ WebElement buttonCaption = getDriver().findElement(
+ By.vaadin("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]"
+ + "/Slot[0]/VTabsheet[0]/VTabsheetPanel[0]"
+ + "/VButton[0]/domChild[0]/domChild[0]"));
+ return buttonCaption.getText();
+ }
+
+ private void sendKey(Keys key) {
+ new Actions(getDriver()).sendKeys(key).perform();
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediate.java b/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediate.java
new file mode 100644
index 0000000000..26716846fc
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediate.java
@@ -0,0 +1,147 @@
+/*
+ * 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.components.textfield;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.TextField;
+
+/**
+ * Test to verify fields become implicitly "immediate" when adding value change
+ * listener to them.
+ *
+ * @since 7.2
+ * @author Vaadin Ltd
+ */
+public class AutomaticImmediate extends AbstractTestUIWithLog {
+
+ /**
+ *
+ */
+ static final String BUTTON = "button";
+ /**
+ *
+ */
+ static final String EXPLICIT_FALSE = "explicit-false";
+ /**
+ *
+ */
+ static final String FIELD = "field";
+ /**
+ *
+ */
+ static final String LISTENER_TOGGLE = "listener-toggle";
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+
+ final TextField textField = new TextField() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractField#fireValueChange(boolean)
+ */
+ @Override
+ protected void fireValueChange(boolean repaintIsNotNeeded) {
+ log("fireValueChange");
+ super.fireValueChange(repaintIsNotNeeded);
+ }
+ };
+ textField.setId(FIELD);
+
+ final ValueChangeListener listener = new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ log("Value changed: " + event.getProperty().getValue());
+ }
+ };
+
+ final CheckBox checkBox = new CheckBox("Toggle listener");
+ checkBox.addValueChangeListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ if (checkBox.getValue()) {
+ textField.addValueChangeListener(listener);
+ } else {
+ textField.removeValueChangeListener(listener);
+ }
+ }
+ });
+ checkBox.setId(LISTENER_TOGGLE);
+
+ Button b = new Button(
+ "setImmediate(false), sets explicitly false and causes server roundtrip",
+ new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ textField.setImmediate(false);
+ }
+ });
+ b.setId(EXPLICIT_FALSE);
+
+ Button b2 = new Button("Hit server, causes server roundtrip",
+ new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ }
+ });
+ b2.setId(BUTTON);
+
+ addComponent(textField);
+ addComponent(checkBox);
+ addComponent(b);
+ addComponent(b2);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "Field should be immediate automatically if it has value change listener";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 8029;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediateTest.java b/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediateTest.java
new file mode 100644
index 0000000000..4b522a1f37
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/textfield/AutomaticImmediateTest.java
@@ -0,0 +1,109 @@
+/*
+ * 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.components.textfield;
+
+import org.apache.commons.lang.RandomStringUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class AutomaticImmediateTest extends MultiBrowserTest {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.tb3.AbstractTB3Test#getUIClass()
+ */
+ @Override
+ protected Class<?> getUIClass() {
+ return AutomaticImmediate.class;
+ }
+
+ @Test
+ public void test() {
+ openTestURL();
+
+ WebElement field = getDriver().findElement(
+ By.id(AutomaticImmediate.FIELD));
+
+ WebElement toggle = getDriver().findElement(
+ By.xpath("//input[@type = 'checkbox']"));
+
+ WebElement explicitFalseButton = getDriver().findElement(
+ By.id(AutomaticImmediate.EXPLICIT_FALSE));
+
+ WebElement hitServerButton = getDriver().findElement(
+ By.id(AutomaticImmediate.BUTTON));
+
+ String string = getRandomString();
+ field.sendKeys(string + Keys.ENTER);
+
+ // Non immediate, just the initial server side valuechange
+ assertLastLog("1. fireValueChange");
+
+ hitServerButton.click();
+
+ // No value change, but value sent to server
+ assertLastLog("2. fireValueChange");
+
+ // listener on -> immediate on
+ toggle.click();
+
+ string = getRandomString();
+ String delSequence = "" + Keys.BACK_SPACE + Keys.BACK_SPACE;
+ field.sendKeys(delSequence + string + Keys.ENTER);
+ assertLastLog("4. Value changed: " + string);
+
+ // listener off -> immediate off
+ String lastvalue = string;
+ toggle.click();
+ string = getRandomString();
+ field.sendKeys(delSequence + string + Keys.ENTER);
+ // No new value change should happen...
+ assertLastLog("4. Value changed: " + lastvalue);
+ hitServerButton.click();
+ // ... but server should receive value with roundtrip
+ assertLastLog("5. fireValueChange");
+
+ // explicitly non immediate, but with listener
+ explicitFalseButton.click();
+ toggle.click();
+
+ string = getRandomString();
+ field.sendKeys(delSequence + string + Keys.ENTER);
+ // non immediate, no change...
+ assertLastLog("5. fireValueChange");
+ // ... until server round trip
+ hitServerButton.click();
+ assertLastLog("7. Value changed: " + string);
+
+ }
+
+ private String getRandomString() {
+ String string = RandomStringUtils.randomAlphanumeric(2);
+ return string;
+ }
+
+ private void assertLastLog(String string) {
+ String text = getDriver().findElement(By.id("Log_row_0")).getText();
+ Assert.assertEquals(string, text);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldTruncatesUnderscoresInModalDialogs.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldTruncatesUnderscoresInModalDialogs.java
new file mode 100644
index 0000000000..2a9df42ba1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldTruncatesUnderscoresInModalDialogs.java
@@ -0,0 +1,65 @@
+/*
+ * 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.components.textfield;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.Window;
+
+@SuppressWarnings("serial")
+@Theme("chameleon")
+public class TextFieldTruncatesUnderscoresInModalDialogs extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Window dialog = new Window();
+
+ FormLayout formLayout = new FormLayout();
+ formLayout.setSpacing(true);
+
+ formLayout.addComponent(new Button("Disappear",
+ new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ event.getButton().setVisible(false);
+ }
+ }));
+
+ formLayout.addComponent(new TextField(null, "____pqjgy____"));
+
+ dialog.setContent(formLayout);
+
+ getUI().addWindow(dialog);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Text field must not truncate underscores in modal dialogs.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12974;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldTruncatesUnderscoresInModalDialogsTest.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldTruncatesUnderscoresInModalDialogsTest.java
new file mode 100644
index 0000000000..66b0df5ff4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldTruncatesUnderscoresInModalDialogsTest.java
@@ -0,0 +1,16 @@
+package com.vaadin.tests.components.textfield;
+
+import org.junit.Test;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TextFieldTruncatesUnderscoresInModalDialogsTest extends
+ MultiBrowserTest {
+
+ @Test
+ public void testWindowRepositioning() throws Exception {
+ openTestURL();
+
+ compareScreen("TextFieldTruncatesUnderscoresInModalDialogs");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnRightClick.java b/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnRightClick.java
new file mode 100644
index 0000000000..8a2b263006
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnRightClick.java
@@ -0,0 +1,53 @@
+package com.vaadin.tests.components.tree;
+
+import com.vaadin.event.ItemClickEvent;
+import com.vaadin.event.MouseEvents;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Tree;
+
+/**
+ * Test for #12618: Trying to select item with right click in Tree causes focus
+ * issues.
+ */
+@SuppressWarnings("serial")
+public class TreeScrollingOnRightClick extends AbstractTestUI {
+
+ public static final String TREE_ID = "my-tree";
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Tree tree = new Tree();
+ tree.setId(TREE_ID);
+ tree.setSizeUndefined();
+
+ // Add item click listener for right click selection
+ tree.addItemClickListener(new ItemClickEvent.ItemClickListener() {
+ @SuppressWarnings("deprecation")
+ @Override
+ public void itemClick(ItemClickEvent event) {
+ if (event.getButton() == MouseEvents.ClickEvent.BUTTON_RIGHT) {
+ tree.select(event.getItemId());
+ }
+ }
+ });
+
+ // Add some items
+ for (int i = 0; i < 200; i++) {
+ tree.addItem(String.format("Node %s", i));
+ }
+
+ addComponent(tree);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Right clicking on items should not scroll Tree.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12618;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnRightClickTest.java b/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnRightClickTest.java
new file mode 100644
index 0000000000..76ab1b3fdb
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnRightClickTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.components.tree;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.Point;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ *
+ * @since 7.1.9
+ * @author Vaadin Ltd
+ */
+public class TreeScrollingOnRightClickTest extends MultiBrowserTest {
+
+ @Test
+ public void testScrollingOnRightClick() throws Throwable {
+ openTestURL();
+
+ // Focus tree
+ WebElement tree = getDriver().findElement(
+ By.id(TreeScrollingOnRightClick.TREE_ID));
+ tree.click();
+
+ // Move selection down 50 items
+ for (int down = 0; down < 50; down++) {
+ tree.sendKeys(Keys.ARROW_DOWN);
+ }
+
+ Thread.sleep(1000);
+
+ // Get location of item 40
+ Point item40Location = getTreeNode("Node 40").getLocation();
+
+ // Right click on item 45
+ WebElement item45 = getTreeNode("Node 45");
+ new Actions(getDriver()).moveToElement(item45).contextClick(item45)
+ .perform();
+
+ // Ensure location of item 40 is still the same (no scrolling)
+ Point item40Location2 = getTreeNode("Node 40").getLocation();
+ assertEquals(item40Location.getY(), item40Location2.getY());
+ }
+
+ private WebElement getTreeNode(String caption) {
+ return getDriver().findElement(
+ By.xpath("//span[text() = '" + caption + "']"));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/ui/TestUIWidgetset.java b/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetset.java
index e837321b56..f674567a2d 100644
--- a/uitest/src/com/vaadin/tests/components/ui/TestUIWidgetset.java
+++ b/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetset.java
@@ -6,11 +6,13 @@ import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.widgetset.server.MissingFromDefaultWidgetsetComponent;
@Widgetset("com.vaadin.tests.widgetset.TestingWidgetSet")
-public class TestUIWidgetset extends AbstractTestUI {
+public class ComponentIncludedInCustomWidgetset extends AbstractTestUI {
@Override
protected void setup(VaadinRequest request) {
- addComponent(new MissingFromDefaultWidgetsetComponent());
+ MissingFromDefaultWidgetsetComponent component = new MissingFromDefaultWidgetsetComponent();
+ component.setId("missing-component");
+ addComponent(component);
}
@Override
diff --git a/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetsetTest.java b/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetsetTest.java
new file mode 100644
index 0000000000..f27ef5d789
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetsetTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.components.ui;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests if a component is included in a custom widgetset
+ * (com.vaadin.tests.widgetset.TestingWidgetSet)
+ *
+ * @author Vaadin Ltd
+ */
+public class ComponentIncludedInCustomWidgetsetTest extends MultiBrowserTest {
+
+ @Test
+ public void testComponentInTestingWidgetsetNotInDefaultWidgetset() {
+ openTestURL();
+ WebElement component = vaadinElementById("missing-component");
+ assertEquals(
+ "This component is available in TestingWidgetset, but not in DefaultWidgetset",
+ component.getText());
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/ui/TestUIWidgetset2.java b/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetset.java
index a68cd91a5e..554a461c37 100644
--- a/uitest/src/com/vaadin/tests/components/ui/TestUIWidgetset2.java
+++ b/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetset.java
@@ -4,11 +4,13 @@ import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.widgetset.server.MissingFromDefaultWidgetsetComponent;
-public class TestUIWidgetset2 extends AbstractTestUI {
+public class ComponentMissingFromDefaultWidgetset extends AbstractTestUI {
@Override
protected void setup(VaadinRequest request) {
- addComponent(new MissingFromDefaultWidgetsetComponent());
+ MissingFromDefaultWidgetsetComponent component = new MissingFromDefaultWidgetsetComponent();
+ component.setId("missing-component");
+ addComponent(component);
}
@Override
diff --git a/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java b/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java
new file mode 100644
index 0000000000..ec8add75e0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.components.ui;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Test for testing if a component is missing from a widgetset.
+ *
+ * @author Vaadin Ltd
+ */
+public class ComponentMissingFromDefaultWidgetsetTest extends MultiBrowserTest {
+
+ @Test
+ public void testComponentInTestingWidgetset() {
+ openTestURL();
+ WebElement component = vaadinElementById("missing-component");
+ assertTrue(component
+ .getText()
+ .startsWith(
+ "Widgetset 'com.vaadin.DefaultWidgetSet' does not contain implementation for com.vaadin.tests.widgetset.server.MissingFromDefaultWidgetsetComponent."));
+
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/ui/TestUIWidgetset.html b/uitest/src/com/vaadin/tests/components/ui/TestUIWidgetset.html
deleted file mode 100644
index 4c10dc4275..0000000000
--- a/uitest/src/com/vaadin/tests/components/ui/TestUIWidgetset.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<?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="" />
-<title>Ticket4607</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">Ticket4607</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.ui.TestUIWidgetset?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentsuiTestUIWidgetset::/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0]</td>
- <td>This component is available in TestingWidgetset, but not in DefaultWidgetset</td>
-</tr>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.ui.TestUIWidgetset2?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentsuiTestUIWidgetset2::/VVerticalLayout[0]/VVerticalLayout[0]/VUnknownComponent[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>Widgetset does not contain implementation for com.vaadin.tests.widgetset.server.MissingFromDefaultWidgetsetComponent. Check its component connector's @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivity.java b/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivity.java
new file mode 100644
index 0000000000..2c649c9ca8
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivity.java
@@ -0,0 +1,74 @@
+/*
+ * 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.components.ui;
+
+import com.vaadin.server.CustomizedSystemMessages;
+import com.vaadin.server.SystemMessages;
+import com.vaadin.server.SystemMessagesInfo;
+import com.vaadin.server.SystemMessagesProvider;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class TimeoutRedirectResetsOnActivity extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ setupTimout(request);
+
+ addComponent(new Button("clicky", new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ // NOOP
+ }
+ }));
+ }
+
+ private void setupTimout(VaadinRequest request) {
+ request.getService().setSystemMessagesProvider(
+ new SystemMessagesProvider() {
+ @Override
+ public SystemMessages getSystemMessages(
+ SystemMessagesInfo systemMessagesInfo) {
+ CustomizedSystemMessages msgs = new CustomizedSystemMessages();
+ msgs.setSessionExpiredMessage(null);
+ msgs.setSessionExpiredCaption(null);
+ msgs.setSessionExpiredNotificationEnabled(true);
+ msgs.setSessionExpiredURL("http://example.com/");
+ return msgs;
+ }
+ });
+ /*
+ * NOTE: in practice, this means a timeout after 25 seconds, because of
+ * implementation details in
+ * com.vaadin.server.communication.MetadataWriter
+ */
+ getSession().getSession().setMaxInactiveInterval(10);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "The timeout redirect timer should reset if there's activity between the client and server.";
+ }
+
+ @Override
+ @SuppressWarnings("boxing")
+ protected Integer getTicketNumber() {
+ return 12446;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java b/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java
new file mode 100644
index 0000000000..272bacb8d5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.components.ui;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TimeoutRedirectResetsOnActivityTest extends MultiBrowserTest {
+ @Test
+ public void verifyRedirectWorks() throws Exception {
+ setDebug(true);
+ openTestURL();
+
+ long startTime = System.currentTimeMillis();
+ while (System.currentTimeMillis() - startTime < 30000) {
+ clickTheButton();
+ Thread.sleep(1000);
+ }
+
+ assertTrue("button disappeared before timeout", buttonIsStillThere());
+
+ Thread.sleep(30000);
+ assertTrue("no redirection occurred within 30 seconds",
+ !buttonIsStillThere());
+ }
+
+ private boolean buttonIsStillThere() {
+ try {
+ return getButton() != null;
+ } catch (NoSuchElementException e) {
+ return false;
+ }
+ }
+
+ private void clickTheButton() {
+ getButton().click();
+ }
+
+ private WebElement getButton() {
+ /*
+ * For some reason, the vaadinElement() method doesn't work when tests
+ * are run outside of "/run/" and "/run-push/" contexts. The given error
+ * message says that the generated Vaadin path doesn't match any
+ * elements, but when that selector is put into the recorder, the
+ * recorder finds it.
+ *
+ * XPath works fine.
+ */
+ /*-
+ return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]");
+ */
+ return getDriver().findElement(
+ By.xpath("//div[contains(@class,'v-button')]"));
+ }
+
+ @Override
+ protected String getDeploymentPath() {
+ /*
+ * AbstractTB3Test assumes only /run/ and /run-push/ contexts, so this
+ * method needs some overriding.
+ */
+ return "/12446/"
+ + TimeoutRedirectResetsOnActivity.class.getCanonicalName()
+ + "?restartApplication&debug";
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAccess.java b/uitest/src/com/vaadin/tests/components/ui/UIAccess.java
deleted file mode 100644
index d036827159..0000000000
--- a/uitest/src/com/vaadin/tests/components/ui/UIAccess.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * 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.components.ui;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.locks.ReentrantLock;
-
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinService;
-import com.vaadin.server.VaadinSession;
-import com.vaadin.shared.communication.PushMode;
-import com.vaadin.tests.components.AbstractTestUIWithLog;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.UI;
-import com.vaadin.util.CurrentInstance;
-
-public class UIAccess extends AbstractTestUIWithLog {
-
- private volatile boolean checkCurrentInstancesBeforeResponse = false;
-
- private Future<Void> checkFromBeforeClientResponse;
-
- private class CurrentInstanceTestType {
- private String value;
-
- public CurrentInstanceTestType(String value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return value;
- }
- }
-
- @Override
- protected void setup(VaadinRequest request) {
- addComponent(new Button("Access from UI thread",
- new Button.ClickListener() {
-
- @Override
- public void buttonClick(ClickEvent event) {
- log.clear();
- // Ensure beforeClientResponse is invoked
- markAsDirty();
- checkFromBeforeClientResponse = access(new Runnable() {
- @Override
- public void run() {
- log("Access from UI thread is run");
- }
- });
- log("Access from UI thread future is done? "
- + checkFromBeforeClientResponse.isDone());
- }
- }));
- addComponent(new Button("Access from background thread",
- new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- log.clear();
- final CountDownLatch latch = new CountDownLatch(1);
-
- new Thread() {
- @Override
- public void run() {
- final boolean threadHasCurrentResponse = VaadinService
- .getCurrentResponse() != null;
- // session is locked by request thread at this
- // point
- final Future<Void> initialFuture = access(new Runnable() {
- @Override
- public void run() {
- log("Initial background message");
- log("Thread has current response? "
- + threadHasCurrentResponse);
- }
- });
-
- // Let request thread continue
- latch.countDown();
-
- // Wait until thread can be locked
- while (!getSession().getLockInstance()
- .tryLock()) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
- try {
- log("Thread got lock, inital future done? "
- + initialFuture.isDone());
- setPollInterval(-1);
- } finally {
- getSession().unlock();
- }
- }
- }.start();
-
- // Wait for thread to do initialize before continuing
- try {
- latch.await();
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
-
- setPollInterval(3000);
- }
- }));
- addComponent(new Button("Access throwing exception",
- new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- log.clear();
- final Future<Void> firstFuture = access(new Runnable() {
- @Override
- public void run() {
- log("Throwing exception in access");
- throw new RuntimeException(
- "Catch me if you can");
- }
- });
- access(new Runnable() {
- @Override
- public void run() {
- log("firstFuture is done? "
- + firstFuture.isDone());
- try {
- firstFuture.get();
- log("Should not get here");
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- } catch (ExecutionException e) {
- log("Got exception from firstFuture: "
- + e.getMessage());
- }
- }
- });
- }
- }));
- addComponent(new Button("Cancel future before started",
- new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- log.clear();
- Future<Void> future = access(new Runnable() {
- @Override
- public void run() {
- log("Should not get here");
- }
- });
- future.cancel(false);
- log("future was cancled, should not start");
- }
- }));
- addComponent(new Button("Cancel running future",
- new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- log.clear();
- final ReentrantLock interruptLock = new ReentrantLock();
-
- final Future<Void> future = access(new Runnable() {
- @Override
- public void run() {
- log("Waiting for thread to start");
- while (!interruptLock.isLocked()) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- log("Premature interruption");
- throw new RuntimeException(e);
- }
- }
-
- log("Thread started, waiting for interruption");
- try {
- interruptLock.lockInterruptibly();
- } catch (InterruptedException e) {
- log("I was interrupted");
- }
- }
- });
-
- new Thread() {
- @Override
- public void run() {
- interruptLock.lock();
- // Wait until UI thread has started waiting for
- // the lock
- while (!interruptLock.hasQueuedThreads()) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
-
- future.cancel(true);
- }
- }.start();
- }
- }));
- addComponent(new Button("CurrentInstance accessSynchronously values",
- new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- log.clear();
- // accessSynchronously should maintain values
- CurrentInstance.set(CurrentInstanceTestType.class,
- new CurrentInstanceTestType(
- "Set before accessSynchronosly"));
- accessSynchronously(new Runnable() {
- @Override
- public void run() {
- log.log("accessSynchronously has request? "
- + (VaadinService.getCurrentRequest() != null));
- log.log("Test value in accessSynchronously: "
- + CurrentInstance
- .get(CurrentInstanceTestType.class));
- CurrentInstance.set(
- CurrentInstanceTestType.class,
- new CurrentInstanceTestType(
- "Set in accessSynchronosly"));
- }
- });
- log.log("has request after accessSynchronously? "
- + (VaadinService.getCurrentRequest() != null));
- log("Test value after accessSynchornously: "
- + CurrentInstance
- .get(CurrentInstanceTestType.class));
- }
- }));
- addComponent(new Button("CurrentInstance access values",
- new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- log.clear();
- // accessSynchronously should maintain values
- CurrentInstance
- .setInheritable(CurrentInstanceTestType.class,
- new CurrentInstanceTestType(
- "Set before access"));
- access(new Runnable() {
- @Override
- public void run() {
- log.log("access has request? "
- + (VaadinService.getCurrentRequest() != null));
- log.log("Test value in access: "
- + CurrentInstance
- .get(CurrentInstanceTestType.class));
- CurrentInstance.setInheritable(
- CurrentInstanceTestType.class,
- new CurrentInstanceTestType(
- "Set in access"));
- }
- });
- CurrentInstance.setInheritable(
- CurrentInstanceTestType.class,
- new CurrentInstanceTestType(
- "Set before run pending"));
-
- getSession().getService().runPendingAccessTasks(
- getSession());
-
- log.log("has request after access? "
- + (VaadinService.getCurrentRequest() != null));
- log("Test value after access: "
- + CurrentInstance
- .get(CurrentInstanceTestType.class));
- }
- }));
-
- addComponent(new Button("CurrentInstance when pushing",
- new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- log.clear();
- if (getPushConfiguration().getPushMode() != PushMode.AUTOMATIC) {
- log("Can only test with automatic push enabled");
- return;
- }
-
- final VaadinSession session = getSession();
- new Thread() {
- @Override
- public void run() {
- // Pretend this isn't a Vaadin thread
- CurrentInstance.clearAll();
-
- /*
- * Get explicit lock to ensure the (implicit)
- * push does not happen during normal request
- * handling.
- */
- session.lock();
- try {
- access(new Runnable() {
- @Override
- public void run() {
- checkCurrentInstancesBeforeResponse = true;
- // Trigger beforeClientResponse
- markAsDirty();
- }
- });
- } finally {
- session.unlock();
- }
- }
- }.start();
- }
- }));
- }
-
- @Override
- public void beforeClientResponse(boolean initial) {
- if (checkFromBeforeClientResponse != null) {
- log("beforeClientResponse future is done? "
- + checkFromBeforeClientResponse.isDone());
- checkFromBeforeClientResponse = null;
- }
- if (checkCurrentInstancesBeforeResponse) {
- UI currentUI = UI.getCurrent();
- VaadinSession currentSession = VaadinSession.getCurrent();
-
- log("Current UI matches in beforeResponse? " + (currentUI == this));
- log("Current session matches in beforeResponse? "
- + (currentSession == getSession()));
- checkCurrentInstancesBeforeResponse = false;
- }
- }
-
- @Override
- protected String getTestDescription() {
- return "Test for various ways of using UI.access";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return Integer.valueOf(11897);
- }
-
-}
diff --git a/uitest/src/com/vaadin/tests/components/upload/UploadNoSelection.java b/uitest/src/com/vaadin/tests/components/upload/UploadNoSelection.java
new file mode 100644
index 0000000000..c304293170
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/upload/UploadNoSelection.java
@@ -0,0 +1,83 @@
+/*
+ * 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.components.upload;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Upload;
+import com.vaadin.ui.Upload.FailedEvent;
+import com.vaadin.ui.Upload.FinishedEvent;
+import com.vaadin.ui.Upload.Receiver;
+
+public class UploadNoSelection extends AbstractTestUIWithLog implements
+ Receiver {
+
+ static final String LOG_ID_PREFIX = "Log_row_";
+ static final String UPLOAD_ID = "u";
+
+ static final String UPLOAD_FINISHED = "Upload Finished";
+ static final String RECEIVING_UPLOAD = "Receiving upload";
+
+ static final String FILE_LENGTH_PREFIX = "File length:";
+ static final String FILE_NAME_PREFIX = "File name:";
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 9602;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Uploading an empty selection (no file) will trigger FinishedEvent with 0-length file size and empty filename.";
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Upload u = new Upload("Upload", this);
+ u.setId(UPLOAD_ID);
+ u.setSizeUndefined();
+
+ addComponent(u);
+
+ u.addFinishedListener(new Upload.FinishedListener() {
+ @Override
+ public void uploadFinished(FinishedEvent event) {
+ log(UPLOAD_FINISHED);
+ log(FILE_LENGTH_PREFIX + " " + event.getLength());
+ log(FILE_NAME_PREFIX + " " + event.getFilename());
+ }
+ });
+ u.addFailedListener(new Upload.FailedListener() {
+
+ @Override
+ public void uploadFailed(FailedEvent event) {
+ log("Upload Failed");
+ log(FILE_LENGTH_PREFIX + " " + event.getLength());
+ log(FILE_NAME_PREFIX + " " + event.getFilename());
+ }
+ });
+ }
+
+ @Override
+ public OutputStream receiveUpload(String filename, String MIMEType) {
+ log(RECEIVING_UPLOAD);
+ return new ByteArrayOutputStream();
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/upload/UploadNoSelectionTest.java b/uitest/src/com/vaadin/tests/components/upload/UploadNoSelectionTest.java
new file mode 100644
index 0000000000..1b30c4080a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/upload/UploadNoSelectionTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.components.upload;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class UploadNoSelectionTest extends MultiBrowserTest {
+
+ @Test
+ public void testUploadNoSelection() throws Exception {
+ openTestURL();
+
+ // empty content is populated by com.vaadin.tests.util.Log
+ Assert.assertEquals(" ", getLogRow(0));
+
+ getSubmitButton().click();
+
+ // expecting empty file name
+ assertLogRow(0, 4, UploadNoSelection.FILE_NAME_PREFIX);
+ // expecting 0-length file
+ assertLogRow(1, 3, UploadNoSelection.FILE_LENGTH_PREFIX + " " + 0);
+ assertLogRow(2, 2, UploadNoSelection.UPLOAD_FINISHED);
+ assertLogRow(3, 1, UploadNoSelection.RECEIVING_UPLOAD);
+ }
+
+ private WebElement getSubmitButton() {
+ WebElement element = getDriver().findElement(
+ By.id(UploadNoSelection.UPLOAD_ID));
+ WebElement submitButton = element.findElement(By.className("v-button"));
+ return submitButton;
+ }
+
+ private void assertLogRow(int index, int expentedRowNo,
+ String expectedValueWithoutRowNo) {
+ Assert.assertEquals(expentedRowNo + ". " + expectedValueWithoutRowNo,
+ getLogRow(index));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpened.java b/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpened.java
new file mode 100644
index 0000000000..2f1c0ff685
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpened.java
@@ -0,0 +1,58 @@
+/*
+ * 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.components.window;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+
+/**
+ *
+ * @since 7.1.9
+ * @author Vaadin Ltd
+ */
+public class ScrollingBodyElementWithModalOpened extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ VerticalLayout verticalLayout = new VerticalLayout();
+ verticalLayout.setHeight("10000px");
+
+ Window window = new Window("Caption");
+
+ VerticalLayout layout = new VerticalLayout();
+ layout.setWidth("300px");
+ layout.setHeight("300px");
+ window.setContent(layout);
+
+ addWindow(window);
+
+ window.setModal(true);
+
+ addComponent(verticalLayout);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Screen must not scroll with modal opened.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12899;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java b/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java
new file mode 100644
index 0000000000..b6474519b0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/ScrollingBodyElementWithModalOpenedTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.components.window;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.commands.TestBenchElementCommands;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class ScrollingBodyElementWithModalOpenedTest extends MultiBrowserTest {
+
+ @Test
+ public void testWindowScrollbars() throws Exception {
+ openTestURL();
+
+ WebElement bodyElement = driver.findElement(By
+ .className("v-modal-window-open"));
+
+ TestBenchElementCommands scrollable = testBenchElement(bodyElement);
+ scrollable.scroll(1000);
+
+ Thread.sleep(1000);
+
+ compareScreen(getScreenshotBaseName());
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java b/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java
index 1df036af58..2e0873956c 100644
--- a/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java
+++ b/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java
@@ -15,7 +15,6 @@
*/
package com.vaadin.tests.components.window;
-import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;
@@ -64,7 +63,7 @@ public class SubWindowsTextSelectionTest extends MultiBrowserTest {
}
@Test
- public void verifyNoTextSelectionOnMove() throws MalformedURLException {
+ public void verifyNoTextSelectionOnMove() throws Exception {
openTestURL();
diff --git a/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.html b/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.html
deleted file mode 100644
index 575eb652b7..0000000000
--- a/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.html
+++ /dev/null
@@ -1,86 +0,0 @@
-<?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="" />
-<title>TooltipInWindow</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TooltipInWindow</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.window.TooltipInWindow?restartApplication</td>
- <td></td>
-</tr>
-<!--Show tooltip in Root-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentswindowTooltipInWindow::/VVerticalLayout[0]/VVerticalLayout[0]/VTextField[0]</td>
- <td>5,5</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentswindowTooltipInWindow::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>My tooltip</td>
-</tr>
-<!--Hide the tooltip-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentswindowTooltipInWindow::/VVerticalLayout[0]</td>
- <td>0,0</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runcomvaadintestscomponentswindowTooltipInWindow::Root/VTooltip[0]</td>
- <td>-1000</td>
-</tr>
-<!--Show tooltip in Window-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentswindowTooltipInWindow::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/VTextField[0]</td>
- <td>5,5</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentswindowTooltipInWindow::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>My tooltip</td>
-</tr>
-<!-- Hide tooltip in Window -->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentswindowTooltipInWindow::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]</td>
- <td>0,0</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runcomvaadintestscomponentswindowTooltipInWindow::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>-1000</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java b/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java
index d3c7a616cd..02ec0c047b 100644
--- a/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java
+++ b/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java
@@ -31,15 +31,16 @@ public class TooltipInWindow extends AbstractTestUI {
Window window = new Window("Window", layout);
layout.setSizeUndefined();
window.center();
- layout.addComponent(createTextField());
+ layout.addComponent(createTextField("tf1"));
addWindow(window);
- addComponent(createTextField());
+ addComponent(createTextField("tf2"));
}
- private TextField createTextField() {
+ private TextField createTextField(String id) {
TextField tf = new TextField("TextField with a tooltip");
tf.setDescription("My tooltip");
+ tf.setId(id);
return tf;
}
diff --git a/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java b/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java
new file mode 100644
index 0000000000..0e11041e3b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java
@@ -0,0 +1,98 @@
+/*
+ * 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.components.window;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.HasInputDevices;
+import org.openqa.selenium.interactions.Mouse;
+import org.openqa.selenium.interactions.internal.Coordinates;
+import org.openqa.selenium.internal.Locatable;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TooltipInWindowTest extends MultiBrowserTest {
+
+ @Test
+ public void testTooltipsInSubWindow() throws Exception {
+ openTestURL();
+
+ WebElement textfield = vaadinElementById("tf1");
+ Coordinates textfieldCoordinates = ((Locatable) textfield)
+ .getCoordinates();
+
+ Mouse mouse = ((HasInputDevices) getDriver()).getMouse();
+
+ // Show tooltip
+ mouse.mouseMove(textfieldCoordinates, 10, 10);
+ sleep(1000);
+
+ ensureVisibleTooltipPositionedCorrectly();
+ assertEquals("My tooltip", getTooltipElement().getText());
+
+ // Hide tooltip
+ mouse.mouseMove(textfieldCoordinates, -100, -100);
+ sleep(1000);
+
+ ensureHiddenTooltipPositionedCorrectly();
+ assertEquals("", getTooltipElement().getText());
+
+ // Show tooltip again
+ mouse.mouseMove(textfieldCoordinates, 10, 10);
+ sleep(1000);
+
+ ensureVisibleTooltipPositionedCorrectly();
+ assertEquals("My tooltip", getTooltipElement().getText());
+
+ // Hide tooltip
+ mouse.mouseMove(textfieldCoordinates, -100, -100);
+ sleep(1000);
+
+ ensureHiddenTooltipPositionedCorrectly();
+ assertEquals("", getTooltipElement().getText());
+ }
+
+ private WebElement getTooltipElement() {
+ return getDriver().findElement(By.className("v-tooltip-text"));
+ }
+
+ private WebElement getTooltipContainerElement() {
+ return getDriver().findElement(By.className("v-tooltip"));
+ }
+
+ private void ensureVisibleTooltipPositionedCorrectly() {
+ WebElement textfield = vaadinElementById("tf1");
+ int tooltipX = getTooltipContainerElement().getLocation().getX();
+ int textfieldX = textfield.getLocation().getX();
+ assertGreaterOrEqual("Tooltip should be positioned on the textfield ("
+ + tooltipX + " < " + textfieldX + ")", tooltipX, textfieldX);
+ }
+
+ private void ensureHiddenTooltipPositionedCorrectly() {
+ int tooltipX = getTooltipContainerElement().getLocation().getX();
+ assertLessThanOrEqual(
+ "Tooltip should be positioned outside of viewport (was at "
+ + tooltipX + ")", tooltipX, -1000);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/integration/JSPIntegrationTest.java b/uitest/src/com/vaadin/tests/integration/JSPIntegrationTest.java
new file mode 100644
index 0000000000..c5d6a65d87
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/integration/JSPIntegrationTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.integration;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.PrivateTB3Configuration;
+
+public class JSPIntegrationTest extends PrivateTB3Configuration {
+
+ final String appRunnerTestUrl = getBaseURL() + "/run/Buttons";
+ final String jspUrl = getBaseURL() + "/statictestfiles/vaadinsessions.jsp";
+ final String integrationUrl = getBaseURL() + "/integration";
+
+ @Test
+ public void listVaadinSessions() {
+
+ assertUICount(0);
+
+ // Open a new UI
+ getDriver().get(integrationUrl);
+ assertUICount(1);
+
+ // Open a new UI
+ getDriver().get(integrationUrl);
+
+ // Should now have two UIs for the same service with different uiIds
+ List<UIData> twoUIs = getUIs();
+ assertEquals(2, twoUIs.size());
+ assertNotEquals(twoUIs.get(0).uiId, twoUIs.get(1).uiId);
+ assertEquals(twoUIs.get(0).serviceName, twoUIs.get(1).serviceName);
+
+ getDriver().get(appRunnerTestUrl);
+ // Should now have two services with 2 + 1 UIs
+ List<UIData> threeUIs = getUIs();
+ assertEquals(3, threeUIs.size());
+ Set<String> serviceNames = new HashSet<String>();
+ Set<Integer> uiIds = new HashSet<Integer>();
+ for (UIData uiData : threeUIs) {
+ serviceNames.add(uiData.serviceName);
+ uiIds.add(uiData.uiId);
+ }
+ assertGreaterOrEqual(
+ "There should be at least two unique service names",
+ serviceNames.size(), 2);
+ assertGreaterOrEqual("There should be at least two unique ui ids",
+ uiIds.size(), 2);
+ }
+
+ private static class UIData {
+ private String serviceName;
+ private int uiId;
+ }
+
+ private List<UIData> getUIs() {
+ List<UIData> uis = new ArrayList<UIData>();
+
+ getDriver().get(jspUrl);
+ List<WebElement> rows = getDriver().findElements(
+ By.xpath("//tr[@class='uirow']"));
+ for (WebElement row : rows) {
+ UIData data = new UIData();
+ List<WebElement> tds = row.findElements(By.xpath("./td"));
+
+ data.serviceName = tds.get(0).getText();
+ data.uiId = Integer.parseInt(tds.get(2).getText());
+
+ uis.add(data);
+ }
+
+ return uis;
+ }
+
+ private void assertUICount(int i) {
+ assertEquals(i, getUIs().size());
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/push/BasicPushLongPolling.java b/uitest/src/com/vaadin/tests/push/BasicPushLongPolling.java
new file mode 100644
index 0000000000..bbb7895f20
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/BasicPushLongPolling.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.LONG_POLLING)
+public class BasicPushLongPolling extends BasicPush {
+
+ @Override
+ public void init(VaadinRequest request) {
+ super.init(request);
+ // Don't use fallback so we can easier detect if long polling fails
+ getPushConfiguration().setParameter(
+ PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/BasicPushLongPollingTest.java b/uitest/src/com/vaadin/tests/push/BasicPushLongPollingTest.java
new file mode 100644
index 0000000000..b526a11d38
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/BasicPushLongPollingTest.java
@@ -0,0 +1,19 @@
+/*
+ * 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 BasicPushLongPollingTest extends BasicPushTest {
+} \ No newline at end of file
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/LongPollingReconnectTest.java b/uitest/src/com/vaadin/tests/push/LongPollingReconnectTest.java
new file mode 100644
index 0000000000..81c974e1e5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/LongPollingReconnectTest.java
@@ -0,0 +1,25 @@
+/*
+ * 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 LongPollingReconnectTest extends PushReconnectTest {
+
+ @Override
+ protected Class<?> getUIClass() {
+ return BasicPushLongPolling.class;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/PushFromInit.java b/uitest/src/com/vaadin/tests/push/PushFromInit.java
index cb084f1232..0afaa866f7 100644
--- a/uitest/src/com/vaadin/tests/push/PushFromInit.java
+++ b/uitest/src/com/vaadin/tests/push/PushFromInit.java
@@ -15,29 +15,60 @@
*/
package com.vaadin.tests.push;
+import com.vaadin.annotations.Push;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUIWithLog;
import com.vaadin.ui.Button;
+@Push
public class PushFromInit extends AbstractTestUIWithLog {
+ public static final String LOG_DURING_INIT = "Logged from access run before init ends";
+ public static final String LOG_AFTER_INIT = "Logged from background thread run after init has finished";
+
@Override
protected void setup(VaadinRequest request) {
- new Thread() {
- @Override
- public void run() {
- access(new Runnable() {
- @Override
- public void run() {
- log("Logged from background thread started in init");
- }
- });
- }
- }.start();
log("Logged in init");
+ Thread t = new Thread(new RunBeforeInitEnds());
+ t.start();
+ try {
+ t.join();
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ new Thread(new RunAfterInit()).start();
addComponent(new Button("Sync"));
}
+ class RunBeforeInitEnds implements Runnable {
+ @Override
+ public void run() {
+ access(new Runnable() {
+ @Override
+ public void run() {
+ log(LOG_DURING_INIT);
+ }
+ });
+ }
+ }
+
+ class RunAfterInit implements Runnable {
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ access(new Runnable() {
+ @Override
+ public void run() {
+ log(LOG_AFTER_INIT);
+ }
+ });
+ }
+ }
+
@Override
protected String getTestDescription() {
return "Pusing something to a newly created UI should not cause race conditions";
diff --git a/uitest/src/com/vaadin/tests/push/PushFromInitTest.java b/uitest/src/com/vaadin/tests/push/PushFromInitTest.java
index 3c1bc1b610..4101de29cf 100644
--- a/uitest/src/com/vaadin/tests/push/PushFromInitTest.java
+++ b/uitest/src/com/vaadin/tests/push/PushFromInitTest.java
@@ -15,8 +15,9 @@
*/
package com.vaadin.tests.push;
-import org.junit.Assert;
import org.junit.Test;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.ExpectedCondition;
import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -25,26 +26,13 @@ public class PushFromInitTest extends MultiBrowserTest {
public void testPushFromInit() {
openTestURL();
- for (int second = 0;; second++) {
- if (second >= 30) {
- Assert.fail("timeout");
+ waitUntil(new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver input) {
+ return ("3. " + PushFromInit.LOG_AFTER_INIT)
+ .equals(getLogRow(0));
}
- try {
- if ("1. Logged in init".equals(vaadinElementById(
- "Log_row_1").getText())) {
- break;
- }
- } catch (Exception e) {
- }
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- }
- }
-
- Assert.assertEquals(
- "2. Logged from background thread started in init",
- vaadinElementById("Log_row_0").getText());
+ });
}
} \ No newline at end of file
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/PushLargeDataLongPolling.java b/uitest/src/com/vaadin/tests/push/PushLargeDataLongPolling.java
new file mode 100644
index 0000000000..52a647115a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/PushLargeDataLongPolling.java
@@ -0,0 +1,32 @@
+/*
+ * 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.LONG_POLLING)
+public class PushLargeDataLongPolling extends PushLargeData {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ super.setup(request);
+ getPushConfiguration().setParameter(
+ PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java
new file mode 100644
index 0000000000..534c5287bb
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.MultiBrowserTest;
+
+public class PushLargeDataLongPollingTest extends MultiBrowserTest {
+
+ @Test
+ public void testLongPollingLargeData() 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();
+
+ push();
+ // Push complete. Browser will reconnect now as > 10MB has been sent
+ // Push again to ensure push still works
+ push();
+
+ }
+
+ private void push() throws InterruptedException {
+ // Wait for startButton to be present
+ waitForElementToBePresent(vaadinLocatorById("startButton"));
+
+ String logRow0Id = "Log_row_0";
+ By logRow0 = vaadinLocatorById(logRow0Id);
+
+ vaadinElementById("startButton").click();
+ // Wait for push to start
+ waitUntil(ExpectedConditions.textToBePresentInElement(logRow0,
+ "Package "));
+
+ // 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/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();
diff --git a/uitest/src/com/vaadin/tests/serialization/SerializerTest.html b/uitest/src/com/vaadin/tests/serialization/SerializerTest.html
deleted file mode 100644
index 63219de5c2..0000000000
--- a/uitest/src/com/vaadin/tests/serialization/SerializerTest.html
+++ /dev/null
@@ -1,116 +0,0 @@
-<?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/com.vaadin.tests.serialization.SerializerTest?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[18]</td>
- <td>sendBeanSubclass: 43</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[17]</td>
- <td>sendBoolean: false, false, [false, false, true, false, true, true]</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[16]</td>
- <td>sendByte: 5, -12, [3, 1, 2]</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[15]</td>
- <td>sendChar: Å, ∫, [a, b, c, d]</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[14]</td>
- <td>sendInt: 2, 5, [2147483647, 0]</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[13]</td>
- <td>sendLong: -57841235865, 577431841358, [57, 0]</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[12]</td>
- <td>sendFloat: 1.0000001, 3.14159, [-12.0, 0.0, 57.0]</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[11]</td>
- <td>sendDouble: 0.423310825130748, 5.859874482048838, [2.0, 1.7976931348623157E308, 4.9E-324]</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[10]</td>
- <td>sendString: Taegghiiiinnrsssstt‡</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[9]</td>
- <td>sendConnector: com.vaadin.tests.widgetset.server.SerializerTestExtension</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[8]</td>
- <td>sendBean: ComplexTestBean [innerBean1=SimpleTestBean(1), innerBean2=SimpleTestBean(3), innerBeanCollection=[SimpleTestBean(6), SimpleTestBean(0)], privimite=6], SimpleTestBean(0), [SimpleTestBean(7)]</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[7]</td>
- <td>sendNull: null, Not null</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[6]</td>
- <td>sendNestedArray: [[7, 5]], [[SimpleTestBean(2)], [SimpleTestBean(4)]]</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[5]</td>
- <td>sendList: [-234, 5, 8], class com.vaadin.tests.widgetset.server.SerializerTestExtension, class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(-568), SimpleTestBean(234)]</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[4]</td>
- <td>sendArrayList: [[2], [2]], [[2, 1], [2, 3]], [[SimpleTestBean(7)]]</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[3]</td>
- <td>sendSet: [-12, -7, -4], class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(2), SimpleTestBean(3)]</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[2]</td>
- <td>sendMap: {a=SimpleTestBean(1)}, [com.vaadin.tests.widgetset.server.SerializerTestExtension=SimpleTestBean(4)], [2=com.vaadin.tests.widgetset.server.SerializerTestExtension], {SimpleTestBean(4)=SimpleTestBean(-4), SimpleTestBean(-5)=SimpleTestBean(5)}</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[1]</td>
- <td>sendWrappedGenerics: {[SimpleTestBean(1)]={1=[SimpleTestBean(42)]}}</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0]</td>
- <td>sendEnum: PREFORMATTED, [HTML, RAW], [PREFORMATTED, XML]</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/serialization/SerializerTest.java b/uitest/src/com/vaadin/tests/serialization/SerializerTest.java
index 0561f73b21..d4849ce667 100644
--- a/uitest/src/com/vaadin/tests/serialization/SerializerTest.java
+++ b/uitest/src/com/vaadin/tests/serialization/SerializerTest.java
@@ -16,15 +16,19 @@
package com.vaadin.tests.serialization;
+import java.text.DateFormat;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.TimeZone;
import com.vaadin.annotations.Widgetset;
import com.vaadin.server.VaadinRequest;
@@ -137,6 +141,8 @@ public class SerializerTest extends AbstractTestUI {
ContentMode.PREFORMATTED, ContentMode.XML },
Arrays.asList(ContentMode.HTML, ContentMode.RAW));
+ rpc.sendDate(new Date(1));
+ rpc.sendDate(new Date(2013 - 1900, 5 - 1, 31, 11, 12, 13));
testExtension.registerRpc(new SerializerTestRpc() {
@Override
public void sendBoolean(boolean value, Boolean boxedValue,
@@ -316,6 +322,15 @@ public class SerializerTest extends AbstractTestUI {
log.log("sendBeanSubclass: " + bean.getValue());
}
+ @Override
+ public void sendDate(Date date) {
+ DateFormat format = DateFormat.getDateTimeInstance(
+ DateFormat.LONG, DateFormat.FULL,
+ new Locale("en", "fi"));
+ format.setTimeZone(TimeZone.getTimeZone("UTC"));
+ log.log("sendDate: " + format.format(date));
+ }
+
});
}
diff --git a/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java b/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java
new file mode 100644
index 0000000000..d093a30ea7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.serialization;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class SerializerTestTest extends MultiBrowserTest {
+
+ @Test
+ public void testSerialization() {
+ openTestURL();
+ int logRow = 0;
+
+ Assert.assertEquals("sendDate: May 31, 2013 8:12:13 AM UTC",
+ getLogRow(logRow++));
+ Assert.assertEquals("sendDate: January 1, 1970 12:00:00 AM UTC",
+ getLogRow(logRow++));
+ Assert.assertEquals(
+ "sendEnum: PREFORMATTED, [HTML, RAW], [PREFORMATTED, XML]",
+ getLogRow(logRow++));
+ Assert.assertEquals(
+ "sendWrappedGenerics: {[SimpleTestBean(1)]={1=[SimpleTestBean(42)]}}",
+ getLogRow(logRow++));
+ Assert.assertEquals(
+ "sendMap: {a=SimpleTestBean(1)}, [com.vaadin.tests.widgetset.server.SerializerTestExtension=SimpleTestBean(4)], [2=com.vaadin.tests.widgetset.server.SerializerTestExtension], {SimpleTestBean(4)=SimpleTestBean(-4), SimpleTestBean(-5)=SimpleTestBean(5)}",
+ getLogRow(logRow++));
+ Assert.assertEquals(
+ "sendSet: [-12, -7, -4], class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(2), SimpleTestBean(3)]",
+ getLogRow(logRow++));
+ Assert.assertEquals(
+ "sendArrayList: [[2], [2]], [[2, 1], [2, 3]], [[SimpleTestBean(7)]]",
+ getLogRow(logRow++));
+ Assert.assertEquals(
+ "sendList: [-234, 5, 8], class com.vaadin.tests.widgetset.server.SerializerTestExtension, class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(-568), SimpleTestBean(234)]",
+ getLogRow(logRow++));
+ Assert.assertEquals(
+ "sendNestedArray: [[7, 5]], [[SimpleTestBean(2)], [SimpleTestBean(4)]]",
+ getLogRow(logRow++));
+ Assert.assertEquals("sendNull: null, Not null", getLogRow(logRow++));
+ Assert.assertEquals(
+ "sendBean: ComplexTestBean [innerBean1=SimpleTestBean(1), innerBean2=SimpleTestBean(3), innerBeanCollection=[SimpleTestBean(6), SimpleTestBean(0)], privimite=6], SimpleTestBean(0), [SimpleTestBean(7)]",
+ getLogRow(logRow++));
+ Assert.assertEquals(
+ "sendConnector: com.vaadin.tests.widgetset.server.SerializerTestExtension",
+ getLogRow(logRow++));
+ Assert.assertEquals("sendString: Taegghiiiinnrsssstt‡",
+ getLogRow(logRow++));
+ Assert.assertEquals(
+ "sendDouble: 0.423310825130748, 5.859874482048838, [2.0, 1.7976931348623157E308, 4.9E-324]",
+ getLogRow(logRow++));
+ Assert.assertEquals(
+ "sendFloat: 1.0000001, 3.14159, [-12.0, 0.0, 57.0]",
+ getLogRow(logRow++));
+ Assert.assertEquals("sendLong: -57841235865, 577431841358, [57, 0]",
+ getLogRow(logRow++));
+ Assert.assertEquals("sendInt: 2, 5, [2147483647, 0]",
+ getLogRow(logRow++));
+ Assert.assertEquals("sendChar: Å, ∫, [a, b, c, d]", getLogRow(logRow++));
+ Assert.assertEquals("sendByte: 5, -12, [3, 1, 2]", getLogRow(logRow++));
+ Assert.assertEquals(
+ "sendBoolean: false, false, [false, false, true, false, true, true]",
+ getLogRow(logRow++));
+ Assert.assertEquals("sendBeanSubclass: 43", getLogRow(logRow++));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index d7b7cd050f..55a2b80918 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -28,9 +28,13 @@ import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.HasInputDevices;
+import org.openqa.selenium.interactions.Keyboard;
+import org.openqa.selenium.interactions.Mouse;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
@@ -74,6 +78,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;
@@ -270,6 +279,21 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
}
/**
+ * Uses JavaScript to determine the currently focused element.
+ *
+ * @return Focused element or null
+ */
+ protected WebElement getFocusedElement() {
+ Object focusedElement = ((JavascriptExecutor) getDriver())
+ .executeScript("return document.activeElement");
+ if (null != focusedElement) {
+ return (WebElement) focusedElement;
+ } else {
+ return null;
+ }
+ }
+
+ /**
* Find a Vaadin element based on its id given using Component.setId
*
* @param id
@@ -641,17 +665,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();
}
}
@@ -882,4 +910,22 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
}
+ /**
+ * Returns the mouse object for doing mouse commands
+ *
+ * @return Returns the mouse
+ */
+ public Mouse getMouse() {
+ return ((HasInputDevices) getDriver()).getMouse();
+ }
+
+ /**
+ * Returns the keyboard object for controlling keyboard events
+ *
+ * @return Return the keyboard
+ */
+ public Keyboard getKeyboard() {
+ return ((HasInputDevices) getDriver()).getKeyboard();
+ }
+
}
diff --git a/uitest/src/com/vaadin/tests/tb3/ExcludeFromSuite.java b/uitest/src/com/vaadin/tests/tb3/ExcludeFromSuite.java
new file mode 100644
index 0000000000..722b643f78
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tb3/ExcludeFromSuite.java
@@ -0,0 +1,28 @@
+/*
+ * 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.tb3;
+
+/**
+ * Marker interface for a TB3+ test class which will exclude the test from any
+ * test suite which automatically scans for test classes. Mostly useful for long
+ * tests which should not be run in every build.
+ *
+ * @since 7.1.10
+ * @author Vaadin Ltd
+ */
+public @interface ExcludeFromSuite {
+
+}
diff --git a/uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java b/uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java
index e1c8edfd60..f1576a9393 100644
--- a/uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java
+++ b/uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java
@@ -223,6 +223,10 @@ public class TB3TestSuite extends Suite {
if (!baseClass.isAssignableFrom(c)) {
return;
}
+ if (!includeInSuite(c)) {
+ return;
+ }
+
if (!Modifier.isAbstract(c.getModifiers()) && !c.isAnonymousClass()) {
result.add((Class<? extends T>) c);
}
@@ -235,4 +239,18 @@ public class TB3TestSuite extends Suite {
}
+ /**
+ * @return true if the class should be included in the suite, false if not
+ */
+ private static boolean includeInSuite(Class<?> c) {
+ if (c.getAnnotation(ExcludeFromSuite.class) != null) {
+ return false;
+ }
+ if (c == Object.class) {
+ return true;
+ }
+
+ return includeInSuite(c.getSuperclass());
+ }
+
} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/ClientRpcClassConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/ClientRpcClassConnector.java
new file mode 100644
index 0000000000..fb28e94bfa
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/ClientRpcClassConnector.java
@@ -0,0 +1,36 @@
+/*
+ * 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.widgetset.client;
+
+import com.vaadin.client.ui.label.LabelConnector;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.MediaControl;
+import com.vaadin.tests.widgetset.server.ClientRpcClassComponent;
+
+@Connect(ClientRpcClassComponent.class)
+public class ClientRpcClassConnector extends LabelConnector {
+
+ @Override
+ protected void init() {
+ super.init();
+ registerRpc(MediaControl.class, getWidget());
+ }
+
+ @Override
+ public ClientRpcClassWidget getWidget() {
+ return (ClientRpcClassWidget) super.getWidget();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/ClientRpcClassWidget.java b/uitest/src/com/vaadin/tests/widgetset/client/ClientRpcClassWidget.java
new file mode 100644
index 0000000000..91b4f19d92
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/ClientRpcClassWidget.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.widgetset.client;
+
+import com.vaadin.client.ui.VLabel;
+import com.vaadin.shared.ui.MediaControl;
+
+public class ClientRpcClassWidget extends VLabel implements MediaControl {
+
+ @Override
+ public void play() {
+ setText("play");
+ }
+
+ @Override
+ public void pause() {
+ setText("pause");
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java
index 0f6ad577ed..01ec6cc4bb 100644
--- a/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java
+++ b/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java
@@ -19,6 +19,7 @@ package com.vaadin.tests.widgetset.client;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -251,6 +252,11 @@ public class SerializerTestConnector extends AbstractExtensionConnector {
}
});
}
+
+ @Override
+ public void sendDate(Date date) {
+ rpc.sendDate(date);
+ }
});
}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestRpc.java b/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestRpc.java
index 4bda067242..fb5b6a1980 100644
--- a/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestRpc.java
+++ b/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestRpc.java
@@ -16,6 +16,7 @@
package com.vaadin.tests.widgetset.client;
+import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -79,4 +80,5 @@ public interface SerializerTestRpc extends ServerRpc, ClientRpc {
public void sendBeanSubclass(SimpleTestBean bean);
+ public void sendDate(Date date);
}
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/ClientRpcClass.java b/uitest/src/com/vaadin/tests/widgetset/server/ClientRpcClass.java
new file mode 100644
index 0000000000..cbc46b26f5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/ClientRpcClass.java
@@ -0,0 +1,47 @@
+/*
+ * 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.widgetset.server;
+
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.widgetset.TestingWidgetSet;
+
+@Widgetset(TestingWidgetSet.NAME)
+public class ClientRpcClass extends AbstractTestUI {
+
+ public static String TEST_COMPONENT_ID = "testComponent";
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ ClientRpcClassComponent component = new ClientRpcClassComponent();
+ component.setId(TEST_COMPONENT_ID);
+ addComponent(component);
+
+ component.pause();
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "UI showing dummy component where the wiget type is implementing the RPC interface.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(13056);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/ClientRpcClassComponent.java b/uitest/src/com/vaadin/tests/widgetset/server/ClientRpcClassComponent.java
new file mode 100644
index 0000000000..135f112fe4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/ClientRpcClassComponent.java
@@ -0,0 +1,29 @@
+/*
+ * 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.widgetset.server;
+
+import com.vaadin.shared.ui.MediaControl;
+import com.vaadin.ui.Label;
+
+public class ClientRpcClassComponent extends Label {
+ public void play() {
+ getRpcProxy(MediaControl.class).play();
+ }
+
+ public void pause() {
+ getRpcProxy(MediaControl.class).pause();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/ClientRpcClassTest.java b/uitest/src/com/vaadin/tests/widgetset/server/ClientRpcClassTest.java
new file mode 100644
index 0000000000..16c5ba4b61
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/ClientRpcClassTest.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.widgetset.server;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class ClientRpcClassTest extends MultiBrowserTest {
+
+ @Test
+ public void pauseDisplayed() {
+ openTestURL();
+
+ WebElement element = getDriver().findElement(
+ By.id(ClientRpcClass.TEST_COMPONENT_ID));
+ Assert.assertEquals("pause", element.getText());
+ }
+}