aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/src/com/vaadin')
-rw-r--r--uitest/src/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java107
-rw-r--r--uitest/src/com/vaadin/tests/accessibility/WindowWaiAriaRolesTest.java54
-rw-r--r--uitest/src/com/vaadin/tests/components/abstractcomponent/PrimaryStyleTest.java3
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.html82
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.java17
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidthTest.java109
-rw-r--r--uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRpcCountTest.java5
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxFiltering.html62
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html116
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.java17
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxIdenticalItemsTest.java76
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxInputPromptTest.java9
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxOnSmallScreen.java76
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxOnSmallScreenTest.java84
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxScrollingWithArrowsTest.java8
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxSlowTest.java108
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxUndefinedWidthAndIcon.html16
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/fi.pngbin0 -> 25094 bytes
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/fi_small.pngbin0 -> 3576 bytes
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java72
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java197
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/DateFieldClose.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/DateFieldCloseTest.java66
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_MonthChangeMeansFocusDayRolledInsideRange.html16
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnlyTest.java13
-rw-r--r--uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayoutTest.java3
-rw-r--r--uitest/src/com/vaadin/tests/components/label/LabelTooltip-chameleon.html2
-rw-r--r--uitest/src/com/vaadin/tests/components/label/LabelTooltip-runo.html2
-rw-r--r--uitest/src/com/vaadin/tests/components/menubar/MenuTooltipTest.java3
-rw-r--r--uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonClick.java89
-rw-r--r--uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonClickTest.java71
-rw-r--r--uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.html107
-rw-r--r--uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java33
-rw-r--r--uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAriaTest.java126
-rw-r--r--uitest/src/com/vaadin/tests/components/table/EditableModeChange.html56
-rw-r--r--uitest/src/com/vaadin/tests/components/table/EditableModeChange.java12
-rw-r--r--uitest/src/com/vaadin/tests/components/table/EditableModeChangeTest.java90
-rw-r--r--uitest/src/com/vaadin/tests/components/table/SetPageFirstItemLoadsNeededRowsOnly.java109
-rw-r--r--uitest/src/com/vaadin/tests/components/table/SetPageFirstItemLoadsNeededRowsOnlyTest.java58
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponents.html132
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponents.java13
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponentsTest.java238
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableColumnIcons-chameleon.html2
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableColumnIcons-runo.html2
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableGeneratedRows-chameleon.html2
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.html418
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java (renamed from uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java)15
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUITest.java241
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableMultiSelectSimple-chameleon.html2
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableRowHeight2.html57
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableRowHeight2.java13
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableRowHeight2Test.java52
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRow.java167
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRowTest.java105
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableTooltips.html91
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html47
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java12
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissingTest.java53
-rw-r--r--uitest/src/com/vaadin/tests/components/textarea/TextAreaSizeResetted.java111
-rw-r--r--uitest/src/com/vaadin/tests/components/textarea/TextAreaSizeResettedTest.java127
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/DisappearingComponents.html32
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/DisappearingComponents.java15
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/DisappearingComponentsTest.java48
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.html357
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUI.java (renamed from uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.java)8
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUITest.java143
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.html37
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java14
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSyncTest.java61
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemText.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java90
-rw-r--r--uitest/src/com/vaadin/tests/components/window/BottomComponentScrollsUp.java103
-rw-r--r--uitest/src/com/vaadin/tests/components/window/BottomComponentScrollsUpTest.java71
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java95
-rw-r--r--uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java7
-rw-r--r--uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutWidthChangeTest.java3
-rw-r--r--uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java54
-rw-r--r--uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumnsTest.java50
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMove.java2
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMove.java1
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HCaption.java1
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutExpandTest.java1
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegErrorTest.java1
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizingTest.java1
-rw-r--r--uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/push/PushConfigurationLongPollingTest.java3
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/push/ReconnectLongPollingTest.java1
-rwxr-xr-xuitest/src/com/vaadin/tests/push/ReconnectStreamingTest.java1
-rw-r--r--uitest/src/com/vaadin/tests/push/RefreshCloseConnection.java61
-rw-r--r--uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java44
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java125
-rw-r--r--uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java25
-rw-r--r--uitest/src/com/vaadin/tests/tb3/TB3Runner.java37
-rw-r--r--uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFly.java109
-rw-r--r--uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java121
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Accordions.java15
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java29
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java55
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java4
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java49
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Forms.java14
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ImmediateUpload.java71
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java73
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/MenuBars.java6
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Panels.java21
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/StringGenerator.java32
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Tables.java36
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java9
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/TestIcon.java21
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/TextFields.java24
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Trees.java8
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java8
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java (renamed from uitest/src/com/vaadin/tests/themes/valo/ValoThemeTest.java)69
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java3
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/TooltipInWindow.java (renamed from uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java)15
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/TooltipInWindowTest.java66
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/superText/ExtraSuperTextAreaConnector.java15
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/superText/ExtraSuperTextAreaState.java7
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/superText/SuperTextAreaConnector.java19
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/superText/SuperTextAreaState.java11
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/ExtraSuperTextArea.java16
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/OverriddenDecendants.java67
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/OverriddenDecendantsTest.java50
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/SuperTextArea.java16
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/gwtrpc/GwtRpcTest.java2
129 files changed, 4613 insertions, 2010 deletions
diff --git a/uitest/src/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java b/uitest/src/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java
new file mode 100644
index 0000000000..2ab6be25ac
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2000-2014 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.accessibility;
+
+import java.util.Stack;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.window.WindowRole;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Window;
+
+/**
+ * UI to test if subwindows get the correct assistive roles.
+ *
+ * @author Vaadin Ltd
+ */
+public class WindowWaiAriaRoles extends AbstractTestUI {
+ Stack<Window> windows = new Stack<Window>();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+ Button closeButton = new Button("Close windows");
+ closeButton.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ while (!windows.isEmpty()) {
+ Window window = windows.pop();
+ removeWindow(window);
+ }
+ }
+
+ });
+
+ Button regularButton = new Button("Regular");
+ regularButton.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Window regularWindow = new Window("Regular window");
+ openWindow(regularWindow);
+ }
+ });
+
+ Button alertButton = new Button("Alert");
+ alertButton.addClickListener(new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Window alertWindow = new Window("Alert window");
+ alertWindow.setAssistiveRole(WindowRole.ALERTDIALOG);
+ openWindow(alertWindow);
+ }
+ });
+ addComponent(closeButton);
+ addComponent(regularButton);
+ addComponent(alertButton);
+ }
+
+ void openWindow(Window window) {
+ windows.push(window);
+ window.center();
+ addWindow(window);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "The alert window should have the role 'alertdialog' and the regular window should have the role 'dialog'";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 14289;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/accessibility/WindowWaiAriaRolesTest.java b/uitest/src/com/vaadin/tests/accessibility/WindowWaiAriaRolesTest.java
new file mode 100644
index 0000000000..e1d0452708
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/accessibility/WindowWaiAriaRolesTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2000-2014 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.accessibility;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.WindowElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Test to see if regular and alert windows get the correct wai-aria roles
+ *
+ * @author Vaadin Ltd
+ */
+public class WindowWaiAriaRolesTest extends MultiBrowserTest {
+
+ @Test
+ public void testRegularWindowRole() {
+ openTestURL();
+
+ $(ButtonElement.class).caption("Regular").first().click();
+ String role = getWindowRole();
+ Assert.assertTrue("Dialog has incorrect role '" + role
+ + "', expected 'dialog'", "dialog".equals(role));
+ }
+
+ @Test
+ public void testAlertWindowRole() {
+ openTestURL();
+ $(ButtonElement.class).caption("Alert").first().click();
+ String role = getWindowRole();
+ Assert.assertTrue("Dialog has incorrect role '" + role
+ + "', expected 'alertdialog'", "alertdialog".equals(role));
+ }
+
+ public String getWindowRole() {
+ return $(WindowElement.class).first().getAttribute("role");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/abstractcomponent/PrimaryStyleTest.java b/uitest/src/com/vaadin/tests/components/abstractcomponent/PrimaryStyleTest.java
index ce99c4a3d5..8500fbe18d 100644
--- a/uitest/src/com/vaadin/tests/components/abstractcomponent/PrimaryStyleTest.java
+++ b/uitest/src/com/vaadin/tests/components/abstractcomponent/PrimaryStyleTest.java
@@ -43,7 +43,8 @@ public class PrimaryStyleTest extends MultiBrowserTest {
$(ButtonElement.class).id("update-button").click();
// Verify that the class names where updated as expected.
- List<WebElement> updatedElements = driver.findElements(By.className("updated-correctly"));
+ List<WebElement> updatedElements = driver.findElements(By
+ .className("updated-correctly"));
assertThat(updatedElements, hasSize(initialElements.size()));
}
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java
index 25dd469903..cee71fdf4e 100644
--- a/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java
@@ -35,4 +35,4 @@ public class ButtonToggleIcons extends UI {
layout.addComponent(new Button("Toggle icon", iconToggleListener));
layout.addComponent(new NativeButton("Toggle icon", iconToggleListener));
}
-}
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.html b/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.html
deleted file mode 100644
index 0aaa01f05b..0000000000
--- a/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.html
+++ /dev/null
@@ -1,82 +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>ButtonUndefinedWidth</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">ButtonUndefinedWidth</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.button.ButtonUndefinedWidth</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VNativeButton[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VNativeButton[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[2]</td>
- <td>636,149</td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>1</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.java b/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.java
index 89b03df92a..e8a2e10d9a 100644
--- a/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.java
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.java
@@ -1,15 +1,22 @@
package com.vaadin.tests.components.button;
import com.vaadin.data.Item;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.NativeButton;
import com.vaadin.ui.Table;
-public class ButtonUndefinedWidth extends TestBase {
+/**
+ * Test UI for buttons with undefined width.
+ *
+ * @since 7.2
+ * @author Vaadin Ltd
+ */
+public class ButtonUndefinedWidth extends AbstractTestUI {
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "Both the button outside the table and inside the table should be only as wide as necessary. There should be empty space in the table to the right of the button.";
}
@@ -18,8 +25,9 @@ public class ButtonUndefinedWidth extends TestBase {
return 3257;
}
+ @SuppressWarnings("unchecked")
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
Button b = new Button("Undefined wide");
addComponent(b);
NativeButton b2 = new NativeButton("Undefined wide");
@@ -36,5 +44,4 @@ public class ButtonUndefinedWidth extends TestBase {
addComponent(t);
}
-
}
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidthTest.java b/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidthTest.java
new file mode 100644
index 0000000000..850dd1229c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonUndefinedWidthTest.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2000-2014 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.button;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.NativeButtonElement;
+import com.vaadin.testbench.elements.VerticalLayoutElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Validates button Widths for Buttons or Native Buttons, inside or outside
+ * tables.
+ *
+ * @since 7.2
+ * @author Vaadin Ltd
+ */
+public class ButtonUndefinedWidthTest extends MultiBrowserTest {
+
+ @Test
+ public void undefinedButtonWidthTest() throws Exception {
+ openTestURL();
+
+ // make sure all the elements are rendered before commencing tests
+ waitForElementVisible(By.className("v-table-row-odd"));
+
+ // click all of the buttons
+ for (NativeButtonElement button : $(NativeButtonElement.class).all()) {
+ button.click();
+ }
+ for (ButtonElement button : $(ButtonElement.class).all()) {
+ button.click();
+ }
+
+ // remove focus
+ getDriver().findElement(By.className("v-app")).click();
+
+ // check button widths in VerticalLayout
+ VerticalLayoutElement vLayout = $(VerticalLayoutElement.class).$(
+ VerticalLayoutElement.class).first();
+ int containerWidth = vLayout.getSize().getWidth();
+
+ NativeButtonElement nativeButton = vLayout.$(NativeButtonElement.class)
+ .first();
+ int buttonWidth = nativeButton.getSize().getWidth();
+
+ assertButtonWidth(buttonWidth, containerWidth);
+
+ ButtonElement button = vLayout.$(ButtonElement.class).first();
+ buttonWidth = button.getSize().getWidth();
+ assertButtonWidth(buttonWidth, containerWidth);
+
+ // check button widths in table, also make sure that there is some
+ // spacing between the table edges and buttons
+ List<WebElement> rows = findElements(By
+ .className("v-table-cell-content"));
+ int rowWidth = rows.get(0).getSize().getWidth();
+
+ List<WebElement> rowWrappers = findElements(By
+ .className("v-table-cell-wrapper"));
+ WebElement row = rowWrappers.get(0);
+
+ containerWidth = row.getSize().getWidth();
+ assertRowWrapperWidth(containerWidth, rowWidth);
+
+ buttonWidth = row.findElement(By.className("v-button")).getSize()
+ .getWidth();
+ assertButtonWidth(buttonWidth, containerWidth);
+
+ row = rowWrappers.get(1);
+ containerWidth = row.getSize().getWidth();
+ assertRowWrapperWidth(containerWidth, rowWidth);
+
+ buttonWidth = row.findElement(By.className("v-nativebutton")).getSize()
+ .getWidth();
+ assertButtonWidth(buttonWidth, containerWidth);
+
+ }
+
+ private void assertRowWrapperWidth(int wrapperWidth, int rowWidth) {
+ Assert.assertTrue("Wrapper should be narrower than its parent: "
+ + wrapperWidth + " < " + rowWidth, wrapperWidth < rowWidth);
+ }
+
+ private void assertButtonWidth(int buttonWidth, int containerWidth) {
+ Assert.assertTrue("Button should be narrower than its parent: "
+ + buttonWidth + " < " + containerWidth,
+ buttonWidth < containerWidth);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRpcCountTest.java b/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRpcCountTest.java
index 9d6640eb6d..69a919497b 100644
--- a/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRpcCountTest.java
+++ b/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRpcCountTest.java
@@ -40,7 +40,7 @@ public class CheckBoxRpcCountTest extends MultiBrowserTest {
// Click on the actual checkbox.
inputElem.click();
- //Have to use waitUntil to make this test more stable.
+ // Have to use waitUntil to make this test more stable.
waitUntilLabelIsUpdated(countElem, "1 RPC call(s) made.");
// Click on the checkbox label.
@@ -52,7 +52,8 @@ public class CheckBoxRpcCountTest extends MultiBrowserTest {
waitUntilLabelIsUpdated(countElem, "3 RPC call(s) made.");
}
- private void waitUntilLabelIsUpdated(final WebElement countElem, final String expectedText) {
+ private void waitUntilLabelIsUpdated(final WebElement countElem,
+ final String expectedText) {
waitUntil(new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver input) {
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxFiltering.html b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxFiltering.html
deleted file mode 100644
index 3de221871d..0000000000
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxFiltering.html
+++ /dev/null
@@ -1,62 +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.combobox.ComboBoxSlow?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxSlow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>92,19</td>
-</tr>
-<tr>
- <td>enterCharacter</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxSlow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>1</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>filter-no-match</td>
-</tr>
-<tr>
- <td>enterCharacter</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxSlow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>Item 12</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>filter-11-matches-paging</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>filter-11-matches-page-2</td>
-</tr>
-<tr>
- <td>enterCharacter</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxSlow::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>Item 100</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>filter-2-matches-no-paging</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html
deleted file mode 100644
index 3ad7d62a09..0000000000
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.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="" />
-<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.combobox.ComboBoxIdenticalItems?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>66,8</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>down</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>down</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>enter</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::PID_SLog_row_0</td>
- <td>1. Item one-1 selected</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>down</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>down</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>enter</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::PID_SLog_row_0</td>
- <td>2. Item one-2 selected</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>down</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>down</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>enter</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::PID_SLog_row_0</td>
- <td>3. Item two selected</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>up</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>up</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>up</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td>
- <td>enter</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>100</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::PID_SLog_row_0</td>
- <td>4. Item one-1 selected</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.java
index 5f33b96a73..cdae1c8e38 100644
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.java
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.java
@@ -3,16 +3,18 @@ package com.vaadin.tests.components.combobox;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.util.Log;
import com.vaadin.ui.ComboBox;
-public class ComboBoxIdenticalItems extends TestBase {
+public class ComboBoxIdenticalItems extends AbstractTestUI {
private Log log = new Log(5);
+ @SuppressWarnings("unchecked")
@Override
- public void setup() {
+ protected void setup(VaadinRequest request) {
final ComboBox select = new ComboBox("ComboBox");
select.addContainerProperty("caption", String.class, null);
Item item = select.addItem("one-1");
@@ -24,9 +26,7 @@ public class ComboBoxIdenticalItems extends TestBase {
select.setItemCaptionPropertyId("caption");
select.setNullSelectionAllowed(false);
select.setImmediate(true);
- select.addListener(new Property.ValueChangeListener() {
- private static final long serialVersionUID = -7932700771673919620L;
-
+ select.addValueChangeListener(new Property.ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
log.log("Item " + select.getValue() + " selected");
@@ -39,7 +39,7 @@ public class ComboBoxIdenticalItems extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "Keyboard selecting of a value is broken in combobox if two "
+ "items have the same caption. The first item's id is \"One-1\" "
+ "while the second one is \"One-2\". Selecting with mouse works "
@@ -49,7 +49,6 @@ public class ComboBoxIdenticalItems extends TestBase {
@Override
protected Integer getTicketNumber() {
- // TODO Auto-generated method stub
- return null;
+ return 6125;
}
}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxIdenticalItemsTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxIdenticalItemsTest.java
new file mode 100644
index 0000000000..d2cb80ae67
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxIdenticalItemsTest.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2000-2014 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.combobox;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * @author Vaadin Ltd
+ */
+public class ComboBoxIdenticalItemsTest extends MultiBrowserTest {
+
+ private WebElement select;
+
+ /* This test has been directly ported from a TB2 test */
+ @Test
+ public void identicalItemsKeyboardTest() throws Exception {
+ openTestURL();
+
+ // wait for the UI to be fully loaded
+ waitForElementVisible(By.className("v-filterselect"));
+ waitForElementVisible(By.id("Log"));
+
+ select = findElement(By
+ .vaadin("/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]"));
+ select.click();
+
+ Keys[] downDownEnter = new Keys[] { Keys.ARROW_DOWN, Keys.ARROW_DOWN,
+ Keys.ENTER };
+ sendKeys(downDownEnter);
+ assertLogText("1. Item one-1 selected");
+
+ sendKeys(downDownEnter);
+ assertLogText("2. Item one-2 selected");
+
+ sendKeys(downDownEnter);
+ assertLogText("3. Item two selected");
+
+ sendKeys(new Keys[] { Keys.ARROW_UP, Keys.ARROW_UP, Keys.ARROW_UP,
+ Keys.ENTER });
+ assertLogText("4. Item one-1 selected");
+ }
+
+ private void assertLogText(String expected) throws Exception {
+ String text = findElement(By.vaadin("PID_SLog_row_0")).getText();
+ Assert.assertTrue("Expected '" + expected + "' found '" + text + "'",
+ text.equals(expected));
+ }
+
+ private void sendKeys(Keys[] keys) throws Exception {
+ for (Keys key : keys) {
+ select.sendKeys(key);
+ // wait a while between the key presses, at least PhantomJS fails if
+ // they are sent too fast
+ sleep(10);
+ }
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInputPromptTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInputPromptTest.java
index 96151022ff..cbd83c5734 100644
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInputPromptTest.java
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInputPromptTest.java
@@ -40,13 +40,16 @@ public class ComboBoxInputPromptTest extends MultiBrowserTest {
ComboBoxElement disabledComboBox = getComboBoxWithCaption("Disabled");
ComboBoxElement readOnlyComboBox = getComboBoxWithCaption("Read-only");
- assertThat(getInputPromptValue(normalComboBox), is("Normal input prompt"));
+ assertThat(getInputPromptValue(normalComboBox),
+ is("Normal input prompt"));
assertThat(getInputPromptValue(disabledComboBox), isEmptyString());
assertThat(getInputPromptValue(readOnlyComboBox), isEmptyString());
toggleDisabledAndReadonly();
- assertThat(getInputPromptValue(disabledComboBox), is("Disabled input prompt"));
- assertThat(getInputPromptValue(readOnlyComboBox), is("Read-only input prompt"));
+ assertThat(getInputPromptValue(disabledComboBox),
+ is("Disabled input prompt"));
+ assertThat(getInputPromptValue(readOnlyComboBox),
+ is("Read-only input prompt"));
toggleDisabledAndReadonly();
assertThat(getInputPromptValue(disabledComboBox), isEmptyString());
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxOnSmallScreen.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxOnSmallScreen.java
new file mode 100644
index 0000000000..044214cecf
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxOnSmallScreen.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2000-2014 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.combobox;
+
+import com.vaadin.data.Item;
+import com.vaadin.server.ClassResource;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.ComboBox;
+
+/**
+ * Test UI for issue #11929 where ComboBox suggestion popup hides the ComboBox
+ * itself obscuring the text input field.
+ *
+ * @author Vaadin Ltd
+ */
+public class ComboBoxOnSmallScreen extends AbstractTestUI {
+
+ private static final String PID = "captionPID";
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ addComponents(createComboBox());
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Combobox hides what you are typing on small screen";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 11929;
+ }
+
+ private ComboBox createComboBox() {
+ ComboBox cb = new ComboBox();
+ cb.addContainerProperty(PID, String.class, "");
+ cb.setItemCaptionPropertyId(PID);
+
+ Object selectId = null;
+
+ for (int i = 1; i < 22; ++i) {
+ final String v = "Item #" + i;
+ Object itemId = cb.addItem();
+
+ if (i == 9) {
+ selectId = itemId;
+ }
+
+ Item item = cb.getItem(itemId);
+ item.getItemProperty(PID).setValue(v);
+ int flagIndex = i % 3;
+ cb.setItemIcon(itemId, new ClassResource(
+ flagIndex == 0 ? "fi_small.png" : flagIndex == 1 ? "fi.gif"
+ : "se.gif"));
+ }
+
+ cb.select(selectId);
+
+ return cb;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxOnSmallScreenTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxOnSmallScreenTest.java
new file mode 100644
index 0000000000..f48f2bbdeb
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxOnSmallScreenTest.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2000-2014 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.combobox;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Dimension;
+import org.openqa.selenium.WebDriver.Window;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.client.ui.VFilterSelect;
+import com.vaadin.testbench.elements.ComboBoxElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * ComboBox suggestion popup should not obscure the text input box.
+ *
+ * @author Vaadin Ltd
+ */
+public class ComboBoxOnSmallScreenTest extends MultiBrowserTest {
+
+ private static final Dimension TARGETSIZE = new Dimension(600, 300);
+ private static final String POPUPCLASSNAME = VFilterSelect.CLASSNAME
+ + "-suggestpopup";
+
+ ComboBoxElement combobox;
+ WebElement popup;
+
+ @Override
+ public void setup() throws Exception {
+ super.setup();
+
+ openTestURL();
+
+ getWindow().setSize(TARGETSIZE);
+
+ combobox = $(ComboBoxElement.class).first();
+ combobox.openPopup();
+
+ popup = findElement(By.className(POPUPCLASSNAME));
+ }
+
+ @Test
+ public void testSuggestionPopupOverlayPosition() {
+ final int popupTop = popup.getLocation().y;
+ final int popupBottom = popupTop + popup.getSize().getHeight();
+ final int cbTop = combobox.getLocation().y;
+ final int cbBottom = cbTop + combobox.getSize().getHeight();
+
+ assertThat("Popup overlay overlaps with the textbox",
+ popupTop >= cbBottom || popupBottom <= cbTop, is(true));
+ }
+
+ @Test
+ public void testSuggestionPopupOverlaySize() {
+ final int popupTop = popup.getLocation().y;
+ final int popupBottom = popupTop + popup.getSize().getHeight();
+ final int rootHeight = findElement(By.tagName("body")).getSize().height;
+
+ assertThat("Popup overlay out of the screen", popupTop < 0
+ || popupBottom > rootHeight, is(false));
+ }
+
+ private Window getWindow() {
+ return getDriver().manage().window();
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxScrollingWithArrowsTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxScrollingWithArrowsTest.java
index fa6f5a3a93..bc1fe39fe5 100644
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxScrollingWithArrowsTest.java
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxScrollingWithArrowsTest.java
@@ -52,8 +52,7 @@ public class ComboBoxScrollingWithArrowsTest extends MultiBrowserTest {
// provide any way to access the popup and send keys to it.
// Ticket #13756
- return driver.findElement(By
- .className("v-filterselect-input"));
+ return driver.findElement(By.className("v-filterselect-input"));
}
private void openPopup() {
@@ -70,7 +69,7 @@ public class ComboBoxScrollingWithArrowsTest extends MultiBrowserTest {
dropDownComboBox.sendKeys(Keys.DOWN);
}
- assertThat(getSelectedItemText(), is("item " + PAGESIZE)); //item 10
+ assertThat(getSelectedItemText(), is("item " + PAGESIZE)); // item 10
}
private String getSelectedItemText() {
@@ -92,7 +91,8 @@ public class ComboBoxScrollingWithArrowsTest extends MultiBrowserTest {
waitUntilNextPageIsVisible();
dropDownComboBox.sendKeys(Keys.UP);
- assertThat(getSelectedItemText(), is("item " + (PAGESIZE - 1))); //item 9
+ assertThat(getSelectedItemText(), is("item " + (PAGESIZE - 1))); // item
+ // 9
}
private void waitUntilNextPageIsVisible() {
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSlowTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSlowTest.java
new file mode 100644
index 0000000000..f030c0f5a0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSlowTest.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2000-2014 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.combobox;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Verifies SlowComboBox filtering works when user inputs text. Also verifies
+ * pagination works when the matching results number more than those that can be
+ * displayed.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class ComboBoxSlowTest extends MultiBrowserTest {
+
+ @Before
+ public void init() {
+ openTestURL();
+ }
+
+ @Test
+ public void testZeroMatches() throws InterruptedException {
+ clickComboBoxTextArea();
+ sleep(250);
+ typeString("1");
+ assertEquals(0, getNumberOfSuggestions());
+ }
+
+ @Test
+ public void testElevenMatchesAndPaging() throws InterruptedException {
+ clickComboBoxTextArea();
+ sleep(250);
+ typeString("Item 12");
+
+ assertEquals(10, getNumberOfSuggestions());
+ assertTrue(isPagingActive());
+ goToNextPage();
+
+ sleep(500);
+ assertEquals(1, getNumberOfSuggestions());
+
+ }
+
+ @Test
+ public void testTwoMatchesNoPaging() {
+ clickComboBoxTextArea();
+ typeString("Item 100");
+ assertEquals(2, getNumberOfSuggestions());
+ assertFalse(isPagingActive());
+ }
+
+ private void clickComboBoxTextArea() {
+ WebElement cb = getDriver().findElement(
+ By.className("v-filterselect-input"));
+ cb.click();
+ }
+
+ private void typeString(String s) {
+ Actions action = new Actions(getDriver());
+ action.sendKeys(s);
+ action.build().perform();
+ }
+
+ private int getNumberOfSuggestions() {
+
+ List<WebElement> elements = getDriver().findElements(
+ By.className("gwt-MenuItem"));
+ return elements.size();
+ }
+
+ private boolean isPagingActive() {
+ List<WebElement> elements = getDriver().findElements(
+ By.className("v-filterselect-nextpage"));
+ return elements.size() == 1;
+ }
+
+ private void goToNextPage() {
+ WebElement nextPage = getDriver().findElement(
+ By.className("v-filterselect-nextpage"));
+ nextPage.click();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxUndefinedWidthAndIcon.html b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxUndefinedWidthAndIcon.html
index ae0dfec828..8366f2dc8c 100644
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxUndefinedWidthAndIcon.html
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxUndefinedWidthAndIcon.html
@@ -1,3 +1,16 @@
+<?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.components.combobox.ComboBoxUndefinedWidthAndIcon?restartApplication</td>
@@ -83,3 +96,6 @@
<td></td>
<td>item33-selected-after-popup-opened-and-closed</td>
</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/combobox/fi.png b/uitest/src/com/vaadin/tests/components/combobox/fi.png
new file mode 100644
index 0000000000..976a9663ce
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/fi.png
Binary files differ
diff --git a/uitest/src/com/vaadin/tests/components/combobox/fi_small.png b/uitest/src/com/vaadin/tests/components/combobox/fi_small.png
new file mode 100644
index 0000000000..2908973fa4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/fi_small.png
Binary files differ
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java
new file mode 100644
index 0000000000..9dbd8fa6dc
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2000-2014 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.datefield;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.PopupDateField;
+
+public class DateFieldChangeResolution extends AbstractTestUI {
+
+ public static final String DATEFIELD_ID = "datefield";
+ // The ID of a button is BUTTON_BASE_ID + resolution, e.g. button-month
+ public static final String BUTTON_BASE_ID = "button-";
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final DateField dateField = new PopupDateField("Enter date");
+ dateField.setResolution(Resolution.YEAR);
+ dateField.setId(DATEFIELD_ID);
+ dateField.setImmediate(true);
+ addComponent(dateField);
+
+ Label l = new Label("Select resolution");
+ addComponent(l);
+ HorizontalLayout hlayout = new HorizontalLayout();
+ addComponent(hlayout);
+ for (final Resolution value : Resolution.values()) {
+ String resolutionString = value.toString().toLowerCase();
+ Button b = new Button(resolutionString);
+ b.addClickListener(new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ dateField.setResolution(value);
+ }
+ });
+ b.setId(BUTTON_BASE_ID + resolutionString);
+ hlayout.addComponent(b);
+ }
+
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "The calendar should always have the correct resolution and the text field should be empty before selecting a date.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14174;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java
new file mode 100644
index 0000000000..6820410059
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2000-2014 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.datefield;
+
+import static com.vaadin.tests.components.datefield.DateFieldChangeResolution.BUTTON_BASE_ID;
+import static com.vaadin.tests.components.datefield.DateFieldChangeResolution.DATEFIELD_ID;
+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 com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class DateFieldChangeResolutionTest extends MultiBrowserTest {
+
+ private WebElement dateFieldButton, textField;
+ private WebElement resolutionSecond, resolutionMinute, resolutionHour,
+ resolutionDay, resolutionMonth, resolutionYear;
+
+ @Test
+ public void changeResolutionBetweenYearAndMonth() throws Exception {
+ initialize();
+ click(resolutionMonth);
+ checkHeaderAndBody(Resolution.MONTH, true);
+ click(resolutionYear);
+ checkHeaderAndBody(Resolution.YEAR, true);
+ }
+
+ @Test
+ public void changeResolutionBetweenYearAndSecond() throws Exception {
+ initialize();
+ click(resolutionSecond);
+ checkHeaderAndBody(Resolution.SECOND, true);
+ click(resolutionYear);
+ checkHeaderAndBody(Resolution.YEAR, true);
+ }
+
+ @Test
+ public void changeResolutionToDayThenMonth() throws Exception {
+ initialize();
+ checkHeaderAndBody(Resolution.YEAR, true); // check the initial state
+ click(resolutionDay);
+ checkHeaderAndBody(Resolution.DAY, true);
+ click(resolutionMonth);
+ checkHeaderAndBody(Resolution.MONTH, true);
+ }
+
+ @Test
+ public void setDateAndChangeResolution() throws Exception {
+ initialize();
+ // Set the date to previous month.
+ click(resolutionMonth);
+ openPopupDateField();
+ click(driver.findElement(By.className("v-button-prevmonth")));
+ closePopupDateField();
+ assertFalse(
+ "The text field of the calendar should not be empty after selecting a date",
+ textField.getAttribute("value").isEmpty());
+ // Change resolutions and check that the selected date is not lost and
+ // that the calendar has the correct resolution.
+ click(resolutionHour);
+ checkHeaderAndBody(Resolution.HOUR, false);
+ click(resolutionYear);
+ checkHeaderAndBody(Resolution.YEAR, false);
+ click(resolutionMinute);
+ checkHeaderAndBody(Resolution.MINUTE, false);
+ }
+
+ private void initialize() {
+ openTestURL();
+ WebElement dateField = driver.findElement(By.id(DATEFIELD_ID));
+ dateFieldButton = dateField.findElement(By
+ .className("v-datefield-button"));
+ textField = dateField
+ .findElement(By.className("v-datefield-textfield"));
+ resolutionSecond = driver.findElement(By.id(BUTTON_BASE_ID + "second"));
+ resolutionMinute = driver.findElement(By.id(BUTTON_BASE_ID + "minute"));
+ resolutionHour = driver.findElement(By.id(BUTTON_BASE_ID + "hour"));
+ resolutionDay = driver.findElement(By.id(BUTTON_BASE_ID + "day"));
+ resolutionMonth = driver.findElement(By.id(BUTTON_BASE_ID + "month"));
+ resolutionYear = driver.findElement(By.id(BUTTON_BASE_ID + "year"));
+ }
+
+ private void checkHeaderAndBody(Resolution resolution,
+ boolean textFieldIsEmpty) {
+ // Open the popup calendar, perform checks and close the popup.
+ openPopupDateField();
+ if (resolution.getCalendarField() >= Resolution.MONTH
+ .getCalendarField()) {
+ checkMonthHeader();
+ } else {
+ checkYearHeader();
+ }
+ if (resolution.getCalendarField() >= Resolution.DAY.getCalendarField()) {
+ assertTrue(
+ "A calendar with the chosen resolution should have a body",
+ calendarHasBody());
+ } else {
+ assertFalse(
+ "A calendar with the chosen resolution should not have a body",
+ calendarHasBody());
+ }
+ if (textFieldIsEmpty) {
+ assertTrue("The text field of the calendar should be empty",
+ textField.getAttribute("value").isEmpty());
+ } else {
+ assertFalse("The text field of the calendar should not be empty",
+ textField.getAttribute("value").isEmpty());
+ }
+ closePopupDateField();
+ }
+
+ private void checkMonthHeader() {
+ checkHeaderForYear();
+ checkHeaderForMonth(true);
+ }
+
+ private void checkYearHeader() {
+ checkHeaderForYear();
+ checkHeaderForMonth(false);
+ }
+
+ private boolean calendarHasBody() {
+ return isElementPresent(By.className("v-datefield-calendarpanel-body"));
+ }
+
+ private void checkHeaderForMonth(boolean buttonsExpected) {
+ // If buttonsExpected is true, check that there are buttons for changing
+ // the month. Otherwise check that there are no such buttons.
+ if (buttonsExpected) {
+ assertTrue(
+ "The calendar should have a button for switching to the previous month",
+ isElementPresent(By
+ .cssSelector(".v-datefield-calendarpanel-header .v-datefield-calendarpanel-prevmonth .v-button-prevmonth")));
+ assertTrue(
+ "The calendar should have a button for switching to the next month",
+ isElementPresent(By
+ .cssSelector(".v-datefield-calendarpanel-header .v-datefield-calendarpanel-nextmonth .v-button-nextmonth")));
+ } else {
+ assertFalse(
+ "The calendar should not have a button for switching to the previous month",
+ isElementPresent(By
+ .cssSelector(".v-datefield-calendarpanel-header .v-datefield-calendarpanel-prevmonth .v-button-prevmonth")));
+ assertFalse(
+ "The calendar should not have a button for switching to the next month",
+ isElementPresent(By
+ .cssSelector(".v-datefield-calendarpanel-header .v-datefield-calendarpanel-nextmonth .v-button-nextmonth")));
+ }
+ }
+
+ private void checkHeaderForYear() {
+ assertTrue(
+ "The calendar should have a button for switching to the previous year",
+ isElementPresent(By
+ .cssSelector(".v-datefield-calendarpanel-header .v-datefield-calendarpanel-prevyear .v-button-prevyear")));
+ assertTrue(
+ "The calendar header should show the selected year",
+ isElementPresent(By
+ .cssSelector(".v-datefield-calendarpanel-header .v-datefield-calendarpanel-month")));
+ assertTrue(
+ "The calendar should have a button for switching to the next year",
+ isElementPresent(By
+ .cssSelector(".v-datefield-calendarpanel-header .v-datefield-calendarpanel-nextyear .v-button-nextyear")));
+
+ }
+
+ private void click(WebElement element) {
+ testBenchElement(element).click(5, 5);
+ }
+
+ private void openPopupDateField() {
+ click(dateFieldButton);
+ }
+
+ private void closePopupDateField() {
+ WebElement element = driver.findElement(By
+ .cssSelector(".v-datefield-calendarpanel"));
+ element.sendKeys(Keys.ESCAPE);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldClose.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldClose.java
new file mode 100644
index 0000000000..9ce190a293
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldClose.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2014 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.datefield;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.DateField;
+
+public class DateFieldClose extends AbstractTestUI {
+
+ static final String DATEFIELD_ID = "datefield";
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final DateField df = new DateField();
+ df.setId(DATEFIELD_ID);
+ addComponent(df);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "A click on the button should open a calendar and a second click should close it.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14086;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldCloseTest.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldCloseTest.java
new file mode 100644
index 0000000000..e6f7520813
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldCloseTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2000-2014 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.datefield;
+
+import static com.vaadin.tests.components.datefield.DateFieldClose.DATEFIELD_ID;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class DateFieldCloseTest extends MultiBrowserTest {
+ private WebElement dateField;
+
+ @Test
+ public void closeByClickingCalendarButton() throws Exception {
+ openTestURL();
+ dateField = driver.findElement(By.id(DATEFIELD_ID));
+ clickButton();
+ checkForCalendarHeader(true);
+ closePopup();
+ checkForCalendarHeader(false);
+ }
+
+ private void checkForCalendarHeader(boolean headerShouldExist) {
+ boolean headerExists = isElementPresent(By
+ .className("v-datefield-calendarpanel-header"));
+ if (headerShouldExist) {
+ assertTrue("The calendar should be visible", headerExists);
+ } else {
+ assertFalse("The calendar should not be visible", headerExists);
+ }
+ }
+
+ private void clickButton() {
+ WebElement dateFieldButton = dateField.findElement(By
+ .className("v-datefield-button"));
+ testBenchElement(dateFieldButton).click(5, 5);
+ }
+
+ private void closePopup() {
+ WebElement dateFieldButton = dateField.findElement(By
+ .className("v-datefield-button"));
+ // To work reliably with IE, need to click and hold instead of just
+ // clicking the button.
+ Actions actions = new Actions(driver);
+ actions.clickAndHold(dateFieldButton).perform();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_MonthChangeMeansFocusDayRolledInsideRange.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_MonthChangeMeansFocusDayRolledInsideRange.html
index 6e1ca024cb..1135c650f5 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_MonthChangeMeansFocusDayRolledInsideRange.html
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_MonthChangeMeansFocusDayRolledInsideRange.html
@@ -1,3 +1,16 @@
+<?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.datefield.DateFieldRanges</td>
@@ -98,3 +111,6 @@
<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr/td[3]/span</td>
<td>February 2010</td>
</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnlyTest.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnlyTest.java
index 289a5988ee..cfab13e205 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnlyTest.java
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnlyTest.java
@@ -1,6 +1,5 @@
package com.vaadin.tests.components.datefield;
-
import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.DateFieldElement;
@@ -14,7 +13,8 @@ import java.io.IOException;
public class DateFieldReadOnlyTest extends MultiBrowserTest {
@Test
- public void readOnlyDateFieldPopupShouldNotOpen() throws IOException, InterruptedException {
+ public void readOnlyDateFieldPopupShouldNotOpen() throws IOException,
+ InterruptedException {
openTestURL();
compareScreen("initial");
@@ -29,12 +29,15 @@ public class DateFieldReadOnlyTest extends MultiBrowserTest {
}
private void closePopup() {
- findElement(By.className("v-datefield-calendarpanel")).sendKeys(Keys.RETURN);
+ findElement(By.className("v-datefield-calendarpanel")).sendKeys(
+ Keys.RETURN);
}
private void openPopup() {
- //waiting for openPopup() in TB4 beta1: http://dev.vaadin.com/ticket/13766
- $(DateFieldElement.class).first().findElement(By.tagName("button")).click();
+ // waiting for openPopup() in TB4 beta1:
+ // http://dev.vaadin.com/ticket/13766
+ $(DateFieldElement.class).first().findElement(By.tagName("button"))
+ .click();
}
private void toggleReadOnly() {
diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayoutTest.java b/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayoutTest.java
index eb4888ea1a..95152e1416 100644
--- a/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayoutTest.java
+++ b/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayoutTest.java
@@ -9,7 +9,8 @@ import java.io.IOException;
import static org.junit.Assert.*;
-public class MoveComponentsFromGridLayoutToInnerLayoutTest extends MultiBrowserTest {
+public class MoveComponentsFromGridLayoutToInnerLayoutTest extends
+ MultiBrowserTest {
@Test
public void buttonIsMovedInsideInnerLayout() throws IOException {
diff --git a/uitest/src/com/vaadin/tests/components/label/LabelTooltip-chameleon.html b/uitest/src/com/vaadin/tests/components/label/LabelTooltip-chameleon.html
index 4a724795b3..8a042ede92 100644
--- a/uitest/src/com/vaadin/tests/components/label/LabelTooltip-chameleon.html
+++ b/uitest/src/com/vaadin/tests/components/label/LabelTooltip-chameleon.html
@@ -13,7 +13,7 @@
</thead><tbody>
<tr>
<td>open</td>
- <td>/run/com.vaadin.tests.components.label.LabelTooltip?restartApplication&theme=chameleon</td>
+ <td>/run/com.vaadin.tests.components.label.LabelTooltip?restartApplication&amp;theme=chameleon</td>
<td></td>
</tr>
<tr>
diff --git a/uitest/src/com/vaadin/tests/components/label/LabelTooltip-runo.html b/uitest/src/com/vaadin/tests/components/label/LabelTooltip-runo.html
index 9877493b3b..34fb088ff9 100644
--- a/uitest/src/com/vaadin/tests/components/label/LabelTooltip-runo.html
+++ b/uitest/src/com/vaadin/tests/components/label/LabelTooltip-runo.html
@@ -13,7 +13,7 @@
</thead><tbody>
<tr>
<td>open</td>
- <td>/run/com.vaadin.tests.components.label.LabelTooltip?restartApplication&theme=runo</td>
+ <td>/run/com.vaadin.tests.components.label.LabelTooltip?restartApplication&amp;theme=runo</td>
<td></td>
</tr>
<tr>
diff --git a/uitest/src/com/vaadin/tests/components/menubar/MenuTooltipTest.java b/uitest/src/com/vaadin/tests/components/menubar/MenuTooltipTest.java
index bb8f87daaa..24025b9f39 100644
--- a/uitest/src/com/vaadin/tests/components/menubar/MenuTooltipTest.java
+++ b/uitest/src/com/vaadin/tests/components/menubar/MenuTooltipTest.java
@@ -47,7 +47,8 @@ public class MenuTooltipTest extends MultiBrowserTest {
public void testToolTipDelay() throws InterruptedException {
openTestURL();
- Coordinates elementCoordinates = getCoordinates($(MenuBarElement.class).first());
+ Coordinates elementCoordinates = getCoordinates($(MenuBarElement.class)
+ .first());
Mouse mouse = ((HasInputDevices) getDriver()).getMouse();
diff --git a/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonClick.java b/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonClick.java
new file mode 100644
index 0000000000..b6c80aea0c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonClick.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2000-2014 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.nativebutton;
+
+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.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.NativeButton;
+
+/**
+ * UI used to validate click coordinates reported from clicks on NativeButton
+ * elements.
+ *
+ * @author Vaadin Ltd
+ */
+@SuppressWarnings("serial")
+public class NativeButtonClick extends AbstractTestUI {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Label label1 = new Label("0,0");
+ final Label label2 = new Label("0,0");
+
+ Button button1 = new NativeButton("Button1",
+ new NativeButton.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ label1.setValue(event.getClientX() + ","
+ + event.getClientY());
+ }
+ });
+ Button button2 = new NativeButton("Button2",
+ new NativeButton.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ label2.setValue(event.getClientX() + ","
+ + event.getClientY());
+ }
+ });
+
+ HorizontalLayout layout = new HorizontalLayout();
+ layout.addComponents(button1, button2, label1, label2);
+ layout.setSpacing(true);
+ addComponent(layout);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "Validate click event coordinates not erroneously returned as x=0, y=0";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 14022;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonClickTest.java b/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonClickTest.java
new file mode 100644
index 0000000000..cab2acefff
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/nativebutton/NativeButtonClickTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2000-2014 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.nativebutton;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Test to see if coordinates returned by click event on NativeButtons look
+ * good. (see #14022)
+ *
+ * @author Vaadin Ltd
+ */
+public class NativeButtonClickTest extends MultiBrowserTest {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.tb3.MultiBrowserTest#getBrowsersToTest()
+ */
+
+ @Test
+ public void testClickCoordinates() {
+ openTestURL();
+
+ clickFirstButton();
+ String eventCoordinates = getFirstLabelValue();
+ Assert.assertNotEquals("0,0", eventCoordinates);
+
+ clickSecondButton();
+ eventCoordinates = getSecondLabelValue();
+ Assert.assertNotEquals("0,0", eventCoordinates);
+ }
+
+ private void clickFirstButton() {
+ ButtonElement button = $(ButtonElement.class).first();
+ button.click();
+ }
+
+ private void clickSecondButton() {
+ ButtonElement button = $(ButtonElement.class).get(1);
+ button.click();
+ }
+
+ private String getFirstLabelValue() {
+ LabelElement label = $(LabelElement.class).get(1);
+ return label.getText();
+ }
+
+ private String getSecondLabelValue() {
+ LabelElement label = $(LabelElement.class).get(2);
+ return label.getText();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.html b/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.html
deleted file mode 100644
index fb00953e48..0000000000
--- a/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.html
+++ /dev/null
@@ -1,107 +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>NotificationsWaiAria</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">NotificationsWaiAria</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.notification.NotificationsWaiAria?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>enterCharacter</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTextField[0]</td>
- <td>Prefix:</td>
-</tr>
-<tr>
- <td>enterCharacter</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VTextField[0]</td>
- <td>- press ESC to close</td>
-</tr>
-<tr>
- <td>select</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VNativeSelect[0]/domChild[0]</td>
- <td>label=ALERT</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPresent</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::Root/VNotification[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertAttribute</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::Root/VNotification[0]@role</td>
- <td>alert</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>xpath=//div[@class='v-Notification humanized v-Notification-humanized']//span[@class='v-assistive-device-only'][1]</td>
- <td>Prefix:</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>xpath=//div[@class='v-Notification humanized v-Notification-humanized']//span[@class='v-assistive-device-only'][2]</td>
- <td>- press ESC to close</td>
-</tr>
-<tr>
- <td>closeNotification</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::Root/VNotification[0]</td>
- <td>0,0</td>
-</tr>
-<tr>
- <td>select</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VNativeSelect[0]/domChild[0]</td>
- <td>label=STATUS</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertAttribute</td>
- <td>xpath=/html/body/div[2]/div@role</td>
- <td>status</td>
-</tr>
-<tr>
- <td>closeNotification</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::Root/VNotification[0]</td>
- <td>0,0</td>
-</tr>
-<tr>
- <td>type</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTextField[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VTextField[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestscomponentsnotificationNotificationsWaiAria::Root/VNotification[0]/domChild[0]/domChild[0]/domChild[1]</td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java b/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java
index ecf704835f..e85d60d7c2 100644
--- a/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java
+++ b/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java
@@ -2,8 +2,9 @@ package com.vaadin.tests.components.notification;
import com.vaadin.data.Item;
import com.vaadin.server.Page;
+import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.ui.NotificationRole;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
@@ -16,10 +17,15 @@ import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
-public class NotificationsWaiAria extends TestBase {
+/**
+ * Test UI for different roles of Notifications.
+ *
+ * @since 7.2
+ * @author Vaadin Ltd
+ */
+public class NotificationsWaiAria extends AbstractTestUI {
private static final String CAPTION = "CAPTION";
- private static final String ROLE = "ROLE";
private TextField prefix;
private TextField postfix;
@@ -28,9 +34,9 @@ public class NotificationsWaiAria extends TestBase {
private TextArea tf;
private ComboBox type;
- @SuppressWarnings("deprecation")
+ @SuppressWarnings("unchecked")
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
prefix = new TextField("Prefix", "Info");
addComponent(prefix);
@@ -53,16 +59,16 @@ public class NotificationsWaiAria extends TestBase {
type.setItemCaptionPropertyId(CAPTION);
- Item item = type.addItem(Notification.TYPE_HUMANIZED_MESSAGE);
+ Item item = type.addItem(Notification.Type.HUMANIZED_MESSAGE);
item.getItemProperty(CAPTION).setValue("Humanized");
- item = type.addItem(Notification.TYPE_ERROR_MESSAGE);
+ item = type.addItem(Notification.Type.ERROR_MESSAGE);
item.getItemProperty(CAPTION).setValue("Error");
- item = type.addItem(Notification.TYPE_WARNING_MESSAGE);
+ item = type.addItem(Notification.Type.WARNING_MESSAGE);
item.getItemProperty(CAPTION).setValue("Warning");
- item = type.addItem(Notification.TYPE_TRAY_NOTIFICATION);
+ item = type.addItem(Notification.Type.TRAY_NOTIFICATION);
item.getItemProperty(CAPTION).setValue("Tray");
item = type.addItem(Notification.Type.ASSISTIVE_NOTIFICATION);
@@ -81,13 +87,12 @@ public class NotificationsWaiAria extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "Generic test case for notifications";
}
@Override
protected Integer getTicketNumber() {
- // TODO Auto-generated method stub
return null;
}
@@ -97,13 +102,14 @@ public class NotificationsWaiAria extends TestBase {
Type typeValue = (Type) type.getValue();
Notification n = new Notification(tf.getValue(), typeValue);
+ n.setDelayMsec(-1);
n.setHtmlContentAllowed(true);
NotificationConfiguration notificationConf = UI.getCurrent()
.getNotificationConfiguration();
notificationConf.setAssistivePrefix(typeValue, prefix.getValue());
notificationConf.setAssistivePostfix(typeValue, postfix.getValue());
- notificationConf
- .setAssistiveRole(typeValue, (NotificationRole) role.getValue());
+ notificationConf.setAssistiveRole(typeValue,
+ (NotificationRole) role.getValue());
n.show(Page.getCurrent());
}
@@ -118,4 +124,5 @@ public class NotificationsWaiAria extends TestBase {
n.show(Page.getCurrent());
}
}
+
}
diff --git a/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAriaTest.java b/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAriaTest.java
new file mode 100644
index 0000000000..6b517e9887
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAriaTest.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2000-2014 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.notification;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.shared.ui.ui.NotificationRole;
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.NativeSelectElement;
+import com.vaadin.testbench.elements.NotificationElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Unit test class for Notification ARIA (Accessible Rich Internet Applications)
+ * roles.
+ *
+ * @since 7.2
+ * @author Vaadin Ltd
+ */
+public class NotificationsWaiAriaTest extends MultiBrowserTest {
+
+ /**
+ * Checks if the ARIA roles are correctly applied to Notification.
+ *
+ * @since 7.2
+ * @throws Exception
+ */
+ @Test
+ public void notificationTest() throws Exception {
+ openTestURL();
+
+ TextFieldElement prefix = $(TextFieldElement.class).first();
+ TextFieldElement postfix = $(TextFieldElement.class).get(1);
+ NativeSelectElement type = $(NativeSelectElement.class).first();
+ ButtonElement show = $(ButtonElement.class).first();
+
+ prefix.clear();
+ prefix.sendKeys("Prefix:");
+
+ postfix.clear();
+ postfix.sendKeys("- press ESC to close");
+
+ type.selectByText(NotificationRole.ALERT.toString());
+
+ show.click();
+ waitForElementPresent(By.className("v-Notification"));
+
+ NotificationElement notification = $(NotificationElement.class).first();
+
+ String text = notification.getAttribute("role");
+ Assert.assertTrue("Expected attribute 'role' to equal 'alert', found "
+ + text, text.equals("alert"));
+
+ text = getHiddenText(notification.findElements(
+ By.className("v-assistive-device-only")).get(0));
+ Assert.assertTrue("Expected 'Prefix:', found " + text,
+ text.equals("Prefix:"));
+
+ text = getHiddenText(notification.findElements(
+ By.className("v-assistive-device-only")).get(1));
+ Assert.assertTrue("Expected '- press ESC to close', found " + text,
+ text.equals("- press ESC to close"));
+
+ try {
+ notification.closeNotification();
+ } catch (Exception e) {
+ }
+
+ type.selectByText("STATUS");
+
+ show.click();
+ waitForElementPresent(By.className("v-Notification"));
+
+ notification = $(NotificationElement.class).first();
+
+ text = notification.getAttribute("role");
+ Assert.assertTrue("Expected attribute 'role' to equal 'status', found "
+ + text, text.equals("status"));
+
+ try {
+ notification.closeNotification();
+ } catch (Exception e) {
+ }
+
+ prefix.clear();
+ postfix.clear();
+
+ show.click();
+ waitForElementPresent(By.className("v-Notification"));
+
+ WebElement element;
+ try {
+ element = getDriver()
+ .findElement(
+ By.vaadin("Root/VNotification[0]/domChild[0]/domChild[0]/domChild[1]"));
+ } catch (Exception e) {
+ element = null;
+ }
+ Assert.assertNull(
+ "Notification shouldn't have assistive-device-only spans",
+ element);
+
+ }
+
+ private String getHiddenText(WebElement element) {
+ return (String) getTestBenchCommandExecutor().executeScript(
+ "return arguments[0].innerHTML", element);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/EditableModeChange.html b/uitest/src/com/vaadin/tests/components/table/EditableModeChange.html
deleted file mode 100644
index 6414c9bc03..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/EditableModeChange.html
+++ /dev/null
@@ -1,56 +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.table.EditableModeChange?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableEditableModeChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
- <td>24,8</td>
-</tr>
-<!--Set into editable mode-->
-<tr>
- <td>doubleClick</td>
- <td>vaadin=runcomvaadintestscomponentstableEditableModeChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
- <td>24,8</td>
-</tr>
-<!--Update name for selected row-->
-<tr>
- <td>enterCharacter</td>
- <td>vaadin=runcomvaadintestscomponentstableEditableModeChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]</td>
- <td>baa</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableEditableModeChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
- <td>34,11</td>
-</tr>
-<!--Ensure the name was updated-->
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableEditableModeChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
- <td>baa</td>
-</tr>
-<!--Ensure the correct row is selected-->
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>selected-teemu</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/table/EditableModeChange.java b/uitest/src/com/vaadin/tests/components/table/EditableModeChange.java
index fa8ab8f0f5..e792c90af1 100644
--- a/uitest/src/com/vaadin/tests/components/table/EditableModeChange.java
+++ b/uitest/src/com/vaadin/tests/components/table/EditableModeChange.java
@@ -7,22 +7,24 @@ import java.util.Locale;
import com.vaadin.data.Container;
import com.vaadin.event.ItemClickEvent;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Component;
import com.vaadin.ui.DefaultFieldFactory;
import com.vaadin.ui.Field;
import com.vaadin.ui.Table;
import com.vaadin.ui.TableFieldFactory;
-public class EditableModeChange extends TestBase {
+public class EditableModeChange extends AbstractTestUI {
private ItemClickEvent selectionEvent;
private final String[] names = { "Teemu", "Teppo", "Seppo", "Matti",
"Pekka" };
+ @SuppressWarnings("unchecked")
@Override
- public void setup() {
+ public void setup(VaadinRequest request) {
final Table items = new Table("Items - double-click to edit");
items.setSelectable(true);
@@ -42,7 +44,7 @@ public class EditableModeChange extends TestBase {
.setValue(new FormattedDate(cal.getTime().getTime()));
}
- items.addListener(new ItemClickEvent.ItemClickListener() {
+ items.addItemClickListener(new ItemClickEvent.ItemClickListener() {
@Override
public void itemClick(ItemClickEvent event) {
@@ -89,7 +91,7 @@ public class EditableModeChange extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "Double click a cell to edit, then click on another row to select it (editmode is set to false). The clicked row should now be selected without any flickering.";
}
diff --git a/uitest/src/com/vaadin/tests/components/table/EditableModeChangeTest.java b/uitest/src/com/vaadin/tests/components/table/EditableModeChangeTest.java
new file mode 100644
index 0000000000..56b30dcb7c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/EditableModeChangeTest.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2000-2014 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.assertEquals;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that editing and selecting work correctly.
+ *
+ * @author Vaadin Ltd
+ */
+public class EditableModeChangeTest extends MultiBrowserTest {
+
+ @Test
+ public void testNotification() throws IOException, InterruptedException {
+ openTestURL();
+
+ TableElement table = $(TableElement.class).first();
+
+ // check original value
+ TestBenchElement cell_1_0 = table.getCell(1, 0);
+ assertEquals(
+ "original value not found, wrong cell or contents (1st column of the 2nd row expected)",
+ "Teppo", cell_1_0.getText());
+
+ // double-click to edit cell contents
+ cell_1_0.click();
+ new Actions(getDriver()).doubleClick(cell_1_0).build().perform();
+ sleep(100);
+
+ // fetch the updated cell
+ WebElement textField = table.getCell(1, 0).findElement(
+ By.className("v-textfield"));
+ assertEquals(
+ "original value not found, wrong cell or contents (1st column of the 2nd row expected)",
+ "Teppo", textField.getAttribute("value"));
+
+ // update value
+ textField.clear();
+ textField.sendKeys("baa");
+
+ // click on another row
+ table.getCell(0, 1).click();
+
+ // check the value got updated correctly
+ assertEquals(
+ "updated value not found, wrong cell or contents (1st column of the 2nd row expected)",
+ "baa", table.getCell(1, 0).getText());
+
+ // check that selection got updated correctly
+ List<WebElement> selected = table.findElement(
+ By.className("v-table-body")).findElements(
+ By.className("v-selected"));
+ assertEquals(1, selected.size());
+
+ WebElement content = selected.get(0).findElement(
+ By.className("v-table-cell-wrapper"));
+ assertEquals(
+ "expected value not found, wrong cell or contents (1st column of the 1st row expected)",
+ "Teemu", content.getText());
+
+ compareScreen("selection");
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/SetPageFirstItemLoadsNeededRowsOnly.java b/uitest/src/com/vaadin/tests/components/table/SetPageFirstItemLoadsNeededRowsOnly.java
new file mode 100644
index 0000000000..e643ef5fa0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/SetPageFirstItemLoadsNeededRowsOnly.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2000-2014 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.io.Serializable;
+import java.util.List;
+
+import com.vaadin.data.util.BeanContainer;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ *
+ * @author Vaadin Ltd
+ */
+
+@SuppressWarnings("serial")
+public class SetPageFirstItemLoadsNeededRowsOnly extends AbstractTestUI {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+ final VerticalLayout layout = new VerticalLayout();
+ addComponent(layout);
+
+ final Label label = new Label("");
+ addComponent(label);
+
+ BeanContainer<String, Bean> beans = new BeanContainer<String, Bean>(
+ Bean.class) {
+ @Override
+ public List<String> getItemIds(int startIndex, int numberOfIds) {
+ label.setValue("rows requested: " + numberOfIds);
+ return super.getItemIds(startIndex, numberOfIds);
+ }
+ };
+
+ beans.setBeanIdProperty("i");
+ for (int i = 0; i < 2000; i++) {
+ beans.addBean(new Bean(i));
+ }
+
+ final Table table = new Table("Beans", beans);
+ table.setVisibleColumns(new Object[] { "i" });
+ layout.addComponent(table);
+
+ table.setCurrentPageFirstItemIndex(table.size() - 1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "Only cached rows and rows in viewport should be rendered after "
+ + "calling table.setCurrentPageFirstItemIndex(n) - as opposed to all rows "
+ + "between the previous position and new position";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 14135;
+ }
+
+ public class Bean implements Serializable {
+
+ private Integer i;
+
+ public Bean(Integer i) {
+ this.i = i;
+ }
+
+ public Integer getI() {
+ return i;
+ }
+
+ public void setI(Integer i) {
+ this.i = i;
+ }
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/SetPageFirstItemLoadsNeededRowsOnlyTest.java b/uitest/src/com/vaadin/tests/components/table/SetPageFirstItemLoadsNeededRowsOnlyTest.java
new file mode 100644
index 0000000000..ebf53e9a6d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/SetPageFirstItemLoadsNeededRowsOnlyTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2000-2014 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.assertEquals;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ *
+ * @author Vaadin Ltd
+ */
+public class SetPageFirstItemLoadsNeededRowsOnlyTest extends MultiBrowserTest {
+
+ /*
+ * expectedRowsRequested is related to VScrollTable's cache_rate and
+ * pageLength. See for instance VScrollTable.ensureCacheFilled().
+ *
+ * This also takes into account if the visible rows are at the very start or
+ * end of the table, if the user scrolled or the
+ * Table.setCurrentPageFirstItemIndex(int) method was used.
+ *
+ * This value should not change if cache_rate and pageLength are not changed
+ * as well, and if this test remains constant: the table is scrolled to the
+ * very end (done in the actual UI: SetPageFirstItemLoadsNeededRowsOnly).
+ */
+ private int expectedRowsRequested = 45;
+
+ @Test
+ public void verifyLoadedRows() throws InterruptedException {
+
+ openTestURL();
+
+ // wait for events to be processed in UI after loading page
+ sleep(2000);
+
+ String labelValue = $(LabelElement.class).get(1).getText();
+ String expectedLabelValue = "rows requested: " + expectedRowsRequested;
+ String errorMessage = "Too many rows were requested";
+ assertEquals(errorMessage, expectedLabelValue, labelValue);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponents.html b/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponents.html
deleted file mode 100644
index 7ad0873c0f..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponents.html
+++ /dev/null
@@ -1,132 +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>TableClickAndDragOnIconAndComponents</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TableClickAndDragOnIconAndComponents</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.table.TableClickAndDragOnIconAndComponents?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>assertNotCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]</td>
- <td>v-selected</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[0]</td>
- <td>38,13</td>
-</tr>
-<tr>
- <td>assertCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]</td>
- <td>v-selected</td>
-</tr>
-<tr>
- <td>assertNotCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]</td>
- <td>v-selected</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>1,1</td>
-</tr>
-<tr>
- <td>assertNotCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]</td>
- <td>v-selected</td>
-</tr>
-<tr>
- <td>assertCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]</td>
- <td>v-selected</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VLabel[0]</td>
- <td>30,9</td>
-</tr>
-<tr>
- <td>assertCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]</td>
- <td>v-selected</td>
-</tr>
-<tr>
- <td>assertNotCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]</td>
- <td>v-selected</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]</td>
- <td>71,11</td>
-</tr>
-<tr>
- <td>assertCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]</td>
- <td>v-selected</td>
-</tr>
-<tr>
- <td>assertNotCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]</td>
- <td>v-selected</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]/VTextField[1]</td>
- <td>34,9</td>
-</tr>
-<tr>
- <td>assertNotCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]</td>
- <td>v-selected</td>
-</tr>
-<tr>
- <td>assertCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]</td>
- <td>v-selected</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VEmbedded[0]/domChild[0]</td>
- <td>9,8</td>
-</tr>
-<tr>
- <td>assertCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]</td>
- <td>v-selected</td>
-</tr>
-<tr>
- <td>assertNotCSSClass</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]</td>
- <td>v-selected</td>
-</tr>
-<tr>
- <td>drag</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[1]</td>
- <td>2,16</td>
-</tr>
-<tr>
- <td>drop</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[1]/domChild[0]</td>
- <td>22,18</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableTableClickAndDragOnIconAndComponents::PID_Stestable-table/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[1]/domChild[0]</td>
- <td>foo 4foo</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponents.java b/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponents.java
index 62a131cbbf..64f1a64558 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponents.java
+++ b/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponents.java
@@ -9,29 +9,31 @@ import com.vaadin.event.dd.acceptcriteria.AcceptAll;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.server.Resource;
import com.vaadin.server.ThemeResource;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.AbstractSelect.AbstractSelectTargetDetails;
import com.vaadin.ui.Component;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
import com.vaadin.ui.Table.ColumnGenerator;
+import com.vaadin.ui.Table.RowHeaderMode;
import com.vaadin.ui.Table.TableDragMode;
import com.vaadin.ui.TextField;
-public class TableClickAndDragOnIconAndComponents extends TestBase {
+public class TableClickAndDragOnIconAndComponents extends AbstractTestUI {
private static final long serialVersionUID = -2534880024131980135L;
private Table table;
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
table = new Table();
table.addContainerProperty("foo", String.class, "foo");
table.addContainerProperty("red", String.class, "red");
table.addContainerProperty("icon", Resource.class, null);
table.setSelectable(true);
- table.setRowHeaderMode(Table.ROW_HEADER_MODE_ICON_ONLY);
+ table.setRowHeaderMode(RowHeaderMode.ICON_ONLY);
table.setItemIconPropertyId("icon");
table.setId("testable-table");
addComponent(table);
@@ -122,6 +124,7 @@ public class TableClickAndDragOnIconAndComponents extends TestBase {
});
}
+ @SuppressWarnings("unchecked")
private void addItemAfter(Object itemId, Object afterItemId) {
Item item;
if (afterItemId != null) {
@@ -136,7 +139,7 @@ public class TableClickAndDragOnIconAndComponents extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "Tests that you can click on a row icon in a table to select the row, or to drag the row. Verifies also that the table doesn't capture the click events meant for components inside the table";
}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponentsTest.java b/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponentsTest.java
new file mode 100644
index 0000000000..4a46342cab
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponentsTest.java
@@ -0,0 +1,238 @@
+/*
+ * Copyright 2000-2014 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.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that clicking on active fields doesn't change Table selection, nor does
+ * dragging rows.
+ *
+ * @author Vaadin Ltd
+ */
+public class TableClickAndDragOnIconAndComponentsTest extends MultiBrowserTest {
+ @Test
+ public void testClickingAndDragging() {
+ openTestURL();
+
+ TableElement table = $(TableElement.class).first();
+
+ // ensure there's no initial selection
+ List<WebElement> selected = table.findElements(By
+ .className("v-selected"));
+ assertTrue("selection found when there should be none",
+ selected.isEmpty());
+
+ // click a cell
+ assertEquals(
+ "expected value not found, wrong cell or contents (3rd column of the 2nd row expected)",
+ "red 1foo", table.getCell(1, 2).getText());
+ table.getCell(1, 2).click();
+
+ // ensure the correct row and nothing but that got selected
+ selected = table.findElements(By.className("v-selected"));
+ assertFalse("no selection found when there should be some",
+ selected.isEmpty());
+ // find cell contents (row header included)
+ List<WebElement> cellContents = selected.get(0).findElements(
+ By.className("v-table-cell-content"));
+ assertEquals(
+ "expected value not found, wrong cell or contents (3rd column of the 2nd row expected)",
+ "red 1foo", cellContents.get(2).getText());
+ assertEquals("unexpected table selection size", 1, selected.size());
+
+ List<WebElement> rows = table.findElement(By.className("v-table-body"))
+ .findElements(By.tagName("tr"));
+ assertEquals("unexpected table row count", 5, rows.size());
+
+ // find a row that isn't the one selected
+ cellContents = rows.get(2).findElements(
+ By.className("v-table-cell-content"));
+ assertEquals(
+ "expected value not found, wrong cell or contents (3rd column of the 3rd row expected)",
+ "red 2foo", cellContents.get(2).getText());
+
+ // click on a TextField on that row
+ WebElement textField = rows.get(2)
+ .findElements(By.className("v-textfield")).get(0);
+ assertEquals(
+ "expected value not found, wrong cell or contents (6th column of the 3rd row expected)",
+ "foo 2foo", textField.getAttribute("value"));
+ textField.click();
+
+ // ensure the focus shifted correctly
+ List<WebElement> focused = table.findElements(By
+ .className("v-textfield-focus"));
+ assertEquals("unexpected amount of focused textfields", 1,
+ focused.size());
+ assertEquals(
+ "expected value not found, wrong cell or contents (6th column of the 3rd row expected)",
+ "foo 2foo", focused.get(0).getAttribute("value"));
+
+ // ensure the selection didn't change
+ selected = table.findElements(By.className("v-selected"));
+ assertEquals("unexpected table selection size", 1, selected.size());
+ cellContents = selected.get(0).findElements(
+ By.className("v-table-cell-content"));
+ assertEquals(
+ "expected value not found, wrong cell or contents (3rd column of the 2nd row expected)",
+ "red 1foo", cellContents.get(2).getText());
+
+ // click on a Label on that row
+ WebElement label = rows.get(2).findElements(By.className("v-label"))
+ .get(0);
+ assertEquals(
+ "expected value not found, wrong cell or contents (5th column of the 3rd row expected)",
+ "foo 2foo", label.getText());
+ label.click();
+
+ // ensure the focus shifted correctly
+ focused = table.findElements(By.className("v-textfield-focus"));
+ assertTrue("focused textfields found when there should be none",
+ focused.isEmpty());
+
+ // ensure the selection changed
+ selected = table.findElements(By.className("v-selected"));
+ assertEquals("unexpected table selection size", 1, selected.size());
+ cellContents = selected.get(0).findElements(
+ By.className("v-table-cell-content"));
+ assertEquals(
+ "expected value not found, wrong cell or contents (3rd column of the 3rd row expected)",
+ "red 2foo", cellContents.get(2).getText());
+
+ // click on the selected row's textfield (same as earlier)
+ textField.click();
+
+ // ensure the focus shifted correctly
+ focused = table.findElements(By.className("v-textfield-focus"));
+ assertEquals("unexpected amount of focused textfields", 1,
+ focused.size());
+ assertEquals(
+ "expected value not found, wrong cell or contents (6th column of the 3rd row expected)",
+ "foo 2foo", focused.get(0).getAttribute("value"));
+
+ // ensure the selection didn't change
+ selected = table.findElements(By.className("v-selected"));
+ assertEquals("unexpected table selection size", 1, selected.size());
+ cellContents = selected.get(0).findElements(
+ By.className("v-table-cell-content"));
+ assertEquals(
+ "expected value not found, wrong cell or contents (3rd column of the 3rd row expected)",
+ "red 2foo", cellContents.get(2).getText());
+
+ // find the readOnly TextField of the previously selected row
+ textField = rows.get(1).findElements(By.className("v-textfield"))
+ .get(1);
+ assertEquals(
+ "expected value not found, wrong cell or contents (7th column of the 2nd row expected)",
+ "foo 1foo", textField.getAttribute("value"));
+ assertEquals(
+ "expected readonly status not found, wrong cell or contents (7th column of the 2nd row expected)",
+ "true", textField.getAttribute("readonly"));
+
+ // click on that TextField
+ textField.click();
+
+ // ensure the focus shifted correctly
+ focused = table.findElements(By.className("v-textfield-focus"));
+ assertTrue("focused textfields found when there should be none",
+ focused.isEmpty());
+
+ // ensure the selection changed
+ selected = table.findElements(By.className("v-selected"));
+ assertEquals("unexpected table selection size", 1, selected.size());
+ cellContents = selected.get(0).findElements(
+ By.className("v-table-cell-content"));
+ assertEquals(
+ "expected value not found, wrong cell or contents (3rd column of the 2nd row expected)",
+ "red 1foo", cellContents.get(2).getText());
+
+ // click the embedded icon of the other row
+ WebElement embedded = rows.get(2).findElement(
+ By.className("v-embedded"));
+ embedded.click();
+
+ // ensure the selection changed
+ selected = table.findElements(By.className("v-selected"));
+ assertEquals("unexpected table selection size", 1, selected.size());
+ cellContents = selected.get(0).findElements(
+ By.className("v-table-cell-content"));
+ assertEquals(
+ "expected value not found, wrong cell or contents (3rd column of the 3rd row expected)",
+ "red 2foo", cellContents.get(2).getText());
+
+ // check row you are about to drag
+ cellContents = rows.get(4).findElements(
+ By.className("v-table-cell-content"));
+ assertEquals(
+ "expected value not found, wrong cell or contents (3rd column of the 5th row expected)",
+ "red 4foo", cellContents.get(2).getText());
+
+ // check the row above it
+ cellContents = rows.get(3).findElements(
+ By.className("v-table-cell-content"));
+ assertEquals(
+ "expected value not found, wrong cell or contents (3rd column of the 4th row expected)",
+ "red 3foo", cellContents.get(2).getText());
+
+ // drag the row to the row that's two places above it (gets dropped
+ // below that)
+ cellContents = rows.get(4).findElements(
+ By.className("v-table-cell-content"));
+ new Actions(getDriver()).moveToElement(cellContents.get(2))
+ .clickAndHold().moveToElement(rows.get(2)).release().perform();
+
+ // find the current order of the rows
+ rows = table.findElement(By.className("v-table-body")).findElements(
+ By.tagName("tr"));
+ assertEquals("unexpected table row count", 5, rows.size());
+
+ // ensure the row got dragged
+ cellContents = rows.get(3).findElements(
+ By.className("v-table-cell-content"));
+ assertEquals(
+ "expected value not found, wrong cell or contents (3rd column of the dragged row expected, should be on 4th row now)",
+ "red 4foo", cellContents.get(2).getText());
+
+ cellContents = rows.get(4).findElements(
+ By.className("v-table-cell-content"));
+ assertEquals(
+ "expected value not found, wrong cell or contents (3rd column of the previous 4th row expected, should be on 5th row now)",
+ "red 3foo", cellContents.get(2).getText());
+
+ // ensure the selection didn't change
+ selected = table.findElements(By.className("v-selected"));
+ assertEquals("unexpected table selection size", 1, selected.size());
+ cellContents = selected.get(0).findElements(
+ By.className("v-table-cell-content"));
+ assertEquals(
+ "expected value not found, wrong cell or contents (3rd column of the 3rd row expected)",
+ "red 2foo", cellContents.get(2).getText());
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableColumnIcons-chameleon.html b/uitest/src/com/vaadin/tests/components/table/TableColumnIcons-chameleon.html
index a9a572e468..efb99410fe 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableColumnIcons-chameleon.html
+++ b/uitest/src/com/vaadin/tests/components/table/TableColumnIcons-chameleon.html
@@ -13,7 +13,7 @@
</thead><tbody>
<tr>
<td>open</td>
- <td>/run/com.vaadin.tests.components.table.Tables?restartApplication&theme=chameleon</td>
+ <td>/run/com.vaadin.tests.components.table.Tables?restartApplication&amp;theme=chameleon</td>
<td></td>
</tr>
<!--Add icons to property 1,5,10-->
diff --git a/uitest/src/com/vaadin/tests/components/table/TableColumnIcons-runo.html b/uitest/src/com/vaadin/tests/components/table/TableColumnIcons-runo.html
index 641d9480ca..d565fb5140 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableColumnIcons-runo.html
+++ b/uitest/src/com/vaadin/tests/components/table/TableColumnIcons-runo.html
@@ -13,7 +13,7 @@
</thead><tbody>
<tr>
<td>open</td>
- <td>/run/com.vaadin.tests.components.table.Tables?restartApplication&theme=runo</td>
+ <td>/run/com.vaadin.tests.components.table.Tables?restartApplication&amp;theme=runo</td>
<td></td>
</tr>
<!--Add icons to property 1,5,10-->
diff --git a/uitest/src/com/vaadin/tests/components/table/TableGeneratedRows-chameleon.html b/uitest/src/com/vaadin/tests/components/table/TableGeneratedRows-chameleon.html
index 8a83f27701..c382a7c766 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableGeneratedRows-chameleon.html
+++ b/uitest/src/com/vaadin/tests/components/table/TableGeneratedRows-chameleon.html
@@ -13,7 +13,7 @@
</thead><tbody>
<tr>
<td>open</td>
- <td>/run/com.vaadin.tests.components.table.Tables?restartApplication&theme=chameleon</td>
+ <td>/run/com.vaadin.tests.components.table.Tables?restartApplication&amp;theme=chameleon</td>
<td></td>
</tr>
<tr>
diff --git a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.html b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.html
deleted file mode 100644
index 4c2dec9784..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.html
+++ /dev/null
@@ -1,418 +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>TableItemDescriptionGeneratorTest</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TableItemDescriptionGeneratorTest</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/TableItemDescriptionGeneratorTest?restartApplication</td>
- <td></td>
-</tr>
-<!--All on-->
-<!--Text tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Cell description item 1,Text</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td>-5000</td>
-</tr>
-<!--Button tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Button 1 description</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td>-5000</td>
-</tr>
-<!--TextField tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Textfield's own description</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td>-5000</td>
-</tr>
-<!--Cell and row tooltips-->
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]</td>
- <td>12,6</td>
-</tr>
-<!--Text tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Cell description item 1,Text</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td>-5000</td>
-</tr>
-<!--Button tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Cell description item 1,Component</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td>-5000</td>
-</tr>
-<!--TextField tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Cell description item 1,Generated component</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td>-5000</td>
-</tr>
-<!--Row and Component tooltips-->
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]</td>
- <td>7,8</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VCheckBox[0]/domChild[0]</td>
- <td>7,5</td>
-</tr>
-<!--Text tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Row description item 1</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td>-5000</td>
-</tr>
-<!--Button tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Button 1 description</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td>-5000</td>
-</tr>
-<!--TextField tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Textfield's own description</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td>-5000</td>
-</tr>
-<!--Row tooltips-->
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]</td>
- <td>7,8</td>
-</tr>
-<!--Text tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Row description item 1</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td>-5000</td>
-</tr>
-<!--Button tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Row description item 1</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td>-5000</td>
-</tr>
-<!--TextField tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VTextField[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Row description item 1</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td>-5000</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java
index ec81194f14..809e639448 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorTest.java
+++ b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java
@@ -5,7 +5,8 @@ import com.vaadin.data.Item;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.AbstractSelect.ItemDescriptionGenerator;
import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
@@ -13,7 +14,7 @@ import com.vaadin.ui.Component;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
-public class TableItemDescriptionGeneratorTest extends TestBase {
+public class TableItemDescriptionGeneratorUI extends AbstractTestUI {
private final String TEXT_PROPERTY_ID = "Text";
private final String GEN_WIDGET_PROPERTY_ID = "Generated component";
@@ -23,7 +24,7 @@ public class TableItemDescriptionGeneratorTest extends TestBase {
private CheckBox tableRowItemDescription;
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
final Table table = createTable();
table.setId("table");
componentDescription = new CheckBox("Tooltip on components");
@@ -73,7 +74,7 @@ public class TableItemDescriptionGeneratorTest extends TestBase {
if (propertyId == null && tableRowItemDescription.getValue()) {
return "Row description " + itemId;
} else if (tableCellItemDescription.getValue()) {
- return "Cell description " + itemId + "," + propertyId;
+ return "Cell description " + itemId + ", " + propertyId;
}
return null;
}
@@ -100,7 +101,7 @@ public class TableItemDescriptionGeneratorTest extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "Cells and rows should have tooltips";
}
@@ -109,13 +110,12 @@ public class TableItemDescriptionGeneratorTest extends TestBase {
return 5414;
}
+ @SuppressWarnings("unchecked")
private Container createContainer(boolean description) {
IndexedContainer container = new IndexedContainer();
container.addContainerProperty(TEXT_PROPERTY_ID, String.class, "");
container.addContainerProperty(WIDGET_PROPERTY_ID, Component.class,
null);
- // container.addContainerProperty(COLUMN3_PROPERTY_ID, String.class,
- // "");
for (int i = 0; i < 5; i++) {
Item item = container.addItem("item " + i);
@@ -125,7 +125,6 @@ public class TableItemDescriptionGeneratorTest extends TestBase {
b.setDescription("Button " + i + " description");
}
item.getItemProperty(WIDGET_PROPERTY_ID).setValue(b);
- // item.getItemProperty(COLUMN3_PROPERTY_ID).setValue("last" + i);
}
return container;
diff --git a/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUITest.java b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUITest.java
new file mode 100644
index 0000000000..555a38a91e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUITest.java
@@ -0,0 +1,241 @@
+/*
+ * Copyright 2000-2014 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.assertEquals;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.testbench.elements.CheckBoxElement;
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.TooltipTest;
+
+/**
+ * Tests Table tooltips with various settings.
+ *
+ * @author Vaadin Ltd
+ */
+public class TableItemDescriptionGeneratorUITest extends TooltipTest {
+
+ @Test
+ public void testDescriptions() throws Exception {
+ openTestURL();
+
+ checkTooltipNotPresent();
+
+ TableElement table = $(TableElement.class).first();
+ List<CheckBoxElement> checkboxes = $(CheckBoxElement.class).all();
+ assertEquals(3, checkboxes.size());
+
+ // check text description
+ TestBenchElement cell_1_0 = table.getCell(1, 0);
+ cell_1_0.showTooltip();
+ checkTooltip("Cell description item 1, Text");
+
+ // move somewhere without a description
+ checkboxes.get(2).showTooltip();
+ checkTooltipNotPresent();
+
+ // check button description
+ TestBenchElement cell_1_1 = table.getCell(1, 1);
+ cell_1_1.showTooltip();
+ checkTooltip("Button 1 description");
+
+ // move somewhere without a description
+ checkboxes.get(2).showTooltip();
+ checkTooltipNotPresent();
+
+ // check textfield's description
+ TestBenchElement cell_1_2 = table.getCell(1, 2);
+ cell_1_2.showTooltip();
+ checkTooltip("Textfield's own description");
+
+ // move somewhere without a description
+ checkboxes.get(2).showTooltip();
+ checkTooltipNotPresent();
+
+ // uncheck component tooltips
+ checkboxes.get(0).findElement(By.tagName("input")).click();
+
+ // check text description
+ cell_1_0 = table.getCell(1, 0);
+ cell_1_0.showTooltip();
+ checkTooltip("Cell description item 1, Text");
+
+ // move somewhere without a description
+ checkboxes.get(2).showTooltip();
+ checkTooltipNotPresent();
+
+ // check button description
+ cell_1_1 = table.getCell(1, 1);
+ cell_1_1.showTooltip();
+ checkTooltip("Cell description item 1, Component");
+
+ // move somewhere without a description
+ new Actions(getDriver()).moveToElement(checkboxes.get(2)).perform();
+ sleep(1000);
+ checkTooltipNotPresent();
+
+ // check textfield's description
+ cell_1_2 = table.getCell(1, 2);
+ cell_1_2.showTooltip();
+ checkTooltip("Cell description item 1, Generated component");
+
+ // move somewhere without a description
+ checkboxes.get(2).showTooltip();
+ checkTooltipNotPresent();
+
+ // check component tooltips
+ checkboxes.get(0).findElement(By.tagName("input")).click();
+ // uncheck cell tooltips
+ checkboxes.get(1).findElement(By.tagName("input")).click();
+
+ // check text description
+ cell_1_0 = table.getCell(1, 0);
+ cell_1_0.showTooltip();
+ checkTooltip("Row description item 1");
+
+ // move somewhere without a description
+ checkboxes.get(2).showTooltip();
+ checkTooltipNotPresent();
+
+ // check button description
+ cell_1_1 = table.getCell(1, 1);
+ cell_1_1.showTooltip();
+ checkTooltip("Button 1 description");
+
+ // move somewhere without a description
+ checkboxes.get(2).showTooltip();
+ checkTooltipNotPresent();
+
+ // check textfield's description
+ cell_1_2 = table.getCell(1, 2);
+ cell_1_2.showTooltip();
+ checkTooltip("Textfield's own description");
+
+ // move somewhere without a description
+ checkboxes.get(2).showTooltip();
+ checkTooltipNotPresent();
+
+ // uncheck component tooltips
+ checkboxes.get(0).findElement(By.tagName("input")).click();
+
+ // check text description
+ cell_1_0 = table.getCell(1, 0);
+ cell_1_0.showTooltip();
+ checkTooltip("Row description item 1");
+
+ // move somewhere without a description
+ checkboxes.get(2).showTooltip();
+ checkTooltipNotPresent();
+
+ // check button description
+ cell_1_1 = table.getCell(1, 1);
+ cell_1_1.showTooltip();
+ checkTooltip("Row description item 1");
+
+ // move somewhere without a description
+ checkboxes.get(2).showTooltip();
+ checkTooltipNotPresent();
+
+ // check textfield's description
+ cell_1_2 = table.getCell(1, 2);
+ cell_1_2.showTooltip();
+ checkTooltip("Row description item 1");
+
+ // move somewhere without a description
+ checkboxes.get(2).showTooltip();
+ checkTooltipNotPresent();
+ }
+
+ @Test
+ public void testPosition() throws Exception {
+ openTestURL();
+
+ TableElement table = $(TableElement.class).first();
+ List<CheckBoxElement> checkboxes = $(CheckBoxElement.class).all();
+ assertEquals(3, checkboxes.size());
+
+ TestBenchElement cell_3_0 = table.getCell(3, 0);
+
+ // move to the center of the cell
+ new Actions(getDriver()).moveToElement(cell_3_0).perform();
+ sleep(1000);
+
+ // ensure the tooltip is present
+ checkTooltip("Cell description item 3, Text");
+ clearTooltip();
+
+ // move outside the cell
+ new Actions(getDriver()).moveToElement(checkboxes.get(2)).perform();
+
+ // move to the corner of the cell
+ new Actions(getDriver()).moveToElement(cell_3_0, 0, 0).perform();
+ sleep(1000);
+
+ // ensure the tooltip is present
+ checkTooltip("Cell description item 3, Text");
+ clearTooltip();
+
+ // uncheck cell tooltips
+ checkboxes.get(1).findElement(By.tagName("input")).click();
+
+ TestBenchElement cell_1_1 = table.getCell(1, 1);
+
+ // move to the center of the cell
+ new Actions(getDriver()).moveToElement(cell_1_1).perform();
+ sleep(1000);
+
+ // ensure the tooltip is present
+ checkTooltip("Button 1 description");
+ clearTooltip();
+
+ // move to the corner of the element, outside of the button
+ new Actions(getDriver()).moveToElement(cell_1_1, 0, 0).perform();
+ sleep(1000);
+
+ // ensure the tooltip is present
+ checkTooltip("Row description item 1");
+ clearTooltip();
+
+ // check cell tooltips
+ checkboxes.get(1).findElement(By.tagName("input")).click();
+
+ TestBenchElement cell_4_2 = table.getCell(4, 2);
+
+ // move to the center of the cell
+ new Actions(getDriver()).moveToElement(cell_4_2).perform();
+ sleep(1000);
+
+ // ensure the tooltip is present
+ checkTooltip("Textfield's own description");
+ clearTooltip();
+
+ // move to the corner of the element, outside of the textfield
+ new Actions(getDriver()).moveToElement(cell_4_2, 0, 0).perform();
+ sleep(1000);
+
+ // ensure the tooltip is present
+ checkTooltip("Cell description item 4, Generated component");
+ clearTooltip();
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableMultiSelectSimple-chameleon.html b/uitest/src/com/vaadin/tests/components/table/TableMultiSelectSimple-chameleon.html
index f13bd22e84..aa9bfd5391 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableMultiSelectSimple-chameleon.html
+++ b/uitest/src/com/vaadin/tests/components/table/TableMultiSelectSimple-chameleon.html
@@ -13,7 +13,7 @@
</thead><tbody>
<tr>
<td>open</td>
- <td>/run/com.vaadin.tests.components.table.TableMultiSelectSimple?restartApplication&theme=chameleon</td>
+ <td>/run/com.vaadin.tests.components.table.TableMultiSelectSimple?restartApplication&amp;theme=chameleon</td>
<td></td>
</tr>
<tr>
diff --git a/uitest/src/com/vaadin/tests/components/table/TableRowHeight2.html b/uitest/src/com/vaadin/tests/components/table/TableRowHeight2.html
deleted file mode 100644
index a440ff84fb..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/TableRowHeight2.html
+++ /dev/null
@@ -1,57 +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>TableRowHeight2</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TableRowHeight2</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.table.TableRowHeight2</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>1</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTableRowHeight2::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[1]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTableRowHeight2::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[1]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>1</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/table/TableRowHeight2.java b/uitest/src/com/vaadin/tests/components/table/TableRowHeight2.java
index 0011fdca18..5c733b9e24 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableRowHeight2.java
+++ b/uitest/src/com/vaadin/tests/components/table/TableRowHeight2.java
@@ -1,16 +1,19 @@
package com.vaadin.tests.components.table;
+import com.vaadin.annotations.Theme;
import com.vaadin.data.Item;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Table;
import com.vaadin.ui.themes.BaseTheme;
-public class TableRowHeight2 extends TestBase {
+@Theme("tests-tickets")
+public class TableRowHeight2 extends AbstractTestUI {
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "The table contains 2 rows, which both should be shown completely as the table height is undefined.";
}
@@ -19,9 +22,9 @@ public class TableRowHeight2 extends TestBase {
return 2747;
}
+ @SuppressWarnings("unchecked")
@Override
- protected void setup() {
- setTheme("tests-tickets");
+ protected void setup(VaadinRequest request) {
HorizontalLayout vl = new HorizontalLayout();
vl.setSizeFull();
diff --git a/uitest/src/com/vaadin/tests/components/table/TableRowHeight2Test.java b/uitest/src/com/vaadin/tests/components/table/TableRowHeight2Test.java
new file mode 100644
index 0000000000..7074225311
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableRowHeight2Test.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2000-2014 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.io.IOException;
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that rows are completely visible and clicking buttons doesn't change
+ * anything.
+ *
+ * @author Vaadin Ltd
+ */
+public class TableRowHeight2Test extends MultiBrowserTest {
+
+ @Test
+ public void testRowHeights() throws IOException {
+ openTestURL();
+
+ compareScreen("initial");
+
+ TableElement table = $(TableElement.class).first();
+ List<WebElement> rows = table.findElement(By.className("v-table-body"))
+ .findElements(By.tagName("tr"));
+
+ rows.get(0).findElements(By.className("v-button")).get(1).click();
+ rows.get(1).findElements(By.className("v-button")).get(1).click();
+
+ compareScreen("after");
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRow.java b/uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRow.java
new file mode 100644
index 0000000000..d1d6edaa67
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRow.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2000-2014 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;
+
+/**
+ *
+ * @author Vaadin Ltd
+ */
+import com.vaadin.data.Item;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+
+/*
+ * Copyright 2000-2014 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.
+ */
+
+/**
+ *
+ * @author Vaadin Ltd
+ */
+@SuppressWarnings("serial")
+public class TableScrollAfterAddRow extends AbstractTestUI {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.UI#init(com.vaadin.server.VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+
+ final int totalRows = 100;
+
+ final VerticalLayout layout = new VerticalLayout();
+
+ final IndexedContainer datasource = new IndexedContainer();
+
+ datasource.addContainerProperty("value", Integer.class, -1);
+ for (int i = 0; i < totalRows; i++) {
+ addRow(datasource);
+ }
+
+ final Table table = new Table();
+ table.setContainerDataSource(datasource);
+ layout.addComponent(table);
+ addComponent(layout);
+
+ final Label label = new Label("");
+ layout.addComponent(label);
+
+ NativeButton addRowButton = new NativeButton("Add row",
+ new NativeButton.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ addRow(datasource);
+ }
+ });
+
+ NativeButton jumpToLastRowButton = new NativeButton("Jump to last row",
+ new NativeButton.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ jumpToLastRow(table);
+ }
+ });
+ NativeButton jumpTo15thRowButton = new NativeButton("Jump to 15th row",
+ new NativeButton.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ jumpToFifteenthRow(table);
+ }
+ });
+ NativeButton jumpToFirstRowButton = new NativeButton(
+ "Jump to first row", new NativeButton.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ jumpToFirstRow(table);
+ }
+ });
+
+ NativeButton updateLabelButton = new NativeButton("UpdateLabel",
+ new NativeButton.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ label.setValue(Integer.toString(table
+ .getCurrentPageFirstItemIndex()));
+ }
+ });
+ layout.addComponent(addRowButton);
+ layout.addComponent(jumpToLastRowButton);
+ layout.addComponent(jumpTo15thRowButton);
+ layout.addComponent(jumpToFirstRowButton);
+ layout.addComponent(updateLabelButton);
+ }
+
+ private void jumpToFifteenthRow(Table table) {
+ table.setCurrentPageFirstItemIndex(14);
+ }
+
+ private void jumpToLastRow(Table table) {
+ int visibleRows = table.getContainerDataSource().size();
+ table.setCurrentPageFirstItemIndex(visibleRows - 1);
+ }
+
+ private void jumpToFirstRow(Table table) {
+ table.setCurrentPageFirstItemIndex(0);
+ }
+
+ private void addRow(IndexedContainer datasource) {
+ int rowNumber = datasource.size();
+ Item row = datasource.addItem(rowNumber);
+ row.getItemProperty("value").setValue(rowNumber);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ // TODO Auto-generated method stub
+ return "";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 14147;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRowTest.java b/uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRowTest.java
new file mode 100644
index 0000000000..9242bae3d8
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRowTest.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2000-2014 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.assertEquals;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.commands.TestBenchCommandExecutor;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.testbench.screenshot.ImageComparison;
+import com.vaadin.testbench.screenshot.ReferenceNameGenerator;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ *
+ * @author Vaadin Ltd
+ */
+public class TableScrollAfterAddRowTest extends MultiBrowserTest {
+
+ @Before
+ public void init() {
+ openTestURL();
+ }
+
+ @Test
+ public void testJumpToFirstRow() throws InterruptedException {
+ jumpToFifteenthRow();
+ jumpToFirstRow();
+ assertEquals("0", getCurrentPageFirstItemIndex());
+ }
+
+ @Test
+ public void testAddRowAfterJumpToLastRow() throws InterruptedException {
+ jumpToLastRow();
+ addRow();
+ sleep(200);
+ assertEquals("85", getCurrentPageFirstItemIndex());
+ }
+
+ @Test
+ public void testAddRowAfterJumpingToLastRowAndScrollingUp()
+ throws InterruptedException {
+ jumpToLastRow();
+ scrollUp();
+ addRow();
+ sleep(200);
+ Assert.assertNotEquals("86", getCurrentPageFirstItemIndex());
+ }
+
+ private void scrollUp() {
+ WebElement actualElement = getDriver().findElement(
+ By.className("v-table-body-wrapper"));
+ JavascriptExecutor js = new TestBenchCommandExecutor(getDriver(),
+ new ImageComparison(), new ReferenceNameGenerator());
+ js.executeScript("arguments[0].scrollTop = " + 30, actualElement);
+ }
+
+ private String getCurrentPageFirstItemIndex() throws InterruptedException {
+ ButtonElement updateLabelButton = $(ButtonElement.class).get(4);
+ LabelElement label = $(LabelElement.class).get(1);
+ updateLabelButton.click();
+ sleep(200);
+ return label.getText();
+ }
+
+ private void addRow() {
+ ButtonElement button = $(ButtonElement.class).get(0);
+ button.click();
+ }
+
+ private void jumpToFirstRow() {
+ ButtonElement button = $(ButtonElement.class).get(3);
+ button.click();
+ }
+
+ private void jumpToFifteenthRow() {
+ ButtonElement button = $(ButtonElement.class).get(2);
+ button.click();
+ }
+
+ private void jumpToLastRow() {
+ ButtonElement button = $(ButtonElement.class).get(1);
+ button.click();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableTooltips.html b/uitest/src/com/vaadin/tests/components/table/TableTooltips.html
deleted file mode 100644
index 13ceea935f..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/TableTooltips.html
+++ /dev/null
@@ -1,91 +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.table.TableItemDescriptionGeneratorTest?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseMove</td>
- <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[0]</td>
- <td>57,5</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Cell description item 3,Text</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]</td>
- <td>810,153</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>355,350</td>
-</tr>
-<tr>
- <td>drag</td>
- <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>822,249</td>
-</tr>
-<tr>
- <td>drop</td>
- <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[1]</td>
- <td>90,12</td>
-</tr>
-<tr>
- <td>mouseMove</td>
- <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]</td>
- <td>57,12</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Row description item 1</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]</td>
- <td>1011,283</td>
-</tr>
-<tr>
- <td>mouseMove</td>
- <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[4]/VTextField[0]</td>
- <td>58,10</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Textfield's own description</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html b/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html
deleted file mode 100644
index caaa15fa1c..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissing.html
+++ /dev/null
@@ -1,47 +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>TextFieldValueGoesMissing</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TextFieldValueGoesMissing</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.table.TextFieldValueGoesMissing?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
- <td>73,10</td>
-</tr>
-<tr>
- <td>enterCharacter</td>
- <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
- <td>test</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>contextmenu</td>
- <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertValue</td>
- <td>vaadin=runcomvaadintestscomponentstableTextFieldValueGoesMissing::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
- <td>test</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java b/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java
index 9ffad7f1e4..89c9050361 100644
--- a/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java
+++ b/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissing.java
@@ -1,6 +1,7 @@
package com.vaadin.tests.components.table;
-import com.vaadin.tests.components.TestBase;
+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.Label;
@@ -8,17 +9,18 @@ import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
-public class TextFieldValueGoesMissing extends TestBase {
+public class TextFieldValueGoesMissing extends AbstractTestUI {
+ @SuppressWarnings("unchecked")
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
final VerticalLayout verticalLayout = new VerticalLayout();
final Label label1 = new Label("1");
final Label label2 = new Label("2");
Button button = new Button("Replace label");
- button.addListener(new Button.ClickListener() {
+ button.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
@@ -45,7 +47,7 @@ public class TextFieldValueGoesMissing extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "Enter a text in the TextField in the table and press the 'Replace label' button. This replaces the label which is in the same layout as the table but should not cause the TextField in the table to lose its contents";
}
diff --git a/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissingTest.java b/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissingTest.java
new file mode 100644
index 0000000000..387882b6ca
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TextFieldValueGoesMissingTest.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2000-2014 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 org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that a text field's value isn't cleared after a label in the same
+ * layout is changed.
+ *
+ * @since 7.3
+ * @author Vaadin Ltd
+ */
+public class TextFieldValueGoesMissingTest extends MultiBrowserTest {
+
+ /* This test was rewritten from a TB2 test. */
+ @Test
+ public void valueMissingTest() throws Exception {
+ openTestURL();
+
+ waitForElementVisible(By.className("v-textfield"));
+
+ TextFieldElement textfield = $(TextFieldElement.class).first();
+ textfield.focus();
+ textfield.sendKeys("test");
+
+ $(ButtonElement.class).first().click();
+
+ new Actions(getDriver()).contextClick(textfield).perform();
+
+ Assert.assertEquals("test", textfield.getValue());
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/textarea/TextAreaSizeResetted.java b/uitest/src/com/vaadin/tests/components/textarea/TextAreaSizeResetted.java
new file mode 100644
index 0000000000..b2607050a4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/textarea/TextAreaSizeResetted.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2000-2014 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.textarea;
+
+import com.vaadin.event.UIEvents;
+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.Button.ClickListener;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.TextField;
+
+/**
+ * Ticket #14080
+ *
+ * - The bug happen on push event.<br/>
+ * - The changes in the DOM are css related.<br/>
+ * - It seems like when the class attribute is set on push, the textarea revert
+ * to the height defined by the rows attribute.<br/>
+ * - The size is reseted on onStateChange where the size is set to the one from
+ * the state. And it's because, when the user changes the text, at the next poll
+ * the state will confirm the change of the text, but the width and height
+ * didn't change in the state either client or server before the fix.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TextAreaSizeResetted extends AbstractTestUI {
+
+ public static final int TEXTAREAHEIGHT = 200;
+ public static final int TEXTAREAWIDTH = 200;
+
+ CssLayout layout = new CssLayout() {
+ @Override
+ protected String getCss(Component c) {
+ if (c instanceof TextArea) {
+ return "resize:both";
+ }
+
+ return super.getCss(c);
+ }
+ };
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ setPollInterval(500); // Short polling like 100ms jams up the TestBench
+ // waitForVaadin -functionality.
+
+ final Label pollIndicator = new Label();
+ pollIndicator.setId("pollIndicator");
+
+ final TextField textField = new TextField("height");
+
+ final TextArea textArea = new TextArea();
+ textArea.setHeight(TEXTAREAHEIGHT + "px");
+ textArea.setWidth(TEXTAREAWIDTH + "px");
+ textArea.setValue("This is a text.");
+
+ Button button = new Button("Change Height", new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+
+ textArea.setHeight(textField.getValue());
+ }
+ });
+
+ addComponent(layout);
+
+ layout.addComponent(textArea);
+ layout.addComponent(textField);
+ layout.addComponent(button);
+ layout.addComponent(pollIndicator);
+
+ addPollListener(new UIEvents.PollListener() {
+ @Override
+ public void poll(UIEvents.PollEvent event) {
+ pollIndicator.setValue(String.valueOf(System
+ .currentTimeMillis()));
+ }
+ });
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "TextArea width/height change when user resize it, change the text then a poll come.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14080;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/textarea/TextAreaSizeResettedTest.java b/uitest/src/com/vaadin/tests/components/textarea/TextAreaSizeResettedTest.java
new file mode 100644
index 0000000000..6365d00735
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/textarea/TextAreaSizeResettedTest.java
@@ -0,0 +1,127 @@
+package com.vaadin.tests.components.textarea;
+
+import static com.vaadin.tests.components.textarea.TextAreaSizeResetted.TEXTAREAHEIGHT;
+import static com.vaadin.tests.components.textarea.TextAreaSizeResetted.TEXTAREAWIDTH;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.Dimension;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.testbench.elements.TextAreaElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TextAreaSizeResettedTest extends MultiBrowserTest {
+
+ private final int OFFSET = 100;
+
+ @Override
+ public void setup() throws Exception {
+ super.setup();
+
+ openTestURL();
+ }
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ return getBrowsersExcludingIE(); // IE8-11 don't support CSS resize.
+ }
+
+ @Test
+ public void textAreaIsNotResizedOnBlur() {
+
+ resizeAndAssertTextAreaTo(TEXTAREAHEIGHT, OFFSET);
+
+ getTextArea().sendKeys("foo");
+
+ moveFocusOutsideTextArea();
+
+ // We can't use a waitUntil to check the text area size here, because it
+ // won't release the focus from
+ // the text area, so we need to do use something else. This workaround
+ // uses a label which is updated to indicate
+ // polling, which should trigger a resize.
+ waitUntilPollingOccurs();
+
+ assertThat(getTextAreaHeight(), is(TEXTAREAHEIGHT + OFFSET));
+ assertThat(getTextAreaWidth(), is(TEXTAREAWIDTH + OFFSET));
+
+ waitUntilPollingOccurs();
+ }
+
+ private void moveFocusOutsideTextArea() {
+ $(TextFieldElement.class).first().focus();
+ }
+
+ private void resizeAndAssertTextAreaTo(int size, int offset) {
+ // Sanity check
+ assertThat(getTextAreaHeight(), is(size));
+ resizeTextAreaBy(offset);
+
+ assertThat(getTextAreaHeight(), is(size + offset));
+ }
+
+ private void resizeTextAreaBy(int offset) {
+ int resizeHandlerOffset = 10;
+ new Actions(getDriver())
+ .moveToElement(getTextArea(),
+ TEXTAREAWIDTH - resizeHandlerOffset,
+ TEXTAREAHEIGHT - resizeHandlerOffset).clickAndHold()
+ .moveByOffset(offset, offset).release().build().perform();
+ }
+
+ @Test
+ public void textAreaWidthIsPresevedOnHeightResize() {
+ resizeAndAssertTextAreaTo(TEXTAREAHEIGHT, OFFSET);
+
+ changeHeightTo(TEXTAREAHEIGHT + OFFSET + OFFSET);
+
+ assertThat(getTextAreaWidth(), is(TEXTAREAWIDTH + OFFSET));
+ assertThat(getTextAreaHeight(), is(TEXTAREAHEIGHT + OFFSET + OFFSET));
+ }
+
+ private void changeHeightTo(int offset) {
+ $(TextFieldElement.class).first().sendKeys(String.valueOf(offset));
+ $(ButtonElement.class).first().click();
+ }
+
+ private void waitUntilPollingOccurs() {
+ final String timestamp = getPollTimestamp();
+
+ waitUntil(new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver input) {
+ return !timestamp.equals(getPollTimestamp());
+ }
+ });
+ }
+
+ private String getPollTimestamp() {
+ return $(LabelElement.class).id("pollIndicator").getText();
+ }
+
+ private int getTextAreaHeight() {
+ return getTextAreaSize().getHeight();
+ }
+
+ private int getTextAreaWidth() {
+ return getTextAreaSize().getWidth();
+ }
+
+ private Dimension getTextAreaSize() {
+ return getTextArea().getSize();
+ }
+
+ private TextAreaElement getTextArea() {
+ return $(TextAreaElement.class).first();
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/treetable/DisappearingComponents.html b/uitest/src/com/vaadin/tests/components/treetable/DisappearingComponents.html
deleted file mode 100644
index 1a20b798ec..0000000000
--- a/uitest/src/com/vaadin/tests/components/treetable/DisappearingComponents.html
+++ /dev/null
@@ -1,32 +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>DisappearingComponents</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">DisappearingComponents</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.treetable.DisappearingComponents?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstreetableDisappearingComponents::/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>12,7</td>
-</tr>
-<tr>
- <td>verifyElementPresent</td>
- <td>vaadin=runcomvaadintestscomponentstreetableDisappearingComponents::/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[2]/VLink[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/treetable/DisappearingComponents.java b/uitest/src/com/vaadin/tests/components/treetable/DisappearingComponents.java
index aaa7496616..ee64007234 100644
--- a/uitest/src/com/vaadin/tests/components/treetable/DisappearingComponents.java
+++ b/uitest/src/com/vaadin/tests/components/treetable/DisappearingComponents.java
@@ -1,16 +1,15 @@
package com.vaadin.tests.components.treetable;
import com.vaadin.server.ExternalResource;
-import com.vaadin.tests.components.AbstractTestCase;
-import com.vaadin.ui.LegacyWindow;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Link;
import com.vaadin.ui.TreeTable;
-public class DisappearingComponents extends AbstractTestCase {
+public class DisappearingComponents extends AbstractTestUI {
@Override
- public void init() {
- LegacyWindow mainWindow = new LegacyWindow("Application");
+ public void setup(VaadinRequest request) {
final TreeTable tt = new TreeTable();
tt.setSizeUndefined();
tt.setWidth("100%");
@@ -33,13 +32,11 @@ public class DisappearingComponents extends AbstractTestCase {
tt.setChildrenAllowed(items[2], false);
tt.setParent(items[2], items[1]);
- mainWindow.addComponent(tt);
-
- setMainWindow(mainWindow);
+ addComponent(tt);
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "TreeTable column component empty after expand+collapse when pageLength is set to zero";
}
diff --git a/uitest/src/com/vaadin/tests/components/treetable/DisappearingComponentsTest.java b/uitest/src/com/vaadin/tests/components/treetable/DisappearingComponentsTest.java
new file mode 100644
index 0000000000..e4d97b9de1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/treetable/DisappearingComponentsTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2000-2014 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.treetable;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.TreeTableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that expanded cells with component contents aren't empty.
+ *
+ * @author Vaadin Ltd
+ */
+public class DisappearingComponentsTest extends MultiBrowserTest {
+
+ @Test
+ public void testNotification() throws InterruptedException {
+ openTestURL();
+
+ TreeTableElement treeTable = $(TreeTableElement.class).first();
+ treeTable.getCell(1, 0)
+ .findElement(By.className("v-treetable-treespacer")).click();
+ sleep(100);
+
+ WebElement link = treeTable.getCell(2, 1).findElement(
+ By.className("v-link"));
+ assertEquals("3", link.getText());
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.html b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.html
deleted file mode 100644
index 7f2f61bfc3..0000000000
--- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.html
+++ /dev/null
@@ -1,357 +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://arturwin.office.itmill.com: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/TreeTableItemDescriptionGeneratorTest?restartApplication</td>
- <td></td>
-</tr>
-<!--All on-->
-<!--Text tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Cell description item 1,Text</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<!--Button tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Button 1 description</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<!--TextField tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VTextField[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Textfield's own description</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<!--Cell and row tooltips-->
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]</td>
- <td>12,6</td>
-</tr>
-<!--Text tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Cell description item 1,Text</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<!--Button tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Cell description item 1,Component</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<!--TextField tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VTextField[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Cell description item 1,Generated component</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<!--Row and Component tooltips-->
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]</td>
- <td>7,8</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VCheckBox[0]/domChild[0]</td>
- <td>7,5</td>
-</tr>
-<!--Text tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Row description item 1</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<!--Button tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Button 1 description</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<!--TextField tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VTextField[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Textfield's own description</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<!--Row tooltips-->
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]</td>
- <td>7,8</td>
-</tr>
-<!--Text tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Row description item 1</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<!--Button tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Row description item 1</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<!--TextField tooltip-->
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VTextField[0]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>Row description item 1</td>
-</tr>
-<tr>
- <td>mouseMoveAt</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td>
- <td>22,7</td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUI.java
index 2864156b03..ba057f4c41 100644
--- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.java
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUI.java
@@ -15,14 +15,16 @@
*/
package com.vaadin.tests.components.treetable;
-import com.vaadin.tests.components.table.TableItemDescriptionGeneratorTest;
+import com.vaadin.tests.components.table.TableItemDescriptionGeneratorUI;
import com.vaadin.ui.Table;
import com.vaadin.ui.TreeTable;
-public class TreeTableItemDescriptionGeneratorTest extends
- TableItemDescriptionGeneratorTest {
+public class TreeTableItemDescriptionGeneratorUI extends
+ TableItemDescriptionGeneratorUI {
+
@Override
protected Table createTable() {
return new TreeTable();
}
+
}
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUITest.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUITest.java
new file mode 100644
index 0000000000..849d19cafa
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorUITest.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2000-2014 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.treetable;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.testbench.elements.CheckBoxElement;
+import com.vaadin.testbench.elements.TreeTableElement;
+import com.vaadin.tests.tb3.TooltipTest;
+
+/**
+ * Tests TreeTable tooltips with various settings.
+ *
+ * @author Vaadin Ltd
+ */
+public class TreeTableItemDescriptionGeneratorUITest extends TooltipTest {
+
+ @Test
+ public void testDescriptions() throws Exception {
+ openTestURL();
+
+ checkTooltipNotPresent();
+
+ TreeTableElement treeTable = $(TreeTableElement.class).first();
+ List<CheckBoxElement> checkboxes = $(CheckBoxElement.class).all();
+ assertEquals(3, checkboxes.size());
+
+ // check text description
+ TestBenchElement cell_1_0 = treeTable.getCell(1, 0);
+ checkTooltip(cell_1_0, "Cell description item 1, Text");
+
+ // move somewhere without a description
+ checkTooltip(checkboxes.get(2), null);
+
+ // check button description
+ TestBenchElement cell_1_1 = treeTable.getCell(1, 1);
+ checkTooltip(cell_1_1, "Button 1 description");
+
+ // move somewhere without a description
+ checkTooltip(checkboxes.get(2), null);
+
+ // check textfield's description
+ TestBenchElement cell_1_2 = treeTable.getCell(1, 2);
+ checkTooltip(cell_1_2, "Textfield's own description");
+
+ // move somewhere without a description
+ checkTooltip(checkboxes.get(2), null);
+
+ // uncheck component tooltips
+ checkboxes.get(0).findElement(By.tagName("input")).click();
+
+ // check text description
+ cell_1_0 = treeTable.getCell(1, 0);
+ checkTooltip(cell_1_0, "Cell description item 1, Text");
+
+ // move somewhere without a description
+ checkTooltip(checkboxes.get(2), null);
+
+ // check button description
+ cell_1_1 = treeTable.getCell(1, 1);
+ checkTooltip(cell_1_1, "Cell description item 1, Component");
+
+ // move somewhere without a description
+ checkTooltip(checkboxes.get(2), null);
+
+ // check textfield's description
+ cell_1_2 = treeTable.getCell(1, 2);
+ checkTooltip(cell_1_2, "Cell description item 1, Generated component");
+
+ // move somewhere without a description
+ checkTooltip(checkboxes.get(2), null);
+
+ // check component tooltips
+ checkboxes.get(0).findElement(By.tagName("input")).click();
+ // uncheck cell tooltips
+ checkboxes.get(1).findElement(By.tagName("input")).click();
+
+ // check text description
+ cell_1_0 = treeTable.getCell(1, 0);
+ checkTooltip(cell_1_0, "Row description item 1");
+
+ // move somewhere without a description
+ checkTooltip(checkboxes.get(2), null);
+
+ // check button description
+ cell_1_1 = treeTable.getCell(1, 1);
+ checkTooltip(cell_1_1, "Button 1 description");
+
+ // move somewhere without a description
+ checkTooltip(checkboxes.get(2), null);
+
+ // check textfield's description
+ cell_1_2 = treeTable.getCell(1, 2);
+ checkTooltip(cell_1_2, "Textfield's own description");
+
+ // move somewhere without a description
+ checkTooltip(checkboxes.get(2), null);
+
+ // uncheck component tooltips
+ checkboxes.get(0).findElement(By.tagName("input")).click();
+
+ // check text description
+ cell_1_0 = treeTable.getCell(1, 0);
+ checkTooltip(cell_1_0, "Row description item 1");
+
+ // move somewhere without a description
+ checkTooltip(checkboxes.get(2), null);
+
+ // check button description
+ cell_1_1 = treeTable.getCell(1, 1);
+ checkTooltip(cell_1_1, "Row description item 1");
+
+ // move somewhere without a description
+ checkTooltip(checkboxes.get(2), null);
+
+ // check textfield's description
+ cell_1_2 = treeTable.getCell(1, 2);
+ checkTooltip(cell_1_2, "Row description item 1");
+
+ // move somewhere without a description
+ checkTooltip(checkboxes.get(2), null);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.html b/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.html
deleted file mode 100644
index b8d6cdb22e..0000000000
--- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.html
+++ /dev/null
@@ -1,37 +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>TreeTableOutOfSync</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TreeTableOutOfSync</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.treetable.TreeTableOutOfSync?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstreetableTreeTableOutOfSync::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>10,7</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstreetableTreeTableOutOfSync::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[2]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>verifyTextNotPresent</td>
- <td>Something has caused us to be out of sync with the server.<br />Take note of any unsaved data, and click here to re-sync.</td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java
index 7f4aa7f671..b8a0ac61c2 100644
--- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSync.java
@@ -15,16 +15,18 @@
*/
package com.vaadin.tests.components.treetable;
-import com.vaadin.tests.components.TestBase;
+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.Notification;
import com.vaadin.ui.Table;
import com.vaadin.ui.TreeTable;
-public class TreeTableOutOfSync extends TestBase {
+public class TreeTableOutOfSync extends AbstractTestUI {
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
TreeTable tt = new TreeTable();
tt.addContainerProperty("i", Integer.class, null);
tt.addGeneratedColumn("text", new Table.ColumnGenerator() {
@@ -35,10 +37,10 @@ public class TreeTableOutOfSync extends TestBase {
Button button = new Button("text "
+ source.getContainerDataSource().getItem(itemId)
.getItemProperty("i").getValue());
- button.addListener(new Button.ClickListener() {
+ button.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
- getMainWindow().showNotification("click");
+ Notification.show("click");
}
});
return button;
@@ -56,7 +58,7 @@ public class TreeTableOutOfSync extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "When a root node is expanded, components created by a column generator go out of sync";
}
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSyncTest.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSyncTest.java
new file mode 100644
index 0000000000..0831232df7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableOutOfSyncTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2014 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.treetable;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.TreeTableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that opening the root node and clicking a generated component doesn't
+ * cause out of sync (or any other system notifications).
+ *
+ * @author Vaadin Ltd
+ */
+public class TreeTableOutOfSyncTest extends MultiBrowserTest {
+
+ @Test
+ public void testNotification() throws InterruptedException {
+ openTestURL();
+
+ TreeTableElement treeTable = $(TreeTableElement.class).first();
+ List<WebElement> rows = treeTable.findElement(
+ By.className("v-table-body")).findElements(By.tagName("tr"));
+
+ WebElement treeSpacer = rows.get(0).findElement(
+ By.className("v-treetable-treespacer"));
+ treeSpacer.click();
+
+ sleep(100);
+
+ rows = treeTable.findElement(By.className("v-table-body"))
+ .findElements(By.tagName("tr"));
+ WebElement button = rows.get(2).findElement(By.className("v-button"));
+ button.click();
+
+ List<WebElement> notifications = findElements(By
+ .className("v-Notification-system"));
+ assertTrue(notifications.isEmpty());
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemText.java b/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemText.java
new file mode 100644
index 0000000000..d4599fc1a3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemText.java
@@ -0,0 +1,43 @@
+package com.vaadin.tests.components.ui;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Label;
+
+public class ComboboxSelectedItemText extends AbstractTestUIWithLog {
+ @Override
+ protected void setup(VaadinRequest request) {
+ getLayout()
+ .addComponent(
+ new Label(
+ "Select first ANTIGUA AND BARBUDA from the first combobox. Then select ANTIGUA AND BARBUDA from the second combobox. Finally, click the popup button on the first combobox. Before fix you would see UA AND BAR in the field."));
+
+ ComboBox combobox = new ComboBox("Text input enabled:");
+ combobox.setWidth("100px");
+
+ combobox.addItem("AMERICAN SAMOA");
+ combobox.addItem("ANTIGUA AND BARBUDA");
+
+ ComboBox combobox2 = new ComboBox("Text input disabled:");
+ combobox2.setWidth("100px");
+ combobox2.setTextInputAllowed(false);
+
+ combobox2.addItem("AMERICAN SAMOA");
+ combobox2.addItem("ANTIGUA AND BARBUDA");
+
+ getLayout().addComponent(combobox);
+ getLayout().addComponent(combobox2);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Tests selected item is displayed from the beginning";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 13477;
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java b/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java
new file mode 100644
index 0000000000..f826654022
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.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.ui;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Test class for issue #13477, where selecting a combobox item that is too long
+ * would render the ending of an item instead of the beginning, which was
+ * considered less than informative.
+ *
+ * @author Vaadin Ltd
+ */
+
+public class ComboboxSelectedItemTextTest extends MultiBrowserTest {
+
+ public final String SCREENSHOT_NAME_EDITABLE = "LongComboboxItemSelectedEditable";
+ public final String SCREENSHOT_NAME_NON_EDITABLE = "LongComboboxItemSelectedNonEditable";
+ public final int INDEX_EDITABLE_COMBOBOX = 1;
+ public final int INDEX_NON_EDITABLE_COMBOBOX = 2;
+
+ @Test
+ public void testCombobox() throws IOException {
+ testCombobox(INDEX_EDITABLE_COMBOBOX, INDEX_NON_EDITABLE_COMBOBOX,
+ SCREENSHOT_NAME_EDITABLE);
+ }
+
+ @Test
+ public void testComboboxNonEditable() throws IOException {
+ testCombobox(INDEX_NON_EDITABLE_COMBOBOX, INDEX_EDITABLE_COMBOBOX,
+ SCREENSHOT_NAME_NON_EDITABLE);
+ }
+
+ private void testCombobox(int indexToTest, int indexToFocus,
+ String screenshotIdentifier) throws IOException {
+ openTestURL();
+
+ WebElement comboBox = vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot["
+ + indexToTest + "]/VFilterSelect[0]");
+ WebElement comboBoxFocus = vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot["
+ + indexToFocus + "]/VFilterSelect[0]");
+
+ // Select an element from the first (editable) combobox.
+
+ comboBox.findElement(By.className("v-filterselect-button")).click();
+ WebElement comboBoxPopup = vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot["
+ + indexToTest + "]/VFilterSelect[0]#popup");
+ comboBoxPopup.findElements(By.tagName("td")).get(2).click();
+
+ // Select an element from the second (non-editable combobox) to remove
+ // focus from the first combobox
+
+ comboBoxFocus.findElement(By.className("v-filterselect-button"))
+ .click();
+ comboBoxPopup = vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot["
+ + indexToFocus + "]/VFilterSelect[0]#popup");
+ comboBoxPopup.findElements(By.tagName("td")).get(2).click();
+
+ // click the popup on the first combobox. This would reveal the unwanted
+ // behaviour.
+
+ comboBox.findElement(By.className("v-filterselect-button")).click();
+
+ // sadly, screenshot comparison is the only reasonable way to test a
+ // rendering issue.
+
+ compareScreen(screenshotIdentifier);
+
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/window/BottomComponentScrollsUp.java b/uitest/src/com/vaadin/tests/components/window/BottomComponentScrollsUp.java
new file mode 100644
index 0000000000..2c5e415408
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/BottomComponentScrollsUp.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2000-2014 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 java.util.ArrayList;
+import java.util.List;
+
+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.Panel;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+
+/**
+ * Reproducing bug #12943 where an action on a Button or ComboBox placed at the
+ * bottom of a window in a scroll panel, will scroll up the parent panel.
+ *
+ * This was due to the fact that with the state confirmation notification from
+ * the server, the window.setVisible would be call again, and the hack that
+ * solved the scrollbars in a window (#11994) would cause the our bug.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+@SuppressWarnings("serial")
+public class BottomComponentScrollsUp extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Button b = new Button("Open window");
+ addComponent(b);
+ b.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ openWindow();
+ }
+
+ });
+
+ openWindow();
+ }
+
+ private void openWindow() {
+ Window w = new Window();
+ w.setWidth("300px");
+ w.setHeight("300px");
+ w.center();
+
+ Panel p = createPanel();
+ p.setSizeFull();
+
+ w.setContent(p);
+
+ addWindow(w);
+ }
+
+ private Panel createPanel() {
+ Panel p = new Panel();
+
+ VerticalLayout content = new VerticalLayout();
+ p.setContent(content);
+ content.setHeight("500px");
+
+ List<String> items = new ArrayList<String>();
+ items.add("1");
+ items.add("2");
+ items.add("3");
+
+ Button button = new Button("Press me");
+ content.addComponent(button);
+ content.setComponentAlignment(button, Alignment.BOTTOM_CENTER);
+ return p;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Interacting with a component at the bottom of scrollable panel within a subwindow scrolls up";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 12943;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/BottomComponentScrollsUpTest.java b/uitest/src/com/vaadin/tests/components/window/BottomComponentScrollsUpTest.java
new file mode 100644
index 0000000000..3d0da2677b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/BottomComponentScrollsUpTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2000-2014 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 java.io.IOException;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Dimension;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Automatic test for fix for #12943.
+ *
+ * While testing without the fix, the test failed on both Chrome and PhantomJS.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class BottomComponentScrollsUpTest extends MultiBrowserTest {
+
+ @Override
+ public void setup() throws Exception {
+ super.setup();
+
+ openTestURL();
+ }
+
+ @Test
+ public void windowScrollTest() throws IOException, InterruptedException {
+ TestBenchElement panelScrollable = (TestBenchElement) getDriver()
+ .findElement(By.className("v-panel-content"));
+ Dimension panelScrollableSize = panelScrollable.getSize();
+
+ WebElement verticalLayout = panelScrollable.findElement(By
+ .className("v-verticallayout"));
+ Dimension verticalLayoutSize = verticalLayout.getSize();
+
+ panelScrollable.scroll(verticalLayoutSize.height);
+
+ WebElement button = verticalLayout
+ .findElement(By.className("v-button"));
+
+ button.click();
+
+ // Loose the focus from the button.
+ new Actions(getDriver())
+ .moveToElement(panelScrollable, panelScrollableSize.width / 2,
+ panelScrollableSize.height / 2).click().build()
+ .perform();
+
+ compareScreen("window");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java b/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java
deleted file mode 100644
index 412fd3049d..0000000000
--- a/uitest/src/com/vaadin/tests/components/window/TooltipInWindowTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2000-2014 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 InterruptedException {
- openTestURL();
-
- WebElement textfield = vaadinElementById("tf1");
- Coordinates textfieldCoordinates = ((Locatable) textfield)
- .getCoordinates();
-
- Mouse mouse = ((HasInputDevices) getDriver()).getMouse();
-
- // Show tooltip
- mouse.mouseMove(textfieldCoordinates, 10, 10);
-
- sleep(100);
- ensureVisibleTooltipPositionedCorrectly();
- assertEquals("My tooltip", getTooltipElement().getText());
-
- // Hide tooltip
- mouse.mouseMove(textfieldCoordinates, -100, -100);
- sleep(2000);
-
- ensureHiddenTooltipPositionedCorrectly();
- assertEquals("", getTooltipElement().getText());
-
- // Show tooltip again
- mouse.mouseMove(textfieldCoordinates, 10, 10);
-
- sleep(100);
- ensureVisibleTooltipPositionedCorrectly();
- assertEquals("My tooltip", getTooltipElement().getText());
-
- // Hide tooltip
- mouse.mouseMove(textfieldCoordinates, -100, -100);
- sleep(2000);
-
- ensureHiddenTooltipPositionedCorrectly();
- assertEquals("", getTooltipElement().getText());
-
- }
-
- 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/components/window/WindowMoveListenerTest.java b/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java
index e067ada818..8d74e3a259 100644
--- a/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java
+++ b/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java
@@ -43,12 +43,13 @@ public class WindowMoveListenerTest extends MultiBrowserTest {
waitUntilWindowHasReseted(window, winPos);
}
- private void waitUntilWindowHasReseted(final WebElement window, final Point winPos) {
+ private void waitUntilWindowHasReseted(final WebElement window,
+ final Point winPos) {
waitUntil(new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver input) {
- return winPos.x == window.getLocation().x &&
- winPos.y == window.getLocation().y;
+ return winPos.x == window.getLocation().x
+ && winPos.y == window.getLocation().y;
}
}, 5);
}
diff --git a/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutWidthChangeTest.java b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutWidthChangeTest.java
index 52ea5f4f8e..ba3d0f06f1 100644
--- a/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutWidthChangeTest.java
+++ b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutWidthChangeTest.java
@@ -17,7 +17,8 @@ public class GridLayoutWidthChangeTest extends MultiBrowserTest {
compareScreen("initial");
- $(ButtonElement.class).caption("Reduce GridLayout parent width").first().click();
+ $(ButtonElement.class).caption("Reduce GridLayout parent width")
+ .first().click();
compareScreen("buttonMoved");
}
diff --git a/uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java
new file mode 100644
index 0000000000..fc37455752
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2000-2014 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.layouts.gridlayout;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+
+/**
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class GridSpanEmptyColumns extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ GridLayout gridLayout = new GridLayout(3, 1);
+ gridLayout.setWidth("1000px");
+
+ Label bigCell = new Label("big cell");
+ bigCell.setId("bigCell");
+ Label smallCell = new Label("small cell");
+ smallCell.setId("smallCell");
+ gridLayout.addComponent(bigCell, 0, 0, 1, 0); // spans first two columns
+ gridLayout.addComponent(smallCell, 2, 0, 2, 0); // last column only
+
+ addComponent(gridLayout);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "A 3x1 grid has a spanned component on the first two cells and a component on the last cell. The two components should occupy 2/3 and 1/3 of the available space respectively, instead of 1/2 each.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14335;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumnsTest.java b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumnsTest.java
new file mode 100644
index 0000000000..f2b86fb69b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumnsTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2000-2014 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.layouts.gridlayout;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that GridLayout handles elements spanning otherwise empty columns
+ * correctly (#14335)
+ *
+ * @since 7.2.5
+ * @author markus
+ */
+public class GridSpanEmptyColumnsTest extends MultiBrowserTest {
+
+ @Test
+ public void componentsShouldMoveRight() throws IOException {
+ openTestURL();
+
+ LabelElement bigCell = $(LabelElement.class).id("bigCell");
+ LabelElement smallCell = $(LabelElement.class).id("smallCell");
+
+ // Width is 1000px. Big cell should take up 2/3, small cell should take
+ // up 1/3.
+ assertEquals(667, bigCell.getSize().width);
+ assertEquals(333, smallCell.getSize().width);
+
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMove.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMove.java
index 2771af01c6..84254b4935 100644
--- a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMove.java
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMove.java
@@ -36,7 +36,7 @@ public class GridAddReplaceMove extends GridBaseLayoutTestUI {
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
* VaadinRequest)
*/
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMove.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMove.java
index 1c0e992a86..c4787045fc 100644
--- a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMove.java
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HAddReplaceMove.java
@@ -19,7 +19,6 @@ import com.vaadin.annotations.Theme;
import com.vaadin.tests.layouts.layouttester.BaseAddReplaceMove;
import com.vaadin.ui.HorizontalLayout;
-
public class HAddReplaceMove extends BaseAddReplaceMove {
/**
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HCaption.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HCaption.java
index bb974a8c68..3088a00c39 100644
--- a/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HCaption.java
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HLayout/HCaption.java
@@ -19,7 +19,6 @@ import com.vaadin.annotations.Theme;
import com.vaadin.tests.layouts.layouttester.BaseCaption;
import com.vaadin.ui.HorizontalLayout;
-
public class HCaption extends BaseCaption {
/**
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutExpandTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutExpandTest.java
index 57bb134be7..152e3f0b86 100644
--- a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutExpandTest.java
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutExpandTest.java
@@ -17,7 +17,6 @@ package com.vaadin.tests.layouts.layouttester.VLayout;
import com.vaadin.tests.layouts.layouttester.BaseLayoutExpandTest;
-
/**
*
* @since
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegErrorTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegErrorTest.java
index e3e5914e3a..7f803781fb 100644
--- a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegErrorTest.java
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutRegErrorTest.java
@@ -17,7 +17,6 @@ package com.vaadin.tests.layouts.layouttester.VLayout;
import com.vaadin.tests.layouts.layouttester.BaseLayoutRegErrorTest;
-
/**
*
* @since
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizingTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizingTest.java
index 372eb9cba4..519f8113f8 100644
--- a/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizingTest.java
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VLayout/VLayoutSizingTest.java
@@ -17,7 +17,6 @@ package com.vaadin.tests.layouts.layouttester.VLayout;
import com.vaadin.tests.layouts.layouttester.BaseLayoutSizingTest;
-
/**
*
* @since
diff --git a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java
index 06ddc07abb..5dc15f8fc6 100644
--- a/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java
+++ b/uitest/src/com/vaadin/tests/push/ExtremelyLongPushTimeTest.java
@@ -36,7 +36,7 @@ public abstract class ExtremelyLongPushTimeTest extends MultiBrowserTest {
testBench(driver).disableWaitForVaadin();
// Wait for startButton to be present
- waitForElementToBePresent(vaadinLocatorById("startButton"));
+ waitForElementVisible(vaadinLocatorById("startButton"));
String logRow0Id = "Log_row_0";
By logRow0 = vaadinLocatorById(logRow0Id);
diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationLongPollingTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationLongPollingTest.java
index f2207ccba7..a04d569e05 100644
--- a/uitest/src/com/vaadin/tests/push/PushConfigurationLongPollingTest.java
+++ b/uitest/src/com/vaadin/tests/push/PushConfigurationLongPollingTest.java
@@ -37,7 +37,8 @@ public class PushConfigurationLongPollingTest extends PushConfigurationTest {
clearDebugMessages();
new Select(getPushModeSelect()).selectByVisibleText("AUTOMATIC");
- waitForDebugMessage("Push connection established using long-polling", 10);
+ waitForDebugMessage("Push connection established using long-polling",
+ 10);
waitForServerCounterToUpdate();
}
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java
index 00ee6bae25..e37bd32832 100644
--- a/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java
+++ b/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java
@@ -42,7 +42,7 @@ public class PushLargeDataLongPollingTest extends MultiBrowserTest {
private void push() throws InterruptedException {
// Wait for startButton to be present
- waitForElementToBePresent(vaadinLocatorById("startButton"));
+ waitForElementVisible(vaadinLocatorById("startButton"));
String logRow0Id = "Log_row_0";
By logRow0 = vaadinLocatorById(logRow0Id);
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java
index 26fa512ab2..058ac6cc92 100644
--- a/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java
+++ b/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java
@@ -42,7 +42,7 @@ public class PushLargeDataStreamingTest extends MultiBrowserTest {
private void push() throws InterruptedException {
// Wait for startButton to be present
- waitForElementToBePresent(vaadinLocatorById("startButton"));
+ waitForElementVisible(vaadinLocatorById("startButton"));
String logRow0Id = "Log_row_0";
By logRow0 = vaadinLocatorById(logRow0Id);
diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java
index 57fb8c33b0..da4999799d 100644
--- a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java
+++ b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java
@@ -40,7 +40,7 @@ public class PushLargeDataWebsocketTest extends WebsocketTest {
private void push() throws Exception {
// Wait for startButton to be present
- waitForElementToBePresent(vaadinLocatorById("startButton"));
+ waitForElementVisible(vaadinLocatorById("startButton"));
String logRow0Id = "Log_row_0";
By logRow0 = vaadinLocatorById(logRow0Id);
diff --git a/uitest/src/com/vaadin/tests/push/ReconnectLongPollingTest.java b/uitest/src/com/vaadin/tests/push/ReconnectLongPollingTest.java
index 8a4593d70d..28ef30a04a 100644
--- a/uitest/src/com/vaadin/tests/push/ReconnectLongPollingTest.java
+++ b/uitest/src/com/vaadin/tests/push/ReconnectLongPollingTest.java
@@ -15,7 +15,6 @@
*/
package com.vaadin.tests.push;
-
public class ReconnectLongPollingTest extends ReconnectTest {
@Override
diff --git a/uitest/src/com/vaadin/tests/push/ReconnectStreamingTest.java b/uitest/src/com/vaadin/tests/push/ReconnectStreamingTest.java
index fe63764e78..0a0275c4d0 100755
--- a/uitest/src/com/vaadin/tests/push/ReconnectStreamingTest.java
+++ b/uitest/src/com/vaadin/tests/push/ReconnectStreamingTest.java
@@ -15,7 +15,6 @@
*/
package com.vaadin.tests.push;
-
public class ReconnectStreamingTest extends ReconnectTest {
@Override
diff --git a/uitest/src/com/vaadin/tests/push/RefreshCloseConnection.java b/uitest/src/com/vaadin/tests/push/RefreshCloseConnection.java
new file mode 100644
index 0000000000..4d02c4e62e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/RefreshCloseConnection.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2014 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.PreserveOnRefresh;
+import com.vaadin.annotations.Push;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+
+@Push
+@PreserveOnRefresh
+public class RefreshCloseConnection extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ log("Init");
+ }
+
+ @Override
+ protected void refresh(VaadinRequest request) {
+ if (getPushConnection().isConnected()) {
+ log("Still connected");
+ }
+ log("Refresh");
+ new Thread() {
+ @Override
+ public void run() {
+ accessSynchronously(new Runnable() {
+ @Override
+ public void run() {
+ log("Push");
+ }
+ });
+ }
+ }.start();
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "A log row should get pushed after reloading the page";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(14251);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java b/uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java
new file mode 100644
index 0000000000..c5c6064555
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2000-2014 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.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.tb3.WebsocketTest;
+
+public class RefreshCloseConnectionTest extends MultiBrowserTest {
+ @Test
+ public void testSessionRefresh() {
+ openTestURL();
+
+ Assert.assertEquals("1. Init", getLogRow(0));
+
+ openTestURL();
+
+ Assert.assertEquals("2. Refresh", getLogRow(1));
+ Assert.assertEquals("3. Push", getLogRow(0));
+ }
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ return WebsocketTest.getWebsocketBrowsers();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index 8dd10216d2..1c5fb380ab 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -16,6 +16,8 @@
package com.vaadin.tests.tb3;
+import static com.vaadin.tests.tb3.TB3Runner.localWebDriverIsUsed;
+
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -24,11 +26,15 @@ import java.net.URL;
import java.util.Collections;
import java.util.List;
-import com.vaadin.testbench.TestBenchElement;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
-import org.openqa.selenium.*;
+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.ie.InternetExplorerDriver;
import org.openqa.selenium.interactions.HasInputDevices;
import org.openqa.selenium.interactions.Keyboard;
import org.openqa.selenium.interactions.Mouse;
@@ -45,13 +51,12 @@ import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
import com.vaadin.server.LegacyApplication;
import com.vaadin.server.UIProvider;
import com.vaadin.testbench.TestBench;
+import com.vaadin.testbench.TestBenchElement;
import com.vaadin.testbench.TestBenchTestCase;
import com.vaadin.tests.components.AbstractTestUIWithLog;
import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
import com.vaadin.ui.UI;
-import static com.vaadin.tests.tb3.TB3Runner.localWebDriverIsUsed;
-
/**
* Base class for TestBench 3+ tests. All TB3+ tests in the project should
* extend this class.
@@ -85,6 +90,8 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
*/
private static final int BROWSER_TIMEOUT_IN_MS = 30 * 1000;
+ private static final int BROWSER_INIT_ATTEMPTS = 5;
+
private DesiredCapabilities desiredCapabilities;
private boolean debug = false;
@@ -134,9 +141,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
if (localWebDriverIsUsed()) {
setupLocalDriver(capabilities);
} else {
- WebDriver dr = TestBench.createDriver(new RemoteWebDriver(
- new URL(getHubURL()), capabilities));
- setDriver(dr);
+ setupRemoteDriver(capabilities);
}
}
@@ -166,7 +171,8 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
}
protected WebElement getTooltipElement() {
- return getDriver().findElement(com.vaadin.testbench.By.className("v-tooltip-text"));
+ return getDriver().findElement(
+ com.vaadin.testbench.By.className("v-tooltip-text"));
}
protected Coordinates getCoordinates(TestBenchElement element) {
@@ -218,12 +224,53 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
DesiredCapabilities desiredCapabilities);
/**
+ * Creates a {@link WebDriver} instance used for running the test remotely.
+ *
+ * @since
+ * @param capabilities
+ * the type of browser needed
+ * @throws Exception
+ */
+ private void setupRemoteDriver(DesiredCapabilities capabilities)
+ throws Exception {
+ for (int i = 1; i <= BROWSER_INIT_ATTEMPTS; i++) {
+ try {
+ WebDriver dr = TestBench.createDriver(new RemoteWebDriver(
+ new URL(getHubURL()), capabilities));
+ setDriver(dr);
+ } catch (Exception e) {
+ System.err.println("Browser startup for " + capabilities
+ + " failed on attempt " + i + ": " + e.getMessage());
+ if (i == BROWSER_INIT_ATTEMPTS) {
+ throw e;
+ }
+ }
+ }
+
+ }
+
+ /**
* Opens the given test (defined by {@link #getTestUrl()}, optionally with
* debug window and/or push (depending on {@link #isDebug()} and
* {@link #isPush()}.
*/
protected void openTestURL() {
- driver.get(getTestUrl());
+ openTestURL("");
+ }
+
+ /**
+ * Opens the given test (defined by {@link #getTestUrl()}, optionally with
+ * debug window and/or push (depending on {@link #isDebug()} and
+ * {@link #isPush()}.
+ */
+ protected void openTestURL(String extraParameters) {
+ String url = getTestUrl();
+ if (url.contains("?")) {
+ url = url + "&" + extraParameters;
+ } else {
+ url = url + "?" + extraParameters;
+ }
+ driver.get(url);
}
/**
@@ -341,8 +388,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
* @return Focused element or null
*/
protected WebElement getFocusedElement() {
- Object focusedElement = ((JavascriptExecutor) getDriver())
- .executeScript("return document.activeElement");
+ Object focusedElement = executeScript("return document.activeElement");
if (null != focusedElement) {
return (WebElement) focusedElement;
} else {
@@ -351,6 +397,19 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
}
/**
+ * Executes the given Javascript
+ *
+ * @param script
+ * the script to execute
+ * @return whatever
+ * {@link org.openqa.selenium.JavascriptExecutor#executeScript(String, Object...)}
+ * returns
+ */
+ protected Object executeScript(String script) {
+ return ((JavascriptExecutor) getDriver()).executeScript(script);
+ }
+
+ /**
* Find a Vaadin element based on its id given using Component.setId
*
* @param id
@@ -396,7 +455,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
* @param condition
* the condition to wait for to become true
*/
- protected void waitUntil(ExpectedCondition<Boolean> condition) {
+ protected <T> void waitUntil(ExpectedCondition<T> condition) {
waitUntil(condition, 10);
}
@@ -408,7 +467,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
* @param condition
* the condition to wait for to become true
*/
- protected void waitUntil(ExpectedCondition<Boolean> condition,
+ protected <T> void waitUntil(ExpectedCondition<T> condition,
long timeoutInSeconds) {
new WebDriverWait(driver, timeoutInSeconds).until(condition);
}
@@ -421,7 +480,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
* @param condition
* the condition to wait for to become false
*/
- protected void waitUntilNot(ExpectedCondition<Boolean> condition) {
+ protected <T> void waitUntilNot(ExpectedCondition<T> condition) {
waitUntilNot(condition, 10);
}
@@ -433,14 +492,42 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
* @param condition
* the condition to wait for to become false
*/
- protected void waitUntilNot(ExpectedCondition<Boolean> condition,
+ protected <T> void waitUntilNot(ExpectedCondition<T> condition,
long timeoutInSeconds) {
waitUntil(ExpectedConditions.not(condition), timeoutInSeconds);
}
- protected void waitForElementToBePresent(By by) {
- waitUntil(ExpectedConditions.not(ExpectedConditions
- .invisibilityOfElementLocated(by)));
+ protected void waitForElementPresent(final By by) {
+ waitUntil(ExpectedConditions.presenceOfElementLocated(by));
+ }
+
+ protected void waitForElementVisible(final By by) {
+ waitUntil(ExpectedConditions.visibilityOfElementLocated(by));
+ }
+
+ /**
+ * Checks if the given element has the given class name.
+ *
+ * Matches only full class names, i.e. has ("foo") does not match
+ * class="foobar"
+ *
+ * @param element
+ * @param className
+ * @return
+ */
+ protected boolean hasCssClass(WebElement element, String className) {
+ String classes = element.getAttribute("class");
+ if (classes == null || classes.isEmpty()) {
+ return (className == null || className.isEmpty());
+ }
+
+ for (String cls : classes.split(" ")) {
+ if (className.equals(cls)) {
+ return true;
+ }
+ }
+
+ return false;
}
/**
@@ -817,6 +904,8 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
public static DesiredCapabilities ie(int version) {
DesiredCapabilities c = DesiredCapabilities.internetExplorer();
c.setVersion("" + version);
+ c.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION,
+ true);
return c;
}
diff --git a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
index 15ca97f701..ff824ad98a 100644
--- a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
+++ b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2013 Vaadind 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
@@ -28,6 +28,7 @@ import java.util.Properties;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.phantomjs.PhantomJSDriver;
@@ -41,7 +42,7 @@ import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
* Provides values for parameters which depend on where the test is run.
* Parameters should be configured in work/eclipse-run-selected-test.properties.
* A template is available in uitest/.
- *
+ *
* @author Vaadin Ltd
*/
public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
@@ -105,7 +106,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
/**
* Gets the hostname that tests are configured to use.
- *
+ *
* @return the host name configuration value
*/
public static String getConfiguredDeploymentHostname() {
@@ -125,7 +126,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
/**
* Gets the port that tests are configured to use.
- *
+ *
* @return the port configuration value
*/
public static int getConfiguredDeploymentPort() {
@@ -142,7 +143,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
/**
* Tries to automatically determine the IP address of the machine the test
* is running on.
- *
+ *
* @return An IP address of one of the network interfaces in the machine.
* @throws RuntimeException
* if there was an error or no IP was found
@@ -179,7 +180,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.tests.tb3.AbstractTB3Test#setupLocalDriver()
*/
@Override
@@ -209,7 +210,13 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
+ " containing the path of your local ChromeDriver installation.");
}
System.setProperty("webdriver.chrome.driver", chromeDriverPath);
- driver = new ChromeDriver();
+
+ // Tells chrome not to show warning
+ // "You are using an unsupported command-line flag: --ignore-certifcate-errors".
+ // #14319
+ ChromeOptions options = new ChromeOptions();
+ options.addArguments("--test-type ");
+ driver = new ChromeDriver(options);
} else if (BrowserUtil.isSafari(desiredCapabilities)) {
driver = new SafariDriver();
} else if (BrowserUtil.isPhantomJS(desiredCapabilities)) {
diff --git a/uitest/src/com/vaadin/tests/tb3/TB3Runner.java b/uitest/src/com/vaadin/tests/tb3/TB3Runner.java
index 5b5a6dcf39..0d540644bf 100644
--- a/uitest/src/com/vaadin/tests/tb3/TB3Runner.java
+++ b/uitest/src/com/vaadin/tests/tb3/TB3Runner.java
@@ -17,8 +17,10 @@
package com.vaadin.tests.tb3;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
@@ -26,6 +28,8 @@ import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runners.BlockJUnit4ClassRunner;
@@ -34,6 +38,8 @@ import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.Statement;
import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.HttpCommandExecutor;
+import org.openqa.selenium.remote.internal.HttpClientFactory;
import com.vaadin.tests.annotations.TestCategory;
import com.vaadin.tests.tb3.AbstractTB3Test.BrowserUtil;
@@ -50,6 +56,13 @@ import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
public class TB3Runner extends BlockJUnit4ClassRunner {
/**
+ * Socket timeout for HTTP connections to the grid hub. The connection is
+ * closed after 30 minutes of inactivity to avoid builds hanging for up to
+ * three hours per connection if the test client crashes/hangs.
+ */
+ private static final int SOCKET_TIMEOUT = 30 * 60 * 1000;
+
+ /**
* This is the total limit of actual JUnit test instances run in parallel
*/
private static final int MAX_CONCURRENT_TESTS;
@@ -67,12 +80,34 @@ public class TB3Runner extends BlockJUnit4ClassRunner {
MAX_CONCURRENT_TESTS = 50;
}
service = Executors.newFixedThreadPool(MAX_CONCURRENT_TESTS);
+
+ // reduce socket timeout to avoid tests hanging for three hours
+ try {
+ Field field = HttpCommandExecutor.class
+ .getDeclaredField("httpClientFactory");
+ assert (Modifier.isStatic(field.getModifiers()));
+ field.setAccessible(true);
+ field.set(null, new HttpClientFactory() {
+ @Override
+ public HttpParams getHttpParams() {
+ HttpParams params = super.getHttpParams();
+ // fifteen minute timeout
+ HttpConnectionParams.setSoTimeout(params, SOCKET_TIMEOUT);
+ return params;
+ }
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException(
+ "Changing socket timeout for TestBench failed", e);
+ }
}
protected static boolean localWebDriverIsUsed() {
String useLocalWebDriver = System.getProperty("useLocalWebDriver");
- return useLocalWebDriver != null && useLocalWebDriver.toLowerCase().equals("true");
+ return useLocalWebDriver != null
+ && useLocalWebDriver.toLowerCase().equals("true");
}
public TB3Runner(Class<?> klass) throws InitializationError {
diff --git a/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFly.java b/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFly.java
new file mode 100644
index 0000000000..ec22edd205
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFly.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.themes;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.tests.util.PersonContainer;
+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.Image;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+
+@Theme("reindeer")
+public class ThemeChangeOnTheFly extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Button inject = new Button("Inject blue background");
+ inject.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ getPage().getStyles().add(
+ ".v-app { background: blue !important;}");
+
+ }
+ });
+ addComponent(inject);
+
+ GridLayout gl = new GridLayout(2, 4);
+ gl.setCaption("Change theme by clicking a button");
+ for (final String theme : new String[] { "reindeer", "runo",
+ "chameleon", "base", null }) {
+ Button b = new Button(theme);
+ b.setId(theme + "");
+ b.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ getUI().setTheme(theme);
+ }
+ });
+ gl.addComponent(b);
+ }
+
+ Table t = new Table();
+ PersonContainer pc = PersonContainer.createWithTestData();
+ pc.addNestedContainerBean("address");
+ t.setContainerDataSource(pc);
+ gl.addComponent(t, 0, 3, 1, 3);
+ gl.setRowExpandRatio(3, 1);
+
+ gl.setWidth("500px");
+ gl.setHeight("800px");
+
+ HorizontalLayout images = new HorizontalLayout();
+ images.setSpacing(true);
+
+ Label l = new Label("Chameleon theme image in caption");
+ l.setIcon(new ThemeResource("img/magnifier.png"));
+ images.addComponent(l);
+ Image image = new Image("Runo theme image", new ThemeResource(
+ "icons/64/ok.png"));
+ images.addComponent(image);
+ image = new Image("Reindeer theme image", new ThemeResource(
+ "button/img/left-focus.png"));
+ images.addComponent(image);
+ addComponent(images);
+ addComponent(gl);
+
+ getLayout().setSpacing(true);
+
+ Window w = new Window();
+ w.setContent(new VerticalLayout(new Button("Button in window")));
+ addWindow(w);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Test that you can change theme on the fly";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2874;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java b/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java
new file mode 100644
index 0000000000..eb010e82ee
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.themes;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class ThemeChangeOnTheFlyTest extends MultiBrowserTest {
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ // Seems like stylesheet onload is not fired on PhantomJS
+ // https://github.com/ariya/phantomjs/issues/12332
+ List<DesiredCapabilities> l = super.getBrowsersToTest();
+ l.remove(Browser.PHANTOMJS.getDesiredCapabilities());
+ return l;
+ }
+
+ @Test
+ public void injectedStyleAndThemeChange() throws IOException {
+ openTestURL();
+ $(ButtonElement.class).caption("Inject blue background").first()
+ .click();
+ changeTheme("runo");
+ compareScreen("runo-blue-background");
+ }
+
+ @Test
+ public void reindeerToOthers() throws IOException {
+ openTestURL();
+ compareScreen("reindeer");
+
+ changeThemeAndCompare("runo");
+ changeThemeAndCompare("chameleon");
+ changeThemeAndCompare("base");
+
+ }
+
+ @Test
+ public void runoToReindeer() throws IOException {
+ openTestURL("theme=runo");
+ compareScreen("runo");
+ changeThemeAndCompare("reindeer");
+ }
+
+ @Test
+ public void reindeerToNullToReindeer() throws IOException {
+ openTestURL();
+
+ changeThemeAndCompare("null");
+ changeThemeAndCompare("reindeer");
+ }
+
+ private void changeThemeAndCompare(String theme) throws IOException {
+ changeTheme(theme);
+ compareScreen(theme);
+ }
+
+ private void changeTheme(String theme) {
+ $(ButtonElement.class).id(theme).click();
+ if (theme.equals("null")) {
+ waitForThemeToChange("");
+ assertOverlayTheme("");
+ } else {
+ waitForThemeToChange(theme);
+ assertOverlayTheme(theme);
+ }
+ }
+
+ private void waitForThemeToChange(final String theme) {
+
+ final WebElement rootDiv = findElement(By
+ .xpath("//div[contains(@class,'v-app')]"));
+ waitUntil(new ExpectedCondition<Boolean>() {
+
+ @Override
+ public Boolean apply(WebDriver input) {
+ String rootClass = rootDiv.getAttribute("class").trim();
+ String expected = "v-app " + theme;
+ expected = expected.trim();
+ return rootClass.equals(expected);
+ }
+ }, 30);
+ }
+
+ private void assertOverlayTheme(String theme) {
+ final WebElement overlayContainerDiv = findElement(By
+ .xpath("//div[contains(@class,'v-overlay-container')]"));
+ String expected = "v-app v-overlay-container " + theme;
+ expected = expected.trim();
+
+ String overlayClass = overlayContainerDiv.getAttribute("class").trim();
+
+ Assert.assertEquals(expected, overlayClass);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Accordions.java b/uitest/src/com/vaadin/tests/themes/valo/Accordions.java
index b401451271..c32be01d8d 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Accordions.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Accordions.java
@@ -1,12 +1,12 @@
/*
* 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
@@ -44,6 +44,7 @@ public class Accordions extends VerticalLayout implements View {
}
Accordion getAccordion(String caption) {
+ TestIcon testIcon = new TestIcon(0);
Accordion ac = new Accordion();
ac.setCaption(caption);
ac.addTab(new VerticalLayout() {
@@ -52,28 +53,28 @@ public class Accordions extends VerticalLayout implements View {
addComponent(new Label(
"Fabio vel iudice vincam, sunt in culpa qui officia. Ut enim ad minim veniam, quis nostrud exercitation."));
}
- }, "First Caption", TestIcon.get());
+ }, "First Caption", testIcon.get());
ac.addTab(new VerticalLayout() {
{
setMargin(true);
addComponent(new Label(
"Gallia est omnis divisa in partes tres, quarum."));
}
- }, "Second Caption", TestIcon.get());
+ }, "Second Caption", testIcon.get());
ac.addTab(new VerticalLayout() {
{
setMargin(true);
addComponent(new Label(
"Nihil hic munitissimus habendi senatus locus, nihil horum? Sed haec quis possit intrepidus aestimare tellus."));
}
- }, "Third Caption", TestIcon.get());
+ }, "Third Caption", testIcon.get());
ac.addTab(new VerticalLayout() {
{
setMargin(true);
addComponent(new Label(
"Inmensae subtilitatis, obscuris et malesuada fames. Quisque ut dolor gravida, placerat libero vel, euismod."));
}
- }, "Custom Caption Style", TestIcon.get()).setStyleName("color1");
+ }, "Custom Caption Style", testIcon.get()).setStyleName("color1");
return ac;
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java b/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java
index ce08d9ba08..758d2de200 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java
@@ -66,61 +66,62 @@ public class ButtonsAndLinks extends VerticalLayout implements View {
button.addStyleName("danger");
row.addComponent(button);
+ TestIcon testIcon = new TestIcon(10);
button = new Button("Small");
button.addStyleName("small");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
row.addComponent(button);
button = new Button("Large");
button.addStyleName("large");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
row.addComponent(button);
button = new Button("Top");
button.addStyleName("icon-align-top");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
row.addComponent(button);
button = new Button("Image icon");
- button.setIcon(TestIcon.get(true, 16));
+ button.setIcon(testIcon.get(true, 16));
row.addComponent(button);
button = new Button("Image icon");
button.addStyleName("icon-align-right");
- button.setIcon(TestIcon.get(true));
+ button.setIcon(testIcon.get(true));
row.addComponent(button);
button = new Button("Photos");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
row.addComponent(button);
button = new Button();
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
button.addStyleName("icon-only");
row.addComponent(button);
button = new Button("Borderless");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
button.addStyleName("borderless");
row.addComponent(button);
button = new Button("Borderless, colored");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
button.addStyleName("borderless-colored");
row.addComponent(button);
button = new Button("Quiet");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
button.addStyleName("quiet");
row.addComponent(button);
button = new Button("Link style");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
button.addStyleName("link");
row.addComponent(button);
button = new Button("Icon on right");
- button.setIcon(TestIcon.get());
+ button.setIcon(testIcon.get());
button.addStyleName("icon-align-right");
row.addComponent(button);
@@ -154,7 +155,7 @@ public class ButtonsAndLinks extends VerticalLayout implements View {
link = new Link("Link with icon", new ExternalResource(
"https://vaadin.com"));
link.addStyleName("color3");
- link.setIcon(TestIcon.get());
+ link.setIcon(testIcon.get());
row.addComponent(link);
link = new Link("Small", new ExternalResource("https://vaadin.com"));
@@ -166,7 +167,7 @@ public class ButtonsAndLinks extends VerticalLayout implements View {
row.addComponent(link);
link = new Link(null, new ExternalResource("https://vaadin.com"));
- link.setIcon(TestIcon.get());
+ link.setIcon(testIcon.get());
link.addStyleName("large");
row.addComponent(link);
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java b/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java
index a2daeff2f8..c7a2610a21 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java
@@ -57,17 +57,18 @@ public class CheckBoxes extends VerticalLayout implements View {
check.addStyleName("color1");
row.addComponent(check);
+ TestIcon testIcon = new TestIcon(30);
check = new CheckBox("Custom color", true);
check.addStyleName("color2");
- check.setIcon(TestIcon.get());
+ check.setIcon(testIcon.get());
row.addComponent(check);
check = new CheckBox("With Icon", true);
- check.setIcon(TestIcon.get());
+ check.setIcon(testIcon.get());
row.addComponent(check);
check = new CheckBox();
- check.setIcon(TestIcon.get(true));
+ check.setIcon(testIcon.get(true));
row.addComponent(check);
check = new CheckBox("Small", true);
@@ -94,9 +95,9 @@ public class CheckBoxes extends VerticalLayout implements View {
.addItem("Option Two, with a longer caption that should wrap when the components width is explicitly set.");
options.addItem("Option Three");
options.select("Option One");
- options.setItemIcon("Option One", TestIcon.get());
- options.setItemIcon(two, TestIcon.get());
- options.setItemIcon("Option Three", TestIcon.get(true));
+ options.setItemIcon("Option One", testIcon.get());
+ options.setItemIcon(two, testIcon.get());
+ options.setItemIcon("Option Three", testIcon.get(true));
row.addComponent(options);
options = new OptionGroup("Choose many, explicit width");
@@ -107,9 +108,9 @@ public class CheckBoxes extends VerticalLayout implements View {
.addItem("Option Two, with a longer caption that should wrap when the components width is explicitly set.");
options.addItem("Option Three");
options.select("Option One");
- options.setItemIcon("Option One", TestIcon.get());
- options.setItemIcon(two, TestIcon.get());
- options.setItemIcon("Option Three", TestIcon.get(true));
+ options.setItemIcon("Option One", testIcon.get());
+ options.setItemIcon(two, testIcon.get());
+ options.setItemIcon("Option Three", testIcon.get(true));
row.addComponent(options);
options = new OptionGroup("Choose one, small");
@@ -119,9 +120,9 @@ public class CheckBoxes extends VerticalLayout implements View {
options.addItem("Option Two");
options.addItem("Option Three");
options.select("Option One");
- options.setItemIcon("Option One", TestIcon.get());
- options.setItemIcon("Option Two", TestIcon.get());
- options.setItemIcon("Option Three", TestIcon.get(true));
+ options.setItemIcon("Option One", testIcon.get());
+ options.setItemIcon("Option Two", testIcon.get());
+ options.setItemIcon("Option Three", testIcon.get(true));
row.addComponent(options);
options = new OptionGroup("Choose many, small");
@@ -131,9 +132,9 @@ public class CheckBoxes extends VerticalLayout implements View {
options.addItem("Option Two");
options.addItem("Option Three");
options.select("Option One");
- options.setItemIcon("Option One", TestIcon.get());
- options.setItemIcon("Option Two", TestIcon.get());
- options.setItemIcon("Option Three", TestIcon.get(true));
+ options.setItemIcon("Option One", testIcon.get());
+ options.setItemIcon("Option Two", testIcon.get());
+ options.setItemIcon("Option Three", testIcon.get(true));
row.addComponent(options);
options = new OptionGroup("Choose one, large");
@@ -143,9 +144,9 @@ public class CheckBoxes extends VerticalLayout implements View {
options.addItem("Option Two");
options.addItem("Option Three");
options.select("Option One");
- options.setItemIcon("Option One", TestIcon.get());
- options.setItemIcon("Option Two", TestIcon.get());
- options.setItemIcon("Option Three", TestIcon.get(true));
+ options.setItemIcon("Option One", testIcon.get());
+ options.setItemIcon("Option Two", testIcon.get());
+ options.setItemIcon("Option Three", testIcon.get(true));
row.addComponent(options);
options = new OptionGroup("Choose many, large");
@@ -155,9 +156,9 @@ public class CheckBoxes extends VerticalLayout implements View {
options.addItem("Option Two");
options.addItem("Option Three");
options.select("Option One");
- options.setItemIcon("Option One", TestIcon.get());
- options.setItemIcon("Option Two", TestIcon.get());
- options.setItemIcon("Option Three", TestIcon.get(true));
+ options.setItemIcon("Option One", testIcon.get());
+ options.setItemIcon("Option Two", testIcon.get());
+ options.setItemIcon("Option Three", testIcon.get(true));
row.addComponent(options);
options = new OptionGroup("Horizontal items");
@@ -166,9 +167,9 @@ public class CheckBoxes extends VerticalLayout implements View {
two = options.addItem("Option Two, with a longer caption");
options.addItem("Option Three");
options.select("Option One");
- options.setItemIcon("Option One", TestIcon.get());
- options.setItemIcon(two, TestIcon.get());
- options.setItemIcon("Option Three", TestIcon.get());
+ options.setItemIcon("Option One", testIcon.get());
+ options.setItemIcon(two, testIcon.get());
+ options.setItemIcon("Option Three", testIcon.get());
row.addComponent(options);
options = new OptionGroup("Horizontal items, explicit width");
@@ -179,9 +180,9 @@ public class CheckBoxes extends VerticalLayout implements View {
two = options.addItem("Option Two, with a longer caption");
options.addItem("Option Three");
options.select("Option One");
- options.setItemIcon("Option One", TestIcon.get());
- options.setItemIcon(two, TestIcon.get());
- options.setItemIcon("Option Three", TestIcon.get());
+ options.setItemIcon("Option One", testIcon.get());
+ options.setItemIcon(two, testIcon.get());
+ options.setItemIcon("Option Three", testIcon.get());
row.addComponent(options);
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java b/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java
index b841b0b116..a7fd60ea51 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java
@@ -37,9 +37,11 @@ public class ColorPickers extends VerticalLayout implements View {
row.setSpacing(true);
addComponent(row);
+ TestIcon testIcon = new TestIcon(40);
+
ColorPicker cp = new ColorPicker();
cp.setDefaultCaptionEnabled(true);
- cp.setIcon(TestIcon.get());
+ cp.setIcon(testIcon.get());
cp.setColor(new Color(138, 73, 115));
row.addComponent(cp);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java
index cafdfe37e0..1b8b290d91 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java
@@ -15,7 +15,6 @@
*/
package com.vaadin.tests.themes.valo;
-import com.vaadin.data.Container;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.server.ThemeResource;
@@ -40,15 +39,13 @@ public class ComboBoxes extends VerticalLayout implements View {
row.setSpacing(true);
addComponent(row);
- Container generatedContainer = ValoThemeTest.generateContainer(200,
- false);
ComboBox combo = new ComboBox("Normal");
combo.setInputPrompt("You can type here");
- combo.setContainerDataSource(generatedContainer);
+ combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
combo.setNullSelectionAllowed(false);
- combo.select(generatedContainer.getItemIds().iterator().next());
- combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY);
- combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY);
+ combo.select(combo.getItemIds().iterator().next());
+ combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
+ combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
combo.setItemIcon(combo.getItemIds().iterator().next(),
new ThemeResource("../runo/icons/16/document.png"));
row.addComponent(combo);
@@ -60,11 +57,11 @@ public class ComboBoxes extends VerticalLayout implements View {
combo = new ComboBox();
combo.setInputPrompt("You can type here");
- combo.setContainerDataSource(generatedContainer);
+ combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
combo.setNullSelectionAllowed(false);
- combo.select(generatedContainer.getItemIds().iterator().next());
- combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY);
- combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY);
+ combo.select(combo.getItemIds().iterator().next());
+ combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
+ combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
combo.setWidth("240px");
group.addComponent(combo);
Button today = new Button("Do It");
@@ -120,41 +117,41 @@ public class ComboBoxes extends VerticalLayout implements View {
combo = new ComboBox("Custom color");
combo.setInputPrompt("You can type here");
- combo.setContainerDataSource(generatedContainer);
- combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY);
- combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY);
+ combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
+ combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
+ combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
combo.addStyleName("color1");
row.addComponent(combo);
combo = new ComboBox("Custom color");
combo.setInputPrompt("You can type here");
- combo.setContainerDataSource(generatedContainer);
- combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY);
- combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY);
+ combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
+ combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
+ combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
combo.addStyleName("color2");
row.addComponent(combo);
combo = new ComboBox("Custom color");
combo.setInputPrompt("You can type here");
- combo.setContainerDataSource(generatedContainer);
- combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY);
- combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY);
+ combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
+ combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
+ combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
combo.addStyleName("color3");
row.addComponent(combo);
combo = new ComboBox("Small");
combo.setInputPrompt("You can type here");
- combo.setContainerDataSource(generatedContainer);
- combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY);
- combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY);
+ combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
+ combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
+ combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
combo.addStyleName("small");
row.addComponent(combo);
combo = new ComboBox("Large");
combo.setInputPrompt("You can type here");
- combo.setContainerDataSource(generatedContainer);
- combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY);
- combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY);
+ combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
+ combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
+ combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
combo.addStyleName("large");
row.addComponent(combo);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Forms.java b/uitest/src/com/vaadin/tests/themes/valo/Forms.java
index 9451b5c5d3..6f1b8bbf7a 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Forms.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Forms.java
@@ -60,10 +60,10 @@ public class Forms extends VerticalLayout implements View {
Label section = new Label("Personal Info");
section.addStyleName("h2");
form.addComponent(section);
+ StringGenerator sg = new StringGenerator();
TextField name = new TextField("Name");
- name.setValue(ValoThemeTest.nextString(true) + " "
- + ValoThemeTest.nextString(true));
+ name.setValue(sg.nextString(true) + " " + sg.nextString(true));
name.setWidth("50%");
form.addComponent(name);
@@ -72,8 +72,7 @@ public class Forms extends VerticalLayout implements View {
form.addComponent(birthday);
TextField username = new TextField("Username");
- username.setValue(ValoThemeTest.nextString(false)
- + ValoThemeTest.nextString(false));
+ username.setValue(sg.nextString(false) + sg.nextString(false));
username.setRequired(true);
form.addComponent(username);
@@ -89,15 +88,14 @@ public class Forms extends VerticalLayout implements View {
form.addComponent(section);
TextField email = new TextField("Email");
- email.setValue(ValoThemeTest.nextString(false) + "@"
- + ValoThemeTest.nextString(false) + ".com");
+ email.setValue(sg.nextString(false) + "@" + sg.nextString(false)
+ + ".com");
email.setWidth("50%");
email.setRequired(true);
form.addComponent(email);
TextField location = new TextField("Location");
- location.setValue(ValoThemeTest.nextString(true) + ", "
- + ValoThemeTest.nextString(true));
+ location.setValue(sg.nextString(true) + ", " + sg.nextString(true));
location.setWidth("50%");
location.setComponentError(new UserError("This address doesn't exist"));
form.addComponent(location);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ImmediateUpload.java b/uitest/src/com/vaadin/tests/themes/valo/ImmediateUpload.java
new file mode 100644
index 0000000000..87f24d98d4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/valo/ImmediateUpload.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2000-2014 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.themes.valo;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Upload;
+
+/**
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+@Theme("valo")
+public class ImmediateUpload extends AbstractTestUI {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+
+ Upload upload = new Upload();
+ upload.setId("upload");
+ upload.setImmediate(false);
+ addComponent(upload);
+
+ Upload immediateUpload = new Upload();
+ immediateUpload.setId("immediateupload");
+ immediateUpload.setImmediate(true);
+ addComponent(immediateUpload);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "Immediate upload should hide the button";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(14238);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java b/uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java
new file mode 100644
index 0000000000..044f76e335
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2000-2014 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.themes.valo;
+
+import static org.hamcrest.Matchers.equalToIgnoringCase;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.testbench.elements.UploadElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Test to see if upload immediate mode hides the native file input.
+ *
+ * @author Vaadin Ltd
+ */
+public class ImmediateUploadTest extends MultiBrowserTest {
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ return getAllBrowsers();
+ }
+
+ @Test
+ public void fileInputShouldNotBeVisibleInImmediate()
+ throws InterruptedException {
+ openTestURL();
+
+ UploadElement normalUpload = $(UploadElement.class).id("upload");
+ UploadElement immediateUpload = $(UploadElement.class).id(
+ "immediateupload");
+
+ WebElement normalUploadInput = normalUpload.findElement(By
+ .cssSelector("input[type='file']"));
+ WebElement immediateUploadInput = immediateUpload.findElement(By
+ .cssSelector("input[type='file']"));
+
+ WebElement normalUploadButton = normalUpload.findElement(By
+ .tagName("div"));
+ WebElement immediateUploadButton = immediateUpload.findElement(By
+ .tagName("div"));
+
+ assertThat(normalUploadButton.getCssValue("display"),
+ equalToIgnoringCase("block"));
+ assertThat(immediateUploadButton.getCssValue("display"),
+ equalToIgnoringCase("block"));
+
+ assertThat(normalUploadInput.getCssValue("position"),
+ equalToIgnoringCase("static"));
+ assertThat(immediateUploadInput.getCssValue("position"),
+ equalToIgnoringCase("absolute"));
+
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java b/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java
index f15f43254a..88eea73513 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java
@@ -120,14 +120,16 @@ public class MenuBars extends VerticalLayout implements View {
view.addItem("Zoom In", click);
view.addItem("Zoom Out", click);
+ TestIcon testIcon = new TestIcon(50);
+
MenuItem fav = menubar.addItem("", check);
- fav.setIcon(TestIcon.get());
+ fav.setIcon(testIcon.get());
fav.setStyleName("icon-only");
fav.setCheckable(true);
fav.setChecked(true);
fav = menubar.addItem("", check);
- fav.setIcon(TestIcon.get());
+ fav.setIcon(testIcon.get());
fav.setStyleName("icon-only");
fav.setCheckable(true);
fav.setCheckable(true);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Panels.java b/uitest/src/com/vaadin/tests/themes/valo/Panels.java
index 74baef066b..8a17244693 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Panels.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Panels.java
@@ -40,45 +40,46 @@ public class Panels extends VerticalLayout implements View {
row.addStyleName("wrapping");
row.setSpacing(true);
addComponent(row);
+ TestIcon testIcon = new TestIcon(60);
Panel panel = new Panel("Normal");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.setContent(panelContent());
row.addComponent(panel);
panel = new Panel("Sized");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.setWidth("10em");
panel.setHeight("250px");
panel.setContent(panelContent());
row.addComponent(panel);
panel = new Panel("Custom Caption");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.addStyleName("color1");
panel.setContent(panelContent());
row.addComponent(panel);
panel = new Panel("Custom Caption");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.addStyleName("color2");
panel.setContent(panelContent());
row.addComponent(panel);
panel = new Panel("Custom Caption");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.addStyleName("color3");
panel.setContent(panelContent());
row.addComponent(panel);
panel = new Panel("Borderless style");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.addStyleName("borderless");
panel.setContent(panelContent());
row.addComponent(panel);
panel = new Panel("Borderless + scroll divider");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.addStyleName("borderless");
panel.addStyleName("scroll-divider");
panel.setContent(panelContentScroll());
@@ -86,13 +87,13 @@ public class Panels extends VerticalLayout implements View {
row.addComponent(panel);
panel = new Panel("Well style");
- panel.setIcon(TestIcon.get());
+ panel.setIcon(testIcon.get());
panel.addStyleName("well");
panel.setContent(panelContent());
row.addComponent(panel);
CssLayout layout = new CssLayout();
- layout.setIcon(TestIcon.get());
+ layout.setIcon(testIcon.get());
layout.setCaption("Panel style layout");
layout.addStyleName("card");
layout.addComponent(panelContent());
@@ -131,7 +132,7 @@ public class Panels extends VerticalLayout implements View {
layout.setWidth("14em");
layout = new CssLayout();
- layout.setIcon(TestIcon.get());
+ layout.setIcon(testIcon.get());
layout.setCaption("Well style layout");
layout.addStyleName("well");
layout.addComponent(panelContent());
diff --git a/uitest/src/com/vaadin/tests/themes/valo/StringGenerator.java b/uitest/src/com/vaadin/tests/themes/valo/StringGenerator.java
new file mode 100644
index 0000000000..7e5cc0f691
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/valo/StringGenerator.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2000-2014 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.themes.valo;
+
+public class StringGenerator {
+ static String[] strings = new String[] { "lorem", "ipsum", "dolor", "sit",
+ "amet", "consectetur", "quid", "securi", "etiam", "tamquam", "eu",
+ "fugiat", "nulla", "pariatur" };
+ int stringCount = -1;
+
+ String nextString(boolean capitalize) {
+ if (++stringCount >= strings.length) {
+ stringCount = 0;
+ }
+ return capitalize ? strings[stringCount].substring(0, 1).toUpperCase()
+ + strings[stringCount].substring(1) : strings[stringCount];
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tables.java b/uitest/src/com/vaadin/tests/themes/valo/Tables.java
index 6aa02a7f74..442e3e509a 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Tables.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Tables.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 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
@@ -40,10 +40,9 @@ import com.vaadin.ui.VerticalLayout;
public class Tables extends VerticalLayout implements View {
- static final Container normalContainer = ValoThemeTest.generateContainer(
- 200, false);
- static final Container hierarchicalContainer = ValoThemeTest
- .generateContainer(200, true);
+ final Container normalContainer = ValoThemeUI.generateContainer(200, false);
+ final Container hierarchicalContainer = ValoThemeUI.generateContainer(200,
+ true);
CheckBox hierarchical = new CheckBox("Hierarchical");
CheckBox footer = new CheckBox("Footer", true);
@@ -140,7 +139,7 @@ public class Tables extends VerticalLayout implements View {
table.setColumnCollapsingAllowed(true);
table.setColumnReorderingAllowed(true);
table.setPageLength(6);
- table.addActionHandler(ValoThemeTest.getActionHandler());
+ table.addActionHandler(ValoThemeUI.getActionHandler());
table.setDragMode(TableDragMode.MULTIROW);
table.setDropHandler(new DropHandler() {
@Override
@@ -153,9 +152,8 @@ public class Tables extends VerticalLayout implements View {
Notification.show(event.getTransferable().toString());
}
});
- table.setColumnAlignment(ValoThemeTest.DESCRIPTION_PROPERTY,
- Align.RIGHT);
- table.setColumnAlignment(ValoThemeTest.INDEX_PROPERTY, Align.CENTER);
+ table.setColumnAlignment(ValoThemeUI.DESCRIPTION_PROPERTY, Align.RIGHT);
+ table.setColumnAlignment(ValoThemeUI.INDEX_PROPERTY, Align.CENTER);
table.removeContainerProperty("textfield");
table.addContainerProperty("textfield", TextField.class, null);
@@ -186,11 +184,11 @@ public class Tables extends VerticalLayout implements View {
table.setFooterVisible(footer);
if (footer) {
- table.setColumnFooter(ValoThemeTest.CAPTION_PROPERTY, "caption");
- table.setColumnFooter(ValoThemeTest.DESCRIPTION_PROPERTY,
+ table.setColumnFooter(ValoThemeUI.CAPTION_PROPERTY, "caption");
+ table.setColumnFooter(ValoThemeUI.DESCRIPTION_PROPERTY,
"description");
- table.setColumnFooter(ValoThemeTest.ICON_PROPERTY, "icon");
- table.setColumnFooter(ValoThemeTest.INDEX_PROPERTY, "index");
+ table.setColumnFooter(ValoThemeUI.ICON_PROPERTY, "icon");
+ table.setColumnFooter(ValoThemeUI.INDEX_PROPERTY, "index");
}
if (sized) {
@@ -205,9 +203,9 @@ public class Tables extends VerticalLayout implements View {
table.setWidth("100%");
}
}
- table.setColumnExpandRatio(ValoThemeTest.CAPTION_PROPERTY,
+ table.setColumnExpandRatio(ValoThemeUI.CAPTION_PROPERTY,
expandRatios ? 1.0f : 0);
- table.setColumnExpandRatio(ValoThemeTest.DESCRIPTION_PROPERTY,
+ table.setColumnExpandRatio(ValoThemeUI.DESCRIPTION_PROPERTY,
expandRatios ? 1.0f : 0);
if (!stripes) {
@@ -262,14 +260,14 @@ public class Tables extends VerticalLayout implements View {
if (rowCaption) {
table.setRowHeaderMode(RowHeaderMode.PROPERTY);
- table.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY);
+ table.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
} else {
table.setItemCaptionPropertyId(null);
}
if (rowIcon) {
table.setRowHeaderMode(RowHeaderMode.ICON_ONLY);
- table.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY);
+ table.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
} else {
table.setItemIconPropertyId(null);
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
index 24a249d90e..5e77292471 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
@@ -149,12 +149,15 @@ public class Tabsheets extends VerticalLayout implements View {
static TabSheet getTabSheet(boolean caption, String style,
boolean closable, boolean scrolling, boolean icon, boolean disable) {
+ TestIcon testIcon = new TestIcon(60);
+
TabSheet ts = new TabSheet();
ts.addStyleName(style);
+ StringGenerator sg = new StringGenerator();
for (int i = 1; i <= (scrolling ? 10 : 3); i++) {
- String tabcaption = caption ? ValoThemeTest.nextString(true) + " "
- + ValoThemeTest.nextString(false) : null;
+ String tabcaption = caption ? sg.nextString(true) + " "
+ + sg.nextString(false) : null;
VerticalLayout content = new VerticalLayout();
content.setMargin(true);
@@ -174,7 +177,7 @@ public class Tabsheets extends VerticalLayout implements View {
}
if (icon) {
- t.setIcon(TestIcon.get(false));
+ t.setIcon(testIcon.get(false));
}
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/TestIcon.java b/uitest/src/com/vaadin/tests/themes/valo/TestIcon.java
index 18b834f1bf..469f6bc31d 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/TestIcon.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/TestIcon.java
@@ -1,12 +1,12 @@
/*
* 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
@@ -24,21 +24,27 @@ import com.vaadin.server.Resource;
import com.vaadin.server.ThemeResource;
/**
- *
+ *
* @since
* @author Vaadin Ltd
*/
public class TestIcon {
- public static Resource get() {
+ int iconCount = 0;
+
+ public TestIcon(int startIndex) {
+ iconCount = startIndex;
+ }
+
+ public Resource get() {
return get(false, 32);
}
- public static Resource get(boolean isImage) {
+ public Resource get(boolean isImage) {
return get(isImage, 32);
}
- public static Resource get(boolean isImage, int imageSize) {
+ public Resource get(boolean isImage, int imageSize) {
if (!isImage) {
if (++iconCount >= ICONS.size()) {
iconCount = 0;
@@ -51,5 +57,4 @@ public class TestIcon {
static List<FontAwesome> ICONS = Collections.unmodifiableList(Arrays
.asList(FontAwesome.values()));
- static int iconCount = 0;
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
index cbe7a8a0b3..f8606bb7c9 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
@@ -30,6 +30,8 @@ import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
public class TextFields extends VerticalLayout implements View {
+ private TestIcon testIcon = new TestIcon(140);
+
public TextFields() {
setMargin(true);
@@ -44,7 +46,7 @@ public class TextFields extends VerticalLayout implements View {
TextField tf = new TextField("Normal");
tf.setInputPrompt("First name");
- tf.setIcon(TestIcon.get());
+ tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField("Custom color");
@@ -87,45 +89,45 @@ public class TextFields extends VerticalLayout implements View {
tf = new TextField("Large");
tf.setValue("Field value");
tf.addStyleName("large");
- tf.setIcon(TestIcon.get(true));
+ tf.setIcon(testIcon.get(true));
row.addComponent(tf);
tf = new TextField("Icon inside");
tf.setInputPrompt("Ooh, an icon");
tf.addStyleName("inline-icon");
- tf.setIcon(TestIcon.get());
+ tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField("Large, Icon inside");
tf.setInputPrompt("Ooh, an icon");
tf.addStyleName("large");
tf.addStyleName("inline-icon");
- tf.setIcon(TestIcon.get());
+ tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField("Small, Icon inside");
tf.setInputPrompt("Ooh, an icon");
tf.addStyleName("small");
tf.addStyleName("inline-icon");
- tf.setIcon(TestIcon.get());
+ tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField("16px supported by default");
tf.setInputPrompt("Image icon");
tf.addStyleName("inline-icon");
- tf.setIcon(TestIcon.get(true, 16));
+ tf.setIcon(testIcon.get(true, 16));
row.addComponent(tf);
tf = new TextField();
tf.setValue("Font, no caption");
tf.addStyleName("inline-icon");
- tf.setIcon(TestIcon.get());
+ tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField();
tf.setValue("Image, no caption");
tf.addStyleName("inline-icon");
- tf.setIcon(TestIcon.get(true, 16));
+ tf.setIcon(testIcon.get(true, 16));
row.addComponent(tf);
CssLayout group = new CssLayout();
@@ -135,7 +137,7 @@ public class TextFields extends VerticalLayout implements View {
tf = new TextField();
tf.setInputPrompt("Grouped with a button");
tf.addStyleName("inline-icon");
- tf.setIcon(TestIcon.get());
+ tf.setIcon(testIcon.get());
tf.setWidth("260px");
group.addComponent(tf);
@@ -147,7 +149,7 @@ public class TextFields extends VerticalLayout implements View {
tf.setInputPrompt("Write hereā€¦");
tf.addStyleName("inline-icon");
tf.addStyleName("borderless");
- tf.setIcon(TestIcon.get());
+ tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField("Right-aligned");
@@ -196,7 +198,7 @@ public class TextFields extends VerticalLayout implements View {
ta = new TextArea("Inline icon");
ta.setInputPrompt("Inline icon not really working");
ta.addStyleName("inline-icon");
- ta.setIcon(TestIcon.get());
+ ta.setIcon(testIcon.get());
row.addComponent(ta);
ta = new TextArea("Custom color");
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Trees.java b/uitest/src/com/vaadin/tests/themes/valo/Trees.java
index bb406e4f39..cb5657660a 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Trees.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Trees.java
@@ -45,12 +45,12 @@ public class Trees extends VerticalLayout implements View {
Tree tree = new Tree();
tree.setSelectable(true);
tree.setMultiSelect(true);
- Container generateContainer = ValoThemeTest.generateContainer(10, true);
+ Container generateContainer = ValoThemeUI.generateContainer(10, true);
tree.setContainerDataSource(generateContainer);
tree.setDragMode(TreeDragMode.NODE);
row.addComponent(tree);
- tree.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY);
- tree.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY);
+ tree.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
+ tree.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
tree.expandItem(generateContainer.getItemIds().iterator().next());
tree.setDropHandler(new DropHandler() {
@@ -66,7 +66,7 @@ public class Trees extends VerticalLayout implements View {
});
// Add actions (context menu)
- tree.addActionHandler(ValoThemeTest.getActionHandler());
+ tree.addActionHandler(ValoThemeUI.getActionHandler());
}
@Override
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java b/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java
index 222dd90e49..1676d121af 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 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
@@ -70,7 +70,7 @@ public class ValoMiscTests extends UI {
TreeTable table = new TreeTable();
table.setWidth("100%");
- table.setContainerDataSource(Tables.hierarchicalContainer);
+ table.setContainerDataSource(ValoThemeUI.generateContainer(200, true));
Tables.configure(table, true, false, false, true, true, true, false,
true, false, false, false, false, false);
layout.addComponent(table);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeTest.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
index 014b1acac8..27a256665e 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeTest.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 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
@@ -50,13 +50,26 @@ import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.MenuBar;
import com.vaadin.ui.MenuBar.MenuItem;
+import com.vaadin.ui.NativeSelect;
import com.vaadin.ui.Notification;
import com.vaadin.ui.UI;
@Theme("tests-valo")
@Title("Valo Theme Test")
@PreserveOnRefresh
-public class ValoThemeTest extends UI {
+public class ValoThemeUI extends UI {
+
+ private static LinkedHashMap<String, String> themeVariants = new LinkedHashMap<String, String>();
+ static {
+ themeVariants.put("tests-valo", "Default");
+ themeVariants.put("tests-valo-blueprint", "Blueprint");
+ themeVariants.put("tests-valo-dark", "Dark");
+ themeVariants.put("tests-valo-facebook", "Facebook");
+ themeVariants.put("tests-valo-flatdark", "Flat dark");
+ themeVariants.put("tests-valo-flat", "Flat");
+ themeVariants.put("tests-valo-metro", "Metro");
+ }
+ private TestIcon testIcon = new TestIcon(100);
ValoMenuLayout root = new ValoMenuLayout();
ComponentContainer viewDisplay = root.getContentContainer();
@@ -201,6 +214,7 @@ public class ValoThemeTest extends UI {
top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
top.addStyleName("valo-menu-title");
menu.addComponent(top);
+ menu.addComponent(createThemeSelect());
Label title = new Label("Vaadin<br><strong>Valo Theme Styles</strong>",
ContentMode.HTML);
@@ -271,7 +285,7 @@ public class ValoThemeTest extends UI {
}
b.setHtmlContentAllowed(true);
b.setPrimaryStyleName("valo-menu-item");
- b.setIcon(TestIcon.get());
+ b.setIcon(testIcon.get());
menu.addComponent(b);
count++;
}
@@ -281,17 +295,25 @@ public class ValoThemeTest extends UI {
return menu;
}
- static String[] strings = new String[] { "lorem", "ipsum", "dolor", "sit",
- "amet", "consectetur", "quid", "securi", "etiam", "tamquam", "eu",
- "fugiat", "nulla", "pariatur" };
- static int stringCount = -1;
-
- static String nextString(boolean capitalize) {
- if (++stringCount >= strings.length) {
- stringCount = 0;
+ private Component createThemeSelect() {
+ final NativeSelect ns = new NativeSelect();
+ ns.setNullSelectionAllowed(false);
+ ns.setId("themeSelect");
+ ns.addContainerProperty("caption", String.class, "");
+ ns.setItemCaptionPropertyId("caption");
+ for (String identifier : themeVariants.keySet()) {
+ ns.addItem(identifier).getItemProperty("caption")
+ .setValue(themeVariants.get(identifier));
}
- return capitalize ? strings[stringCount].substring(0, 1).toUpperCase()
- + strings[stringCount].substring(1) : strings[stringCount];
+
+ ns.setValue("tests-valo");
+ ns.addValueChangeListener(new ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ setTheme((String) ns.getValue());
+ }
+ });
+ return ns;
}
static Handler actionHandler = new Handler() {
@@ -324,9 +346,10 @@ public class ValoThemeTest extends UI {
@SuppressWarnings("unchecked")
static Container generateContainer(final int size,
final boolean hierarchical) {
+ TestIcon testIcon = new TestIcon(90);
IndexedContainer container = hierarchical ? new HierarchicalContainer()
: new IndexedContainer();
-
+ StringGenerator sg = new StringGenerator();
container.addContainerProperty(CAPTION_PROPERTY, String.class, null);
container.addContainerProperty(ICON_PROPERTY, Resource.class, null);
container.addContainerProperty(INDEX_PROPERTY, Integer.class, null);
@@ -335,15 +358,15 @@ public class ValoThemeTest extends UI {
for (int i = 1; i < size + 1; i++) {
Item item = container.addItem(i);
item.getItemProperty(CAPTION_PROPERTY).setValue(
- nextString(true) + " " + nextString(false));
+ sg.nextString(true) + " " + sg.nextString(false));
item.getItemProperty(INDEX_PROPERTY).setValue(i);
item.getItemProperty(DESCRIPTION_PROPERTY).setValue(
- nextString(true) + " " + nextString(false) + " "
- + nextString(false));
- item.getItemProperty(ICON_PROPERTY).setValue(TestIcon.get());
+ sg.nextString(true) + " " + sg.nextString(false) + " "
+ + sg.nextString(false));
+ item.getItemProperty(ICON_PROPERTY).setValue(testIcon.get());
}
container.getItem(container.getIdByIndex(0))
- .getItemProperty(ICON_PROPERTY).setValue(TestIcon.get());
+ .getItemProperty(ICON_PROPERTY).setValue(testIcon.get());
if (hierarchical) {
for (int i = 1; i < size + 1; i++) {
@@ -351,9 +374,9 @@ public class ValoThemeTest extends UI {
String id = i + " -> " + j;
Item child = container.addItem(id);
child.getItemProperty(CAPTION_PROPERTY).setValue(
- nextString(true) + " " + nextString(false));
+ sg.nextString(true) + " " + sg.nextString(false));
child.getItemProperty(ICON_PROPERTY).setValue(
- TestIcon.get());
+ testIcon.get());
((Hierarchical) container).setChildrenAllowed(id, false);
((Hierarchical) container).setParent(id, i);
}
diff --git a/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java b/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java
index b9fc788008..af7a303629 100644
--- a/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java
+++ b/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java
@@ -69,7 +69,6 @@ public class AdjacentElementsWithTooltipsTest extends MultiBrowserTest {
}
private ButtonElement getButton(String caption) {
- return $(ButtonElement.class)
- .caption(caption).first();
+ return $(ButtonElement.class).caption(caption).first();
}
}
diff --git a/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java b/uitest/src/com/vaadin/tests/tooltip/TooltipInWindow.java
index cd2cc7d060..690b65432a 100644
--- a/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java
+++ b/uitest/src/com/vaadin/tests/tooltip/TooltipInWindow.java
@@ -1,12 +1,12 @@
-/*
+/*
* Copyright 2000-2014 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
@@ -14,7 +14,7 @@
* the License.
*/
-package com.vaadin.tests.components.window;
+package com.vaadin.tests.tooltip;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
@@ -41,9 +41,6 @@ public class TooltipInWindow extends AbstractTestUI {
TextField tf = new TextField("TextField with a tooltip");
tf.setDescription("My tooltip");
tf.setId(id);
- getTooltipConfiguration().setOpenDelay(0);
- getTooltipConfiguration().setQuickOpenDelay(0);
- getTooltipConfiguration().setCloseTimeout(1000);
return tf;
}
@@ -54,7 +51,7 @@ public class TooltipInWindow extends AbstractTestUI {
@Override
protected Integer getTicketNumber() {
- return Integer.valueOf(9172);
+ return 9172;
}
}
diff --git a/uitest/src/com/vaadin/tests/tooltip/TooltipInWindowTest.java b/uitest/src/com/vaadin/tests/tooltip/TooltipInWindowTest.java
new file mode 100644
index 0000000000..1c50bf5486
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/TooltipInWindowTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2000-2014 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.tooltip;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.TooltipTest;
+
+/**
+ * Test if tooltips in subwindows behave correctly
+ *
+ * @author Vaadin Ltd
+ */
+public class TooltipInWindowTest extends TooltipTest {
+
+ @Test
+ public void testTooltipsInSubWindow() throws Exception {
+ openTestURL();
+
+ WebElement textfield = vaadinElementById("tf1");
+
+ checkTooltip(textfield, "My tooltip");
+
+ ensureVisibleTooltipPositionedCorrectly(textfield);
+
+ clearTooltip();
+
+ checkTooltip(textfield, "My tooltip");
+
+ clearTooltip();
+ }
+
+ private WebElement getTooltipContainerElement() {
+ return getDriver().findElement(By.className("v-tooltip"));
+ }
+
+ private void ensureVisibleTooltipPositionedCorrectly(WebElement textfield)
+ throws InterruptedException {
+ int tooltipX = getTooltip().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/widgetset/client/superText/ExtraSuperTextAreaConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/superText/ExtraSuperTextAreaConnector.java
new file mode 100644
index 0000000000..b9037208f9
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/superText/ExtraSuperTextAreaConnector.java
@@ -0,0 +1,15 @@
+package com.vaadin.tests.widgetset.client.superText;
+
+import com.vaadin.client.ui.textarea.TextAreaConnector;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.tests.widgetset.server.ExtraSuperTextArea;
+
+@Connect(ExtraSuperTextArea.class)
+public class ExtraSuperTextAreaConnector extends TextAreaConnector {
+
+ // @DelegateToWidget will not work with overridden state
+ @Override
+ public ExtraSuperTextAreaState getState() {
+ return (ExtraSuperTextAreaState) super.getState();
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/superText/ExtraSuperTextAreaState.java b/uitest/src/com/vaadin/tests/widgetset/client/superText/ExtraSuperTextAreaState.java
new file mode 100644
index 0000000000..44456b27ba
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/superText/ExtraSuperTextAreaState.java
@@ -0,0 +1,7 @@
+package com.vaadin.tests.widgetset.client.superText;
+
+import com.vaadin.shared.ui.textarea.TextAreaState;
+
+public class ExtraSuperTextAreaState extends TextAreaState {
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/superText/SuperTextAreaConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/superText/SuperTextAreaConnector.java
new file mode 100644
index 0000000000..fda1fc6f0a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/superText/SuperTextAreaConnector.java
@@ -0,0 +1,19 @@
+package com.vaadin.tests.widgetset.client.superText;
+
+import com.vaadin.client.ui.textarea.TextAreaConnector;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.tests.widgetset.server.SuperTextArea;
+
+/**
+ * @author artamonov
+ * @version $Id$
+ */
+@Connect(SuperTextArea.class)
+public class SuperTextAreaConnector extends TextAreaConnector {
+
+ // @DelegateToWidget will not work with overridden state
+ @Override
+ public SuperTextAreaState getState() {
+ return (SuperTextAreaState) super.getState();
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/superText/SuperTextAreaState.java b/uitest/src/com/vaadin/tests/widgetset/client/superText/SuperTextAreaState.java
new file mode 100644
index 0000000000..005075429c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/superText/SuperTextAreaState.java
@@ -0,0 +1,11 @@
+package com.vaadin.tests.widgetset.client.superText;
+
+import com.vaadin.shared.ui.textarea.TextAreaState;
+
+/**
+ * @author artamonov
+ * @version $Id$
+ */
+public class SuperTextAreaState extends TextAreaState {
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/ExtraSuperTextArea.java b/uitest/src/com/vaadin/tests/widgetset/server/ExtraSuperTextArea.java
new file mode 100644
index 0000000000..b741c099b5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/ExtraSuperTextArea.java
@@ -0,0 +1,16 @@
+package com.vaadin.tests.widgetset.server;
+
+import com.vaadin.tests.widgetset.client.superText.SuperTextAreaState;
+import com.vaadin.ui.TextArea;
+
+/**
+ * @author artamonov
+ * @version $Id$
+ */
+public class ExtraSuperTextArea extends TextArea {
+
+ @Override
+ public SuperTextAreaState getState() {
+ return (SuperTextAreaState) super.getState();
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/OverriddenDecendants.java b/uitest/src/com/vaadin/tests/widgetset/server/OverriddenDecendants.java
new file mode 100644
index 0000000000..aadabb3fcc
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/OverriddenDecendants.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2000-2014 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;
+import com.vaadin.ui.TextArea;
+
+/**
+ * UI for testing that @DelegateToWidget works on derived widget states.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+@Widgetset(TestingWidgetSet.NAME)
+public class OverriddenDecendants extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+
+ TextArea normalTextArea = new TextArea();
+ normalTextArea.setRows(10);
+ normalTextArea.setWordwrap(true);
+
+ getLayout().addComponent(normalTextArea);
+
+ // @DelegateToWidget will not work with overridden state in connector
+ SuperTextArea superTextArea = new SuperTextArea();
+ superTextArea.setRows(10);
+ superTextArea.setWordwrap(true);
+
+ getLayout().addComponent(superTextArea);
+
+ // @DelegateToWidget will not work with overridden state in connector
+ ExtraSuperTextArea extraSuperTextArea = new ExtraSuperTextArea();
+ extraSuperTextArea.setRows(10);
+ extraSuperTextArea.setWordwrap(true);
+
+ getLayout().addComponent(extraSuperTextArea);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "@DelegateToWidget does not work for widget descendants with overridden getState";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14059;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/OverriddenDecendantsTest.java b/uitest/src/com/vaadin/tests/widgetset/server/OverriddenDecendantsTest.java
new file mode 100644
index 0000000000..aa29284010
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/OverriddenDecendantsTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2000-2014 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 static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.TextAreaElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Class for unit testing that @DelegateToWidget works on derived widget states.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class OverriddenDecendantsTest extends MultiBrowserTest {
+
+ @Test
+ public void allExtendingFieldsShouldGetRowsFromTextAreaStateAnnotation()
+ throws InterruptedException {
+ openTestURL();
+
+ List<TextAreaElement> textAreas = $(TextAreaElement.class).all();
+
+ assertEquals("Did not contain all 3 text areas", 3, textAreas.size());
+
+ for (TextAreaElement area : textAreas) {
+ assertEquals("Text area was missing rows", "10",
+ area.getAttribute("rows"));
+ }
+
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/SuperTextArea.java b/uitest/src/com/vaadin/tests/widgetset/server/SuperTextArea.java
new file mode 100644
index 0000000000..6e73915e44
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/SuperTextArea.java
@@ -0,0 +1,16 @@
+package com.vaadin.tests.widgetset.server;
+
+import com.vaadin.tests.widgetset.client.superText.SuperTextAreaState;
+import com.vaadin.ui.TextArea;
+
+/**
+ * @author artamonov
+ * @version $Id$
+ */
+public class SuperTextArea extends TextArea {
+
+ @Override
+ public SuperTextAreaState getState() {
+ return (SuperTextAreaState) super.getState();
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/gwtrpc/GwtRpcTest.java b/uitest/src/com/vaadin/tests/widgetset/server/gwtrpc/GwtRpcTest.java
index d27884a13a..76d884d2c7 100644
--- a/uitest/src/com/vaadin/tests/widgetset/server/gwtrpc/GwtRpcTest.java
+++ b/uitest/src/com/vaadin/tests/widgetset/server/gwtrpc/GwtRpcTest.java
@@ -36,7 +36,7 @@ public class GwtRpcTest extends MultiBrowserTest {
By label = By.id(GwtRpcButtonConnector.SUCCESS_LABEL_ID);
- waitForElementToBePresent(label);
+ waitForElementVisible(label);
getDriver().findElement(label);
}