summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
Diffstat (limited to 'uitest')
-rw-r--r--uitest/build.xml135
-rw-r--r--uitest/eclipse-run-selected-test.properties15
-rw-r--r--uitest/ivy.xml8
-rw-r--r--uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java135
-rw-r--r--uitest/src/com/vaadin/launcher/CustomDeploymentConfiguration.java36
-rw-r--r--uitest/src/com/vaadin/tests/VerifyAssertionsEnabled.html26
-rw-r--r--uitest/src/com/vaadin/tests/VerifyAssertionsEnabled.java9
-rw-r--r--uitest/src/com/vaadin/tests/VerifyAssertionsEnabledTest.java14
-rw-r--r--uitest/src/com/vaadin/tests/VerifyJreVersionTest.java4
-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/applicationservlet/CustomDeploymentConf.java55
-rw-r--r--uitest/src/com/vaadin/tests/applicationservlet/CustomDeploymentConfTest.java41
-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/ButtonTooltips.html37
-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/ComboBoxSuggestionPopupClose.java29
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupCloseTest.java65
-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.java200
-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/splitpanel/SplitPanelStyleLeak.java85
-rw-r--r--uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelStyleLeakTest.java31
-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/LabelEmbeddedClickThroughForTable.html12
-rw-r--r--uitest/src/com/vaadin/tests/components/table/MemoryLeakTable.java85
-rw-r--r--uitest/src/com/vaadin/tests/components/table/MemoryLeakTableTest.java95
-rw-r--r--uitest/src/com/vaadin/tests/components/table/PropertyValueChange.html6
-rw-r--r--uitest/src/com/vaadin/tests/components/table/SetDataSourceWithPropertyIds.html10
-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/SortLabelsInTable.html32
-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/TableColumnResizeContentsWidth.html8
-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/TableRowScrolledBottom.html4
-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/TableSqlContainer.html4
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableTooManyColumns.java65
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableTooManyColumnsTest.java46
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableTooltips.html91
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemId.html8
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TabletContextMenu.java139
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.html4
-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/tabsheet/TabKeyboardNavigation.html241
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java32
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationTest.java188
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScroll.java67
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScrollTest.java54
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabsheetNotEnoughHorizontalSpace.java75
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabsheetNotEnoughHorizontalSpaceTest.java47
-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/TreeTableGeneratedColumns.html4
-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/ui/UISerialization.html41
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java26
-rw-r--r--uitest/src/com/vaadin/tests/components/upload/TestFileUploadTest.java2
-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/ComboboxScrollableWindowTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html32
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java113
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSizeTest.java38
-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/extensions/ResponsiveLayoutUpdate.java61
-rw-r--r--uitest/src/com/vaadin/tests/extensions/ResponsiveLayoutUpdateTest.java52
-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/serialization/SerializerTest.java8
-rw-r--r--uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java31
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java261
-rw-r--r--uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java88
-rw-r--r--uitest/src/com/vaadin/tests/tb3/SingleBrowserTest.java31
-rw-r--r--uitest/src/com/vaadin/tests/tb3/TB3Runner.java53
-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/CalendarTest.java55
-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/CommonParts.java9
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/DateFields.java50
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Forms.java16
-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/Sliders.java26
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/StringGenerator.java32
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Tables.java38
-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)171
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java239
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java3
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/ButtonTooltips.java16
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/ButtonTooltipsTest.java12
-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/TestingWidgetSet.gwt.xml5
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/MockApplicationConnection.java81
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java13
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/csrf/CsrfButtonConnector.java82
-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/csrf/CsrfButton.java30
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/AbstractCsrfTokenUI.java60
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/AbstractCsrfTokenUITest.java116
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenDisabled.java35
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenDisabledTest.java43
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenEnabled.java25
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenEnabledTest.java43
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/gwtrpc/GwtRpcTest.java2
-rw-r--r--uitest/test.xml2
198 files changed, 7643 insertions, 2634 deletions
diff --git a/uitest/build.xml b/uitest/build.xml
index 84f44a2d72..e81983f1f5 100644
--- a/uitest/build.xml
+++ b/uitest/build.xml
@@ -11,6 +11,7 @@
<property name="module.name" value="vaadin-uitest" />
<property name="uitest.dir" location="${vaadin.basedir}/uitest" />
<property name="result.dir" value="result" />
+ <property name="theme.result.dir" value="${result.dir}/VAADIN/themes" />
<property name="result.war" location="${result.dir}/lib/${module.name}-${vaadin.version}.war" />
<path id="classpath.compile.custom">
@@ -91,7 +92,7 @@
</target>
- <target name="war" depends="dependencies, compile, testing-widgetset">
+ <target name="war" depends="dependencies, compile, compile-test-themes, testing-widgetset">
<property name="result.dir" location="result" />
<property name="classes" location="${result.dir}/classes" />
<property name="WebContent.dir" location="${vaadin.basedir}/WebContent" />
@@ -121,10 +122,13 @@
<fileset refid="common.files.for.all.jars" />
<fileset dir="${result.dir}">
<include name="VAADIN/widgetsets/**/*" />
+ <include name="VAADIN/themes/tests-valo*/**" />
</fileset>
<fileset dir="${WebContent.dir}">
<include name="statictestfiles/**" />
<include name="VAADIN/themes/tests-*/**" />
+ <!-- Scss themes compiled and included above -->
+ <exclude name="VAADIN/themes/tests-valo*/**" />
<include name="VAADIN/themes/reindeer-tests/**" />
<include name="VAADIN/jquery.atmosphere.js" />
<include name="WEB-INF/*.xml" />
@@ -192,43 +196,43 @@
</target>
<target name="test-server" depends="clean-testbench-errors">
- <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
- <parallel>
- <daemons>
- <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
- </daemons>
- <sequential>
- <ant antfile="${uitest.dir}/integration_tests.xml" target="integration-test-all" inheritall="false" inheritrefs="false">
- <property name="demo.war" value="${war.file}" />
- </ant>
- </sequential>
- </parallel>
+ <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
+ <parallel>
+ <daemons>
+ <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
+ </daemons>
+ <sequential>
+ <ant antfile="${uitest.dir}/integration_tests.xml" target="integration-test-all" inheritall="false" inheritrefs="false">
+ <property name="demo.war" value="${war.file}" />
+ </ant>
+ </sequential>
+ </parallel>
</target>
<target name="test-tb2" depends="clean-testbench-errors">
- <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
- <parallel>
- <daemons>
- <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
- </daemons>
- <sequential>
- <ant antfile="${uitest.dir}/vaadin-server.xml" target="wait-for-startup" />
- <ant antfile="${uitest.dir}/test.xml" target="tb2-tests" />
- </sequential>
- </parallel>
+ <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
+ <parallel>
+ <daemons>
+ <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
+ </daemons>
+ <sequential>
+ <ant antfile="${uitest.dir}/vaadin-server.xml" target="wait-for-startup" />
+ <ant antfile="${uitest.dir}/test.xml" target="tb2-tests" />
+ </sequential>
+ </parallel>
</target>
<target name="test-tb3" depends="clean-testbench-errors">
- <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
- <parallel>
- <daemons>
- <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
- </daemons>
- <sequential>
- <ant antfile="${uitest.dir}/vaadin-server.xml" target="wait-for-startup" />
- <ant antfile="${uitest.dir}/tb3test.xml" target="run-all-tb3-tests" inheritall="true" />
- </sequential>
- </parallel>
+ <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
+ <parallel>
+ <daemons>
+ <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
+ </daemons>
+ <sequential>
+ <ant antfile="${uitest.dir}/vaadin-server.xml" target="wait-for-startup" />
+ <ant antfile="${uitest.dir}/tb3test.xml" target="run-all-tb3-tests" inheritall="true" />
+ </sequential>
+ </parallel>
</target>
<target name="clean-testbench-errors">
@@ -241,4 +245,71 @@
</delete>
</target>
+ <target name="compile-test-themes">
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo" />
+ </antcall>
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo-dark" />
+ </antcall>
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo-metro" />
+ </antcall>
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo-flat" />
+ </antcall>
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo-flatdark" />
+ </antcall>
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo-facebook" />
+ </antcall>
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo-blueprint" />
+ </antcall>
+
+ </target>
+ <target name="compile-theme" depends="copy-theme">
+ <fail unless="theme" message="You must give the theme name to compile in the 'theme' parameter" />
+
+ <ivy:resolve log="download-only" resolveid="common" conf="compile-theme" />
+ <ivy:cachepath pathid="classpath.compile.theme" conf="compile-theme" />
+ <ivy:cachepath pathid="classpath.runtime.theme" conf="build" />
+
+ <echo>Compiling ${theme}</echo>
+ <mkdir dir="${theme.result.dir}" />
+
+ <!-- compile the theme -->
+ <java classname="com.vaadin.buildhelpers.CompileTheme" classpathref="classpath.compile.theme" failonerror="yes" fork="yes" maxmemory="512m">
+ <arg value="--theme" />
+ <arg value="${theme}" />
+ <arg value="--theme-folder" />
+ <arg value="${theme.result.dir}" />
+ <arg value="--version" />
+ <arg value="${vaadin.version}" />
+ <jvmarg value="-Xss8M" />
+ <jvmarg value="-XX:MaxPermSize=256M" />
+ <jvmarg value="-Djava.awt.headless=true" />
+ </java>
+
+ </target>
+
+ <target name="copy-theme">
+ <fail unless="theme" message="You must give the theme name to copy n the 'theme' parameter" />
+ <property name="theme.source.dir" location="../WebContent/VAADIN/themes" />
+
+ <copy todir="${theme.result.dir}">
+ <fileset dir="${theme.source.dir}">
+ <include name="${theme}/**/*.scss" />
+ </fileset>
+ <filterset refid="filter-vaadin.version" />
+ </copy>
+ <copy todir="${theme.result.dir}">
+ <fileset dir="${theme.source.dir}">
+ <exclude name="${theme}/**/*.scss" />
+ </fileset>
+ </copy>
+ </target>
+
+
</project>
diff --git a/uitest/eclipse-run-selected-test.properties b/uitest/eclipse-run-selected-test.properties
index cbd1ab1cef..70010fd1da 100644
--- a/uitest/eclipse-run-selected-test.properties
+++ b/uitest/eclipse-run-selected-test.properties
@@ -1,4 +1,11 @@
;
+; This is an example property file showing how to control how TestBench is used
+; in the Vaadin Framework project. You should not modify this file since it's
+; under version control. Instead, create a copy of it inside the /work/ folder
+; in the project and make your customizations to that file.
+;
+
+;
; For both TestBench 2 and 3
;
@@ -8,6 +15,14 @@ com.vaadin.testbench.screenshot.directory=<enter the full path to the screenshot
;
+; For only TestBench 3
+;
+
+; Simulates @RunLocally with the given value on all test classes without a @RunLocally annotation.
+; com.vaadin.testbench.runLocally=firefox
+
+
+;
; For only TestBench 2
;
diff --git a/uitest/ivy.xml b/uitest/ivy.xml
index 020543c53f..9af209662c 100644
--- a/uitest/ivy.xml
+++ b/uitest/ivy.xml
@@ -15,6 +15,7 @@
<conf name="build-provided" visibility="private" />
<conf name="ide" visibility="private" />
<conf name="jetty-run" visibility="private" />
+ <conf name="compile-theme" visibility="private" />
</configurations>
<publications>
<artifact type="war" ext="war" />
@@ -99,6 +100,13 @@
<!-- This should be removed once tests have been updated to use lang3 -->
<dependency org="commons-lang" name="commons-lang"
rev="2.6" conf="build,ide -> default" />
+
+ <dependency org="com.vaadin" name="vaadin-sass-compiler"
+ rev="${vaadin.sass.version}" conf="compile-theme->default" />
+
+ <dependency org="com.vaadin" name="vaadin-buildhelpers"
+ rev="${vaadin.version}" conf="compile-theme->build" />
+
</dependencies>
</ivy-module>
diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
index a89ec4e587..1f72495596 100644
--- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
+++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
@@ -17,12 +17,17 @@ package com.vaadin.launcher;
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collections;
import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -30,7 +35,11 @@ import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import com.vaadin.launcher.CustomDeploymentConfiguration.Conf;
+import com.vaadin.server.DefaultDeploymentConfiguration;
+import com.vaadin.server.DeploymentConfiguration;
import com.vaadin.server.LegacyApplication;
import com.vaadin.server.LegacyVaadinServlet;
import com.vaadin.server.ServiceException;
@@ -43,6 +52,7 @@ import com.vaadin.server.VaadinServletRequest;
import com.vaadin.server.VaadinSession;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.UI;
+import com.vaadin.util.CurrentInstance;
@SuppressWarnings("serial")
public class ApplicationRunnerServlet extends LegacyVaadinServlet {
@@ -287,4 +297,129 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet {
return Logger.getLogger(ApplicationRunnerServlet.class.getName());
}
+ @Override
+ protected DeploymentConfiguration createDeploymentConfiguration(
+ Properties initParameters) {
+ // Get the original configuration from the super class
+ final DeploymentConfiguration originalConfiguration = super
+ .createDeploymentConfiguration(initParameters);
+
+ // And then create a proxy instance that delegates to the original
+ // configuration or a customized version
+ return (DeploymentConfiguration) Proxy.newProxyInstance(
+ DeploymentConfiguration.class.getClassLoader(),
+ new Class[] { DeploymentConfiguration.class },
+ new InvocationHandler() {
+ @Override
+ public Object invoke(Object proxy, Method method,
+ Object[] args) throws Throwable {
+ if (method.getDeclaringClass() == DeploymentConfiguration.class) {
+ // Find the configuration instance to delegate to
+ DeploymentConfiguration configuration = findDeploymentConfiguration(originalConfiguration);
+
+ return method.invoke(configuration, args);
+ } else {
+ return method.invoke(proxy, args);
+ }
+ }
+ });
+ }
+
+ private DeploymentConfiguration findDeploymentConfiguration(
+ DeploymentConfiguration originalConfiguration) throws Exception {
+ // First level of cache
+ DeploymentConfiguration configuration = CurrentInstance
+ .get(DeploymentConfiguration.class);
+
+ if (configuration == null) {
+ // Not in cache, try to find a VaadinSession to get it from
+ VaadinSession session = VaadinSession.getCurrent();
+
+ if (session == null) {
+ /*
+ * There's no current session, request or response when serving
+ * static resources, but there's still the current request
+ * maintained by AppliationRunnerServlet, and there's most
+ * likely also a HttpSession containing a VaadinSession for that
+ * request.
+ */
+
+ HttpServletRequest currentRequest = request.get();
+ if (currentRequest != null) {
+ HttpSession httpSession = currentRequest.getSession(false);
+ if (httpSession != null) {
+ Map<Class<?>, CurrentInstance> oldCurrent = CurrentInstance
+ .setCurrent((VaadinSession) null);
+ try {
+ session = getService().findVaadinSession(
+ new VaadinServletRequest(currentRequest,
+ getService()));
+ } finally {
+ /*
+ * Clear some state set by findVaadinSession to
+ * avoid accidentally depending on it when coding on
+ * e.g. static request handling.
+ */
+ CurrentInstance.restoreInstances(oldCurrent);
+ currentRequest.removeAttribute(VaadinSession.class
+ .getName());
+ }
+ }
+ }
+ }
+
+ if (session != null) {
+ String name = ApplicationRunnerServlet.class.getName()
+ + ".deploymentConfiguration";
+ try {
+ session.lock();
+ configuration = (DeploymentConfiguration) session
+ .getAttribute(name);
+
+ if (configuration == null) {
+ Class<?> classToRun;
+ try {
+ classToRun = getClassToRun();
+ } catch (ClassNotFoundException e) {
+ /*
+ * This happens e.g. if the UI class defined in the
+ * URL is not found or if this servlet just serves
+ * static resources while there's some other servlet
+ * that serves the UI (e.g. when using /run-push/).
+ */
+ return originalConfiguration;
+ }
+
+ CustomDeploymentConfiguration customDeploymentConfiguration = classToRun
+ .getAnnotation(CustomDeploymentConfiguration.class);
+ if (customDeploymentConfiguration != null) {
+ Properties initParameters = new Properties(
+ originalConfiguration.getInitParameters());
+
+ for (Conf entry : customDeploymentConfiguration
+ .value()) {
+ initParameters.put(entry.name(), entry.value());
+ }
+
+ configuration = new DefaultDeploymentConfiguration(
+ getClass(), initParameters);
+ } else {
+ configuration = originalConfiguration;
+ }
+
+ session.setAttribute(name, configuration);
+ }
+ } finally {
+ session.unlock();
+ }
+
+ CurrentInstance.set(DeploymentConfiguration.class,
+ configuration);
+
+ } else {
+ configuration = originalConfiguration;
+ }
+ }
+ return configuration;
+ }
}
diff --git a/uitest/src/com/vaadin/launcher/CustomDeploymentConfiguration.java b/uitest/src/com/vaadin/launcher/CustomDeploymentConfiguration.java
new file mode 100644
index 0000000000..da903c13e0
--- /dev/null
+++ b/uitest/src/com/vaadin/launcher/CustomDeploymentConfiguration.java
@@ -0,0 +1,36 @@
+/*
+ * 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.launcher;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(value = ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface CustomDeploymentConfiguration {
+
+ @Target(value = ElementType.TYPE)
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Conf {
+ public String name();
+
+ public String value();
+ }
+
+ public CustomDeploymentConfiguration.Conf[] value();
+}
diff --git a/uitest/src/com/vaadin/tests/VerifyAssertionsEnabled.html b/uitest/src/com/vaadin/tests/VerifyAssertionsEnabled.html
deleted file mode 100644
index 40ac075d53..0000000000
--- a/uitest/src/com/vaadin/tests/VerifyAssertionsEnabled.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="" />
-<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.VerifyAssertionsEnabled?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsVerifyAssertionsEnabled::/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0]</td>
- <td>Assertions are enabled</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/VerifyAssertionsEnabled.java b/uitest/src/com/vaadin/tests/VerifyAssertionsEnabled.java
index 84ea3a0def..aa757e5f24 100644
--- a/uitest/src/com/vaadin/tests/VerifyAssertionsEnabled.java
+++ b/uitest/src/com/vaadin/tests/VerifyAssertionsEnabled.java
@@ -17,18 +17,17 @@
package com.vaadin.tests;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractTestUI;
-import com.vaadin.ui.Label;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
-public class VerifyAssertionsEnabled extends AbstractTestUI {
+public class VerifyAssertionsEnabled extends AbstractTestUIWithLog {
@Override
protected void setup(VaadinRequest request) {
try {
assert false;
- addComponent(new Label("Assertions are not enabled"));
+ log("Assertions are not enabled");
} catch (AssertionError e) {
- addComponent(new Label("Assertions are enabled"));
+ log("Assertions are enabled");
}
}
diff --git a/uitest/src/com/vaadin/tests/VerifyAssertionsEnabledTest.java b/uitest/src/com/vaadin/tests/VerifyAssertionsEnabledTest.java
new file mode 100644
index 0000000000..1180cc8332
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/VerifyAssertionsEnabledTest.java
@@ -0,0 +1,14 @@
+package com.vaadin.tests;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class VerifyAssertionsEnabledTest extends SingleBrowserTest {
+ @Test
+ public void verifyServerAssertions() throws Exception {
+ openTestURL();
+ Assert.assertEquals("1. Assertions are enabled", getLogRow(0));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/VerifyJreVersionTest.java b/uitest/src/com/vaadin/tests/VerifyJreVersionTest.java
index 0203423787..b78a4ad314 100644
--- a/uitest/src/com/vaadin/tests/VerifyJreVersionTest.java
+++ b/uitest/src/com/vaadin/tests/VerifyJreVersionTest.java
@@ -21,9 +21,9 @@ import static org.hamcrest.core.Is.is;
import org.junit.Test;
import org.openqa.selenium.WebElement;
-import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.tb3.SingleBrowserTest;
-public class VerifyJreVersionTest extends MultiBrowserTest {
+public class VerifyJreVersionTest extends SingleBrowserTest {
@Test
public void verifyJreVersion() {
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/applicationservlet/CustomDeploymentConf.java b/uitest/src/com/vaadin/tests/applicationservlet/CustomDeploymentConf.java
new file mode 100644
index 0000000000..8ae7715a77
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/applicationservlet/CustomDeploymentConf.java
@@ -0,0 +1,55 @@
+/*
+ * 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.applicationservlet;
+
+import com.vaadin.launcher.ApplicationRunnerServlet;
+import com.vaadin.launcher.CustomDeploymentConfiguration;
+import com.vaadin.launcher.CustomDeploymentConfiguration.Conf;
+import com.vaadin.server.DeploymentConfiguration;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Label;
+
+@CustomDeploymentConfiguration({
+ @Conf(name = "customParam", value = "customValue"),
+ @Conf(name = "resourceCacheTime", value = "3599") })
+public class CustomDeploymentConf extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ DeploymentConfiguration deploymentConfiguration = getSession()
+ .getService().getDeploymentConfiguration();
+ addComponent(new Label("Resource cache time: "
+ + deploymentConfiguration.getResourceCacheTime()));
+ addComponent(new Label("Custom config param: "
+ + deploymentConfiguration.getApplicationOrSystemProperty(
+ "customParam", null)));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Demonstrates the @"
+ + CustomDeploymentConfiguration.class.getSimpleName()
+ + " feature that allows customizing the effective deployment configuration for test UIs run through "
+ + ApplicationRunnerServlet.class.getSimpleName() + ".";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(14215);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/applicationservlet/CustomDeploymentConfTest.java b/uitest/src/com/vaadin/tests/applicationservlet/CustomDeploymentConfTest.java
new file mode 100644
index 0000000000..e74eea6c55
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/applicationservlet/CustomDeploymentConfTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.applicationservlet;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.testbench.elements.VerticalLayoutElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class CustomDeploymentConfTest extends MultiBrowserTest {
+ @Test
+ public void testCustomDeploymentConf() {
+ openTestURL();
+
+ LabelElement cacheTimeLabel = $$(VerticalLayoutElement.class)
+ .$$(VerticalLayoutElement.class).$$(LabelElement.class).first();
+
+ LabelElement customParamLabel = $$(VerticalLayoutElement.class)
+ .$$(VerticalLayoutElement.class).$$(LabelElement.class).get(1);
+
+ Assert.assertEquals("Resource cache time: 3599",
+ cacheTimeLabel.getText());
+ Assert.assertEquals("Custom config param: customValue",
+ customParamLabel.getText());
+ }
+}
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/ButtonTooltips.html b/uitest/src/com/vaadin/tests/components/button/ButtonTooltips.html
deleted file mode 100644
index 13fdf52c76..0000000000
--- a/uitest/src/com/vaadin/tests/components/button/ButtonTooltips.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="http://192.168.2.168: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.button.ButtonTooltips?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsbuttonButtonTooltips::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td>0,0</td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsbuttonButtonTooltips::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td>0,0</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
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/ComboBoxSuggestionPopupClose.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupClose.java
new file mode 100644
index 0000000000..253d6a0d1e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupClose.java
@@ -0,0 +1,29 @@
+package com.vaadin.tests.components.combobox;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.ComboBox;
+
+public class ComboBoxSuggestionPopupClose extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final ComboBox select = new ComboBox("ComboBox");
+ select.addItem("one");
+ select.addItem("two");
+ select.addItem("three");
+ addComponent(select);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Closing the suggestion popup using Enter key is "
+ + "broken in combobox when opening popup using Enter "
+ + "key and not changin the selection using arrows";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14379;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupCloseTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupCloseTest.java
new file mode 100644
index 0000000000..5e9e076cac
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupCloseTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.assertFalse;
+import static org.openqa.selenium.Keys.ARROW_DOWN;
+import static org.openqa.selenium.Keys.ENTER;
+
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ComboBoxElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * @author Vaadin Ltd
+ */
+public class ComboBoxSuggestionPopupCloseTest extends MultiBrowserTest {
+
+ private WebElement selectTextbox;
+
+ @Test
+ public void closeSuggestionPopupTest() throws Exception {
+ openTestURL();
+
+ waitForElementVisible(By.className("v-filterselect"));
+
+ selectTextbox = $(ComboBoxElement.class).first().findElement(
+ By.vaadin("#textbox"));
+ selectTextbox.click();
+
+ // open popup and select first element
+ sendKeys(new Keys[] { ARROW_DOWN, ARROW_DOWN, ENTER });
+
+ // open popup and hit enter to close it
+ sendKeys(new Keys[] { ARROW_DOWN, ENTER });
+
+ assertFalse(isElementPresent(By.className("v-filterselect-suggestmenu")));
+
+ }
+
+ private void sendKeys(Keys[] keys) throws Exception {
+ for (Keys key : keys) {
+ selectTextbox.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/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..e3c85224c0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java
@@ -0,0 +1,200 @@
+/*
+ * 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) throws Exception {
+ // Popup date field has all kinds of strange timers on the
+ // client side
+ sleep(100);
+ // 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/splitpanel/SplitPanelStyleLeak.java b/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelStyleLeak.java
new file mode 100644
index 0000000000..b634e43f46
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelStyleLeak.java
@@ -0,0 +1,85 @@
+/*
+ * 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.splitpanel;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.AbstractSplitPanel;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.HorizontalSplitPanel;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalSplitPanel;
+
+public class SplitPanelStyleLeak extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ CssLayout wrap = new CssLayout();
+ addComponent(wrap);
+
+ wrap.addComponent(getSplit(true, null));
+ wrap.addComponent(getSplit(false, null));
+
+ wrap.addComponent(getSplit(true, "small"));
+ wrap.addComponent(getSplit(false, "small"));
+
+ wrap.addComponent(getSplit(true, "large"));
+ wrap.addComponent(getSplit(false, "large"));
+ }
+
+ private AbstractSplitPanel getSplit(boolean horizontal, String style) {
+ AbstractSplitPanel split = horizontal ? new HorizontalSplitPanel()
+ : new VerticalSplitPanel();
+
+ if (style != null) {
+ split.addStyleName(style);
+ }
+ split.setWidth("300px");
+ split.setHeight("300px");
+
+ AbstractSplitPanel content = horizontal ? new VerticalSplitPanel()
+ : new HorizontalSplitPanel();
+ content.addComponent(new Label("First"));
+ content.addComponent(new Label("Second"));
+ split.addComponent(content);
+
+ content = horizontal ? new VerticalSplitPanel()
+ : new HorizontalSplitPanel();
+ content.addComponent(new Label("First"));
+ split.addComponent(content);
+
+ // Inception level nesting, but we need to test that the first level
+ // styles don't leak to a nested split panel with the same orientation
+ AbstractSplitPanel content2 = horizontal ? new HorizontalSplitPanel()
+ : new VerticalSplitPanel();
+ content2.addComponent(new Label("First"));
+ content2.addComponent(new Label("Second"));
+ content.addComponent(content2);
+
+ return split;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Vertical/horizontal SplitPanel styles should not leak to any contained horizontal/vertical SplitPanel.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14152;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelStyleLeakTest.java b/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelStyleLeakTest.java
new file mode 100644
index 0000000000..1ad9cdb461
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelStyleLeakTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.splitpanel;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class SplitPanelStyleLeakTest extends MultiBrowserTest {
+
+ @Test
+ public void checkScreenshot() throws IOException {
+ openTestURL();
+ compareScreen("all");
+ }
+}
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/LabelEmbeddedClickThroughForTable.html b/uitest/src/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.html
index 62e3786a44..88ff0c01e7 100644
--- a/uitest/src/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.html
+++ b/uitest/src/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.html
@@ -55,7 +55,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[0]</td>
<td>32,9</td>
</tr>
<!-- Moved here to avoid Opera issue #5588 -->
@@ -71,7 +71,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VLabel[0]</td>
<td>22,6</td>
</tr>
<tr>
@@ -86,7 +86,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[1]/domChild[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[1]/domChild[0]</td>
<td></td>
</tr>
<tr>
@@ -96,7 +96,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VLabel[0]</td>
<td>22,6</td>
</tr>
<tr>
@@ -106,7 +106,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VEmbedded[0]/domChild[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VEmbedded[0]/domChild[0]</td>
<td>19,14</td>
</tr>
<tr>
@@ -116,7 +116,7 @@
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VEmbedded[0]/domChild[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VEmbedded[0]/domChild[0]</td>
<td>16,15</td>
</tr>
<tr>
diff --git a/uitest/src/com/vaadin/tests/components/table/MemoryLeakTable.java b/uitest/src/com/vaadin/tests/components/table/MemoryLeakTable.java
new file mode 100644
index 0000000000..1b76be3b72
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/MemoryLeakTable.java
@@ -0,0 +1,85 @@
+/*
+ * 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 com.vaadin.data.util.IndexedContainer;
+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.Table;
+
+/**
+ * Test UI Class for testing memory leak in table (#14159).
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class MemoryLeakTable extends AbstractTestUI {
+ Button btnAdd = new Button("Add rows");
+ Button btnRemove = new Button("Remove rows");
+ Button btnTenTimes = new Button("Do ten times");
+ Table tbl = new Table();
+ static final int COLS = 15;
+ static final int ROWS = 2000;
+
+ private void addRows() {
+ IndexedContainer idx = new IndexedContainer();
+ for (int i = 0; i < COLS; i++) {
+ idx.addContainerProperty("name " + i, String.class, "value");
+ }
+ for (int i = 0; i < ROWS; i++) {
+ idx.addItem("item" + i);
+ }
+ tbl.setContainerDataSource(idx);
+ addComponent(tbl);
+ }
+
+ private void removeRows() {
+ tbl.removeAllItems();
+ removeComponent(tbl);
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ btnAdd.addClickListener(new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ addRows();
+ }
+ });
+ btnRemove.addClickListener(new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ removeRows();
+ }
+ });
+ addComponent(btnAdd);
+ addComponent(btnRemove);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Generates table for memory leaking test";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14159;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/MemoryLeakTableTest.java b/uitest/src/com/vaadin/tests/components/table/MemoryLeakTableTest.java
new file mode 100644
index 0000000000..b4b8d93fbe
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/MemoryLeakTableTest.java
@@ -0,0 +1,95 @@
+/*
+ * 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.Random;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.AbstractTB3Test.RunLocally;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
+
+/**
+ * Test case creating and deleting table component in a loop, testing memory
+ * lead in Table component. This test should not be used in auto testing.
+ *
+ * To test memory consuption. Run test in debug mode. Take memory snapshot in
+ * Profiler in browser before and after the loop. Compare memory consuption.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+@RunLocally(Browser.CHROME)
+public class MemoryLeakTableTest extends MultiBrowserTest {
+
+ /**
+ *
+ */
+ private static final int ITERATIONS = 200;
+
+ // To run locally in chrome download ChromeDriver for TB3
+ // Set path to the chrome driver. In
+ // ./work/eclipse-run-selected-test.properties add line
+ // chrome.driver.path=path_to_driver
+
+ // Test is marked as ignore to exclude it from auto testing
+ @Test
+ @Ignore
+ public void memoryTest() throws IOException {
+ // Set breakoint and look memory consuption in Profiler
+ // Mozilla Firefox doesn't provide memory usage profiler, use chrome.
+
+ openTestURL();
+
+ ButtonElement btnAdd = $(ButtonElement.class).get(0);
+
+ for (int i = 0; i < ITERATIONS; i++) {
+ btnAdd.click();
+ ButtonElement btnDel = $(ButtonElement.class).get(1);
+ TableElement tbl = $(TableElement.class).get(0);
+ Random rand = new Random();
+ int scrollValue = rand.nextInt(1500);
+ scrollTable(tbl, scrollValue);
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ btnDel.click();
+ }
+ // Set breakoint and look memory consuption in Profiler
+ btnAdd = $(ButtonElement.class).get(0);
+ }
+
+ // Scrolls table element
+ // Method scroll in TalbeElement class has a bug
+ //
+ private void scrollTable(TableElement tbl, int value) {
+ WebElement actualElement = tbl.findElement(By
+ .className("v-table-body-wrapper"));
+ JavascriptExecutor js = tbl.getCommandExecutor();
+ js.executeScript("arguments[0].scrollTop = " + value, actualElement);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/PropertyValueChange.html b/uitest/src/com/vaadin/tests/components/table/PropertyValueChange.html
index 71d323cdc0..b5904120d6 100644
--- a/uitest/src/com/vaadin/tests/components/table/PropertyValueChange.html
+++ b/uitest/src/com/vaadin/tests/components/table/PropertyValueChange.html
@@ -28,7 +28,7 @@
</tr>
<tr>
<td>click</td>
- <td>vaadin=runcomvaadintestscomponentstablePropertyValueChange::PID_Seditortable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VFilterSelect[0]/domChild[1]</td>
+ <td>vaadin=runcomvaadintestscomponentstablePropertyValueChange::PID_Seditortable/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VFilterSelect[0]/domChild[1]</td>
<td></td>
</tr>
<tr>
@@ -48,7 +48,7 @@
</tr>
<tr>
<td>click</td>
- <td>vaadin=runcomvaadintestscomponentstablePropertyValueChange::PID_Seditortable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstablePropertyValueChange::PID_Seditortable/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td></td>
</tr>
<tr>
@@ -58,7 +58,7 @@
</tr>
<tr>
<td>type</td>
- <td>vaadin=runcomvaadintestscomponentstablePropertyValueChange::PID_Seditortable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstablePropertyValueChange::PID_Seditortable/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td>9</td>
</tr>
<tr>
diff --git a/uitest/src/com/vaadin/tests/components/table/SetDataSourceWithPropertyIds.html b/uitest/src/com/vaadin/tests/components/table/SetDataSourceWithPropertyIds.html
index 6975ef84d4..02132e45a7 100644
--- a/uitest/src/com/vaadin/tests/components/table/SetDataSourceWithPropertyIds.html
+++ b/uitest/src/com/vaadin/tests/components/table/SetDataSourceWithPropertyIds.html
@@ -23,7 +23,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
- <td>vaadin=runcomvaadintestscomponentstableSetDataSourceWithPropertyIds::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSetDataSourceWithPropertyIds::PID_Stable/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td></td>
</tr>
<tr>
@@ -38,7 +38,7 @@
</tr>
<tr>
<td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestscomponentstableSetDataSourceWithPropertyIds::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSetDataSourceWithPropertyIds::PID_Stable/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td></td>
</tr>
<tr>
@@ -53,7 +53,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
- <td>vaadin=runcomvaadintestscomponentstableSetDataSourceWithPropertyIds::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSetDataSourceWithPropertyIds::PID_Stable/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td></td>
</tr>
<tr>
@@ -68,7 +68,7 @@
</tr>
<tr>
<td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestscomponentstableSetDataSourceWithPropertyIds::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSetDataSourceWithPropertyIds::PID_Stable/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td></td>
</tr>
<tr>
@@ -83,7 +83,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
- <td>vaadin=runcomvaadintestscomponentstableSetDataSourceWithPropertyIds::PID_Stable/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSetDataSourceWithPropertyIds::PID_Stable/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td></td>
</tr>
</tbody></table>
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/SortLabelsInTable.html b/uitest/src/com/vaadin/tests/components/table/SortLabelsInTable.html
index 51f13af004..21d2d7f3b3 100644
--- a/uitest/src/com/vaadin/tests/components/table/SortLabelsInTable.html
+++ b/uitest/src/com/vaadin/tests/components/table/SortLabelsInTable.html
@@ -23,7 +23,7 @@
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[0]</td>
<td>Label 0</td>
</tr>
<tr>
@@ -33,7 +33,7 @@
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[14]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[14]/VLabel[0]</td>
<td>Label 14</td>
</tr>
<tr>
@@ -58,22 +58,22 @@
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[0]</td>
<td>Label 0</td>
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]/VLabel[0]</td>
<td>Label 10</td>
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[11]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[11]/VLabel[0]</td>
<td>Label 19</td>
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[14]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[14]/VLabel[0]</td>
<td>Label 4</td>
</tr>
<tr>
@@ -98,17 +98,17 @@
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[0]</td>
<td>Label 9</td>
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[8]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[8]/VLabel[0]</td>
<td>Label 19</td>
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[14]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[14]/VLabel[0]</td>
<td>Label 13</td>
</tr>
<tr>
@@ -133,17 +133,17 @@
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[0]</td>
<td>Label 9</td>
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[8]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[8]/VLabel[0]</td>
<td>Label 19</td>
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[14]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[14]/VLabel[0]</td>
<td>Label 13</td>
</tr>
<tr>
@@ -168,22 +168,22 @@
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[0]</td>
<td>Label 0</td>
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]/VLabel[0]</td>
<td>Label 10</td>
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[11]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[11]/VLabel[0]</td>
<td>Label 19</td>
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[14]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableSortLabelsInTable::/VVerticalLayout[0]/VVerticalLayout[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[14]/VLabel[0]</td>
<td>Label 4</td>
</tr>
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/TableColumnResizeContentsWidth.html b/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.html
index 9c8a12fe15..f2a3a06254 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.html
+++ b/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.html
@@ -23,7 +23,7 @@
</tr>
<tr>
<td>assertElementWidth</td>
- <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td>80</td>
</tr>
<tr>
@@ -33,7 +33,7 @@
</tr>
<tr>
<td>assertElementWidth</td>
- <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td>120</td>
</tr>
<tr>
@@ -43,7 +43,7 @@
</tr>
<tr>
<td>assertElementWidth</td>
- <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td>80</td>
</tr>
<tr>
@@ -53,7 +53,7 @@
</tr>
<tr>
<td>assertElementWidth</td>
- <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
<td>100</td>
</tr>
</tbody></table>
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/TableRowScrolledBottom.html b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.html
index e5b1f47f2d..5116fceb49 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.html
+++ b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.html
@@ -28,7 +28,7 @@
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[44]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[44]/VLabel[0]</td>
<td>This is a test item with long text so that there is something to see Nr. 100. This text must be long otherwise the timing issue on Firefox does not occur. This works fine in IE</td>
</tr>
<tr>
@@ -43,7 +43,7 @@
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[44]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[44]/VLabel[0]</td>
<td>This is a test item with long text so that there is something to see Nr. 200. This text must be long otherwise the timing issue on Firefox does not occur. This works fine in IE</td>
</tr>
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/TableSqlContainer.html b/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.html
index 96df94148c..c6ccb4df73 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.html
+++ b/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.html
@@ -28,12 +28,12 @@
</tr>
<tr>
<td>assertValue</td>
- <td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VPopupCalendar[0]#field</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VPopupCalendar[0]#field</td>
<td>5/24/13</td>
</tr>
<tr>
<td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VPopupCalendar[0]#popupButton</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VPopupCalendar[0]#popupButton</td>
<td>9,7</td>
</tr>
<tr>
diff --git a/uitest/src/com/vaadin/tests/components/table/TableTooManyColumns.java b/uitest/src/com/vaadin/tests/components/table/TableTooManyColumns.java
new file mode 100644
index 0000000000..2d27636420
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableTooManyColumns.java
@@ -0,0 +1,65 @@
+/*
+ * 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 com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.ColumnGenerator;
+
+public class TableTooManyColumns extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Table table = new Table();
+
+ table.setColumnCollapsingAllowed(true);
+
+ for (int i = 0; i < 91; i++) {
+ table.addGeneratedColumn("COLUMN " + i, new ColumnGenerator() {
+
+ @Override
+ public Object generateCell(Table source, Object itemId,
+ Object columnId) {
+ return columnId;
+ }
+ });
+ }
+
+ addComponent(table);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "Table column drop down becomes too large to fit the screen.";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 14156;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableTooManyColumnsTest.java b/uitest/src/com/vaadin/tests/components/table/TableTooManyColumnsTest.java
new file mode 100644
index 0000000000..2244365e00
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableTooManyColumnsTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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 org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.commands.TestBenchElementCommands;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TableTooManyColumnsTest extends MultiBrowserTest {
+
+ @Test
+ public void testDropdownTable() throws IOException {
+ openTestURL();
+
+ WebElement element = findElement(By
+ .className("v-table-column-selector"));
+
+ element.click();
+
+ WebElement menu = findElement(By.className("gwt-MenuBar-vertical"));
+
+ TestBenchElementCommands scrollable = testBenchElement(menu);
+ scrollable.scroll(3000);
+
+ compareScreen(getScreenshotBaseName());
+ }
+
+}
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/TableWithContainerRequiringEqualsForItemId.html b/uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemId.html
index 5364b1cd1e..0fb4648387 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemId.html
+++ b/uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemId.html
@@ -23,7 +23,7 @@
</tr>
<tr>
<td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[0]/domChild[0]/domChild[0]</td>
<td></td>
</tr>
<tr>
@@ -33,7 +33,7 @@
</tr>
<tr>
<td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[14]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[14]/VButton[0]/domChild[0]/domChild[0]</td>
<td></td>
</tr>
<tr>
@@ -58,7 +58,7 @@
</tr>
<tr>
<td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[0]/domChild[0]/domChild[0]</td>
<td></td>
</tr>
<tr>
@@ -83,7 +83,7 @@
</tr>
<tr>
<td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[0]/domChild[0]/domChild[0]</td>
<td></td>
</tr>
<tr>
diff --git a/uitest/src/com/vaadin/tests/components/table/TabletContextMenu.java b/uitest/src/com/vaadin/tests/components/table/TabletContextMenu.java
new file mode 100644
index 0000000000..193cb499a7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TabletContextMenu.java
@@ -0,0 +1,139 @@
+/*
+ * 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 com.vaadin.event.Action;
+import com.vaadin.event.Action.Handler;
+import com.vaadin.event.ShortcutAction;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Table;
+
+/**
+ * A test UI for context menus on different parts of a VSCrollTable.
+ *
+ * This UI has no attached unit test due to the poor support of touch events on
+ * Selenium.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TabletContextMenu extends AbstractTestUI {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+ setSizeFull();
+
+ HorizontalLayout layout = new HorizontalLayout();
+ layout.setSizeFull();
+ layout.setSpacing(true);
+ addComponent(layout);
+
+ Table table1 = createTable("no scrolling, has context menu");
+ addActionHandler(table1);
+ table1.addItem();
+ layout.addComponent(table1);
+
+ Table table2 = createTable("should scroll, has context menu");
+ for (int i = 0; i < 100; ++i) {
+ table2.addItem();
+ }
+ addActionHandler(table2);
+ layout.addComponent(table2);
+
+ Table table3 = createTable("no scrolling, no context menu");
+ table3.addItem();
+ layout.addComponent(table3);
+
+ Table table4 = createTable("should scroll, no context menu");
+ for (int i = 0; i < 100; ++i) {
+ table4.addItem();
+ }
+ layout.addComponent(table4);
+ }
+
+ private Table createTable(String caption) {
+ Table table = new Table(caption);
+ table.setImmediate(true);
+
+ table.addContainerProperty("column1", String.class, "test");
+ table.setSizeFull();
+ table.setHeight("500px");
+ table.setSelectable(true);
+
+ return table;
+ }
+
+ private void addActionHandler(Table table) {
+ table.addActionHandler(new Handler() {
+
+ Action tabNext = new ShortcutAction("Shift",
+ ShortcutAction.KeyCode.TAB, null);
+ Action tabPrev = new ShortcutAction("Shift+Tab",
+ ShortcutAction.KeyCode.TAB,
+ new int[] { ShortcutAction.ModifierKey.SHIFT });
+ Action curDown = new ShortcutAction("Down",
+ ShortcutAction.KeyCode.ARROW_DOWN, null);
+ Action curUp = new ShortcutAction("Up",
+ ShortcutAction.KeyCode.ARROW_UP, null);
+ Action enter = new ShortcutAction("Enter",
+ ShortcutAction.KeyCode.ENTER, null);
+ Action add = new ShortcutAction("Add Below",
+ ShortcutAction.KeyCode.A, null);
+ Action delete = new ShortcutAction("Delete",
+ ShortcutAction.KeyCode.DELETE, null);
+
+ @Override
+ public void handleAction(Action action, Object sender, Object target) {
+ System.out.println(action.getCaption());
+ }
+
+ @Override
+ public Action[] getActions(Object target, Object sender) {
+ return new Action[] { tabNext, tabPrev, curDown, curUp, enter,
+ add, delete };
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "Make sure empty table parts have context menu on touch screen devices";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 13694;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.html b/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.html
index 99f8f5bf9b..6e3d86175a 100644
--- a/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.html
+++ b/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.html
@@ -34,7 +34,7 @@
</tr>
<tr>
<td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTextFieldRelativeWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableTextFieldRelativeWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]/VButton[0]/domChild[0]/domChild[0]</td>
<td></td>
</tr>
<tr>
@@ -44,7 +44,7 @@
</tr>
<tr>
<td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTextFieldRelativeWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[4]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstableTextFieldRelativeWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[4]/VButton[0]/domChild[0]/domChild[0]</td>
<td></td>
</tr>
<tr>
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/tabsheet/TabKeyboardNavigation.html b/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.html
deleted file mode 100644
index 825988173a..0000000000
--- a/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.html
+++ /dev/null
@@ -1,241 +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" />
-<title>TabKeyboardNavigation</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TabKeyboardNavigation</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/TabKeyboardNavigation?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>9,8</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[1]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 1</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>space</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[1]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 2</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tab2</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[3]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 2</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
- <td>space</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[3]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 5</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>skip-disabled-to-tab5</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[4]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 5</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>space</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[4]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 6</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>18,10</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[9]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[10]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[8]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 9</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[10]</td>
- <td>space</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[8]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 12</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>scrolled-right-to-tab-12</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[4]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>11,2</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[4]</td>
- <td>left</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
- <td>left</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
- <td>left</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 5</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
- <td>space</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 1</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>scrolled-left-to-tab-1</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java
index ba737f1df8..620f04fe60 100644
--- a/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java
@@ -6,7 +6,8 @@ import com.vaadin.event.FieldEvents.BlurEvent;
import com.vaadin.event.FieldEvents.BlurListener;
import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.event.FieldEvents.FocusListener;
-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.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -19,7 +20,16 @@ import com.vaadin.ui.TabSheet.Tab;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
-public class TabKeyboardNavigation extends TestBase {
+/**
+ * Test if the click and key tab selection in a tabsheet generate the correct
+ * focus/blur events.
+ *
+ * The solution was broken in ticket (#14304)
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TabKeyboardNavigation extends AbstractTestUI {
int index = 1;
ArrayList<Component> tabs = new ArrayList<Component>();
@@ -27,18 +37,18 @@ public class TabKeyboardNavigation extends TestBase {
Log focusblur = new Log(10);
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
ts.setWidth("500px");
ts.setHeight("500px");
- ts.addListener(new FocusListener() {
+ ts.addFocusListener(new FocusListener() {
@Override
public void focus(FocusEvent event) {
focusblur.log("Tabsheet focused!");
}
});
- ts.addListener(new BlurListener() {
+ ts.addBlurListener(new BlurListener() {
@Override
public void blur(BlurEvent event) {
focusblur.log("Tabsheet blurred!");
@@ -74,7 +84,7 @@ public class TabKeyboardNavigation extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "The tab bar should be focusable and arrow keys should switch tabs. The del key should close a tab if closable.";
}
@@ -83,10 +93,18 @@ public class TabKeyboardNavigation extends TestBase {
return 5100;
}
+ public final static String LABEL_ID = "sheetLabel";
+
+ public final static String labelID(int index) {
+ return LABEL_ID + index;
+ }
+
private Tab addTab() {
Layout content = new VerticalLayout();
tabs.add(content);
- content.addComponent(new Label("Tab " + index));
+ Label label = new Label("Tab " + index);
+ label.setId(labelID(index));
+ content.addComponent(label);
content.addComponent(new TextField());
Tab tab = ts.addTab(content, "Tab " + index, null);
if (index == 2) {
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationTest.java
new file mode 100644
index 0000000000..65307f9492
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationTest.java
@@ -0,0 +1,188 @@
+/*
+ * 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.tabsheet;
+
+import java.io.IOException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Add TB3 test as the TB2 one failed on keyboard events.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TabKeyboardNavigationTest extends MultiBrowserTest {
+
+ @Test
+ public void testFocus() throws InterruptedException, IOException {
+ openTestURL();
+
+ click(1);
+ sendKeys(1, Keys.ARROW_RIGHT);
+
+ assertSheet(1);
+ sendKeys(2, Keys.SPACE);
+ assertSheet(2);
+ compareScreen("tab2");
+
+ sendKeys(2, Keys.ARROW_RIGHT);
+ sendKeys(3, Keys.ARROW_RIGHT);
+ assertSheet(2);
+
+ sendKeys(5, Keys.SPACE);
+ assertSheet(5);
+ compareScreen("skip-disabled-to-tab5");
+
+ TestBenchElement addTabButton = (TestBenchElement) getDriver()
+ .findElements(By.className("v-button")).get(0);
+
+ click(addTabButton);
+
+ click(5);
+ sendKeys(5, Keys.ARROW_RIGHT);
+ assertSheet(5);
+
+ sendKeys(6, Keys.SPACE);
+ assertSheet(6);
+
+ click(addTabButton);
+ click(addTabButton);
+ click(addTabButton);
+ click(addTabButton);
+ click(addTabButton);
+ click(addTabButton);
+
+ click(8);
+ compareScreen("click-tab-8");
+
+ sendKeys(8, Keys.ARROW_RIGHT);
+ sendKeys(9, Keys.SPACE);
+ click(9);
+ compareScreen("tab-9");
+
+ sendKeys(9, Keys.ARROW_RIGHT);
+ Thread.sleep(DELAY);
+
+ sendKeys(10, Keys.ARROW_RIGHT);
+
+ // Here PhantomJS used to fail. Or when accessing tab2. The fix was to
+ // call the elem.click(x, y) using the (x, y) position instead of the
+ // elem.click() without any arguments.
+ sendKeys(11, Keys.ARROW_RIGHT);
+
+ assertSheet(9);
+ sendKeys(12, Keys.SPACE);
+ assertSheet(12);
+ compareScreen("scrolled-right-to-tab-12");
+
+ click(5);
+
+ sendKeys(5, Keys.ARROW_LEFT);
+
+ // Here IE8 used to fail. A hidden <div> in IE8 would have the bounds of
+ // it's parent, and when trying to see in which direction to scroll
+ // (left or right) to make the key selected tab visible, the
+ // VTabSheet.scrollIntoView(Tab) used to check first whether the tab
+ // isClipped. On IE8 this will always return true for both hidden tabs
+ // on the left and clipped tabs on the right. So instead of going to
+ // left, it'll search all the way to the right.
+ sendKeys(3, Keys.ARROW_LEFT);
+ sendKeys(2, Keys.ARROW_LEFT);
+ assertSheet(5);
+
+ sendKeys(1, Keys.SPACE);
+ assertSheet(1);
+ compareScreen("scrolled-left-to-tab-1");
+ }
+
+ /*
+ * Press key on the element.
+ */
+ private void sendKeys(int tabIndex, Keys key) throws InterruptedException {
+ sendKeys(tab(tabIndex), key);
+ }
+
+ /*
+ * Press key on the element.
+ */
+ private void sendKeys(TestBenchElement element, Keys key)
+ throws InterruptedException {
+
+ element.sendKeys(key);
+ if (DELAY > 0) {
+ sleep(DELAY);
+ }
+ }
+
+ /*
+ * Click on the element.
+ */
+ private void click(int tabIndex) throws InterruptedException {
+ click(tab(tabIndex));
+ }
+
+ /*
+ * Click on the element.
+ */
+ private void click(TestBenchElement element) throws InterruptedException {
+
+ element.click(10, 10);
+ if (DELAY > 0) {
+ sleep(DELAY);
+ }
+ }
+
+ /*
+ * Delay for PhantomJS.
+ */
+ private final static int DELAY = 10;
+
+ private void assertSheet(int index) {
+ String labelCaption = "Tab " + index;
+
+ By id = By.id(TabKeyboardNavigation.labelID(index));
+ WebElement labelElement = getDriver().findElement(id);
+
+ waitForElementPresent(id);
+
+ Assert.assertEquals(labelCaption, labelCaption, labelElement.getText());
+ }
+
+ /*
+ * Provide the tab at specified index.
+ */
+ private TestBenchElement tab(int index) {
+ By by = By.className("v-tabsheet-tabitemcell");
+
+ TestBenchElement element = (TestBenchElement) getDriver().findElements(
+ by).get(index - 1);
+
+ String expected = "Tab " + index;
+ Assert.assertEquals(expected,
+ element.getText().substring(0, expected.length()));
+
+ return element;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScroll.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScroll.java
new file mode 100644
index 0000000000..3a5be51e47
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScroll.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.components.tabsheet;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ * If the space is pressed on the tabs of a tabsheet the browser default scroll
+ * behavior must be prevented.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TabSpaceNotScroll extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ TabSheet tabSheet = new TabSheet();
+
+ for (int i = 0; i < 5; i++) {
+ String caption = "Tab " + i;
+ Component c = new Label(caption);
+ tabSheet.addTab(c, caption);
+ }
+
+ addComponent(tabSheet);
+
+ Label dontShowThis = new Label("Page scroll. This is bad.");
+
+ VerticalLayout panel = new VerticalLayout();
+ panel.setHeight("2000px");
+ panel.addComponent(dontShowThis);
+ panel.setComponentAlignment(dontShowThis, Alignment.MIDDLE_CENTER);
+
+ addComponent(panel);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Pressing space on the tab should not scroll.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14320;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScrollTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScrollTest.java
new file mode 100644
index 0000000000..c35248c1f4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScrollTest.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.components.tabsheet;
+
+import java.io.IOException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.Point;
+
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Test if the page scroll when press space on a tabsheet's tab.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TabSpaceNotScrollTest extends MultiBrowserTest {
+
+ @Test
+ public void testScroll() throws InterruptedException, IOException {
+ openTestURL();
+
+ TestBenchElement tab = (TestBenchElement) getDriver().findElement(
+ By.className("v-tabsheet-tabitemcell"));
+ tab.click(10, 10);
+
+ Point oldLocation = tab.getLocation();
+
+ tab.sendKeys(Keys.SPACE);
+
+ Point newLocation = tab.getLocation();
+
+ Assert.assertEquals(oldLocation, newLocation);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetNotEnoughHorizontalSpace.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetNotEnoughHorizontalSpace.java
new file mode 100644
index 0000000000..0105498f27
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetNotEnoughHorizontalSpace.java
@@ -0,0 +1,75 @@
+/*
+ * 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.tabsheet;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.TabSheet;
+
+/**
+ * Test to see if tabsheet navigation buttons render correctly in Chameleon
+ *
+ * @author Vaadin Ltd
+ */
+@Theme("chameleon")
+public class TabsheetNotEnoughHorizontalSpace extends AbstractTestUI {
+
+ private TabSheet tabsheet = new TabSheet();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+ generateTabs();
+ tabsheet.setSizeFull();
+ addComponent(tabsheet);
+
+ }
+
+ private void generateTabs() {
+ tabsheet.removeAllComponents();
+ for (int i = 0; i < 100; ++i) {
+ tabsheet.addTab(new Panel(), "Tab" + i);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "Scroll-buttons should render correctly on all browsers";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 12154;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetNotEnoughHorizontalSpaceTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetNotEnoughHorizontalSpaceTest.java
new file mode 100644
index 0000000000..990f545697
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabsheetNotEnoughHorizontalSpaceTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.tabsheet;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that tabsheet's scroll button are rendered correctly in Chameleon
+ * theme.
+ *
+ * Ticket #12154
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TabsheetNotEnoughHorizontalSpaceTest extends MultiBrowserTest {
+
+ @Test
+ public void testThatTabScrollButtonsAreRenderedCorrectly()
+ throws IOException {
+ openTestURL();
+
+ driver.findElement(By.className("v-tabsheet-scrollerPrev-disabled"));
+ driver.findElement(By.className("v-tabsheet-scrollerNext"));
+
+ compareScreen(getScreenshotBaseName());
+ }
+
+}
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/TreeTableGeneratedColumns.html b/uitest/src/com/vaadin/tests/components/treetable/TreeTableGeneratedColumns.html
index 09014f3aa0..52d2fd7b3f 100644
--- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableGeneratedColumns.html
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableGeneratedColumns.html
@@ -60,7 +60,7 @@
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::PID_StestComponent/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[0]/VLabel[0]</td>
+ <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::PID_StestComponent/VScrollTable$FocusableScrollContextPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[0]/VLabel[0]</td>
<td>Item 1/Generated 1</td>
</tr>
<!--100px html label-->
@@ -86,7 +86,7 @@
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::PID_StestComponent/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[0]/VLabel[1]</td>
+ <td>vaadin=runcomvaadintestscomponentstreetableTreeTableTest::PID_StestComponent/VScrollTable$FocusableScrollContextPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[0]/VLabel[1]</td>
<td>Item 1/Generated 2</td>
</tr>
<!--plain string-->
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/ui/UISerialization.html b/uitest/src/com/vaadin/tests/components/ui/UISerialization.html
deleted file mode 100644
index 2379882a2c..0000000000
--- a/uitest/src/com/vaadin/tests/components/ui/UISerialization.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="http://localhost:8888/" />
-<title>New Test</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">New Test</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.ui.UISerialization?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsuiUISerialization::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentsuiUISerialization::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0]</td>
- <td>3. Diff states match, size: *</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentsuiUISerialization::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VLabel[0]</td>
- <td>2. Deserialized UI in *ms</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentsuiUISerialization::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VLabel[0]</td>
- <td>1. Serialized UI in *ms into * bytes</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java b/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java
new file mode 100644
index 0000000000..cbe4dbdf29
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java
@@ -0,0 +1,26 @@
+package com.vaadin.tests.components.ui;
+
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.endsWith;
+import static org.hamcrest.Matchers.startsWith;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class UISerializationTest extends SingleBrowserTest {
+ @Test
+ public void tb2test() throws Exception {
+ openTestURL();
+ $(ButtonElement.class).first().click();
+ assertThat(getLogRow(0), startsWith("3. Diff states match, size: "));
+ assertThat(getLogRow(1), startsWith("2. Deserialized UI in "));
+ assertThat(
+ getLogRow(2),
+ allOf(startsWith("1. Serialized UI in"),
+ containsString(" into "), endsWith(" bytes")));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/upload/TestFileUploadTest.java b/uitest/src/com/vaadin/tests/components/upload/TestFileUploadTest.java
index 1887427a72..ae966a5b07 100644
--- a/uitest/src/com/vaadin/tests/components/upload/TestFileUploadTest.java
+++ b/uitest/src/com/vaadin/tests/components/upload/TestFileUploadTest.java
@@ -109,7 +109,7 @@ public class TestFileUploadTest extends MultiBrowserTest {
}
private void setLocalFileDetector(WebElement element) throws Exception {
- if (getClass().isAnnotationPresent(RunLocally.class)) {
+ if (getRunLocallyBrowser() != null) {
return;
}
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/ComboboxScrollableWindowTest.java b/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java
index e65a24e907..627efdc5b3 100644
--- a/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java
+++ b/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java
@@ -35,8 +35,6 @@ public class ComboboxScrollableWindowTest extends MultiBrowserTest {
@Test
public void testWindowScrollbars() throws Exception {
openTestURL();
- com.vaadin.testbench.Parameters
- .setScreenshotComparisonCursorDetection(true);
WebElement window = driver.findElement(By.id(WINDOW_ID));
WebElement scrollableElement = window.findElement(By
diff --git a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html
deleted file mode 100644
index f926696d63..0000000000
--- a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.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>TestTooSmallSubwindowSize</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TestTooSmallSubwindowSize</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.window.TestTooSmallSubwindowSize</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
index 46845748a3..669774f715 100644
--- a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
+++ b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
@@ -1,15 +1,22 @@
package com.vaadin.tests.components.window;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
-public class TestTooSmallSubwindowSize extends TestBase {
+/**
+ * Tests that the styles work correctly in tiny subwindows that have more
+ * content than can fit.
+ *
+ * @author Vaadin Ltd
+ */
+public class TestTooSmallSubwindowSize extends AbstractTestUI {
@Override
- protected String getDescription() {
- return "The size of the subwindow (outer size) is set to 60x60 pixels. Minimum size for the content area is 150x100, which means the window and shadow should be around 155x155 and the content area 150x100. The decoration at the lower left corner of the window must not be missing either.";
+ protected String getTestDescription() {
+ return "The size of the subwindows (outer size) is set to 60x60 pixels. Make sure the shadows fits the windows instead of the contents. The decorations at the lower right corners of the resizable windows must not be missing either.";
}
@Override
@@ -18,7 +25,14 @@ public class TestTooSmallSubwindowSize extends TestBase {
}
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
+ getUI().addWindow(createNonResizableWindow());
+ getUI().addWindow(createNonResizableWindowWithHorizontalScrollbar());
+ getUI().addWindow(createResizableWindow());
+ getUI().addWindow(createResizableWindowWithHorizontalScrollbar());
+ }
+
+ private Window createNonResizableWindow() {
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
Window w = new Window("Scroll", layout);
@@ -35,13 +49,94 @@ public class TestTooSmallSubwindowSize extends TestBase {
w.setPositionY(100);
// Set window size
- w.setWidth(60, Window.UNITS_PIXELS);
- w.setHeight(60, Window.UNITS_PIXELS);
+ w.setWidth(60, Unit.PIXELS);
+ w.setHeight(60, Unit.PIXELS);
+
+ // Disable resizing
+ w.setResizable(false);
+
+ return w;
+ }
+
+ private Window createNonResizableWindowWithHorizontalScrollbar() {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("Scroll", layout);
+ Label desc = new Label(
+ "This is a new child window with a preset"
+ + " width, height and position. Resizing has been"
+ + " disabled for this window. Additionally, this text label"
+ + " is intentionally too large to fit the window. You could"
+ + " use the scrollbars to view different parts of the window content,"
+ + " except it's too small for that either.");
+ // disable wrapping
+ desc.setSizeUndefined();
+ layout.addComponent(desc);
+
+ // Set window position
+ w.setPositionX(200);
+ w.setPositionY(100);
+
+ // Set window size
+ w.setWidth(60, Unit.PIXELS);
+ w.setHeight(60, Unit.PIXELS);
// Disable resizing
- w.setResizable(true);
+ w.setResizable(false);
+
+ return w;
+ }
+
+ private Window createResizableWindow() {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("Resize", layout);
+ Label desc = new Label(
+ "This is a new child window with a preset"
+ + " width, height and position. Resizing has not been"
+ + " disabled for this window. Additionally, this text label"
+ + " is intentionally too large to fit the window. You can resize or"
+ + " use the scrollbars to view different parts of the window content.");
+ layout.addComponent(desc);
+
+ // Set window position
+ w.setPositionX(300);
+ w.setPositionY(100);
+
+ // Set window size
+ w.setWidth(60, Unit.PIXELS);
+ w.setHeight(60, Unit.PIXELS);
+
+ // Don't disable resizing
+
+ return w;
+ }
+
+ private Window createResizableWindowWithHorizontalScrollbar() {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("Resize", layout);
+ Label desc = new Label(
+ "This is a new child window with a preset"
+ + " width, height and position. Resizing has not been"
+ + " disabled for this window. Additionally, this text label"
+ + " is intentionally too large to fit the window. You can resize"
+ + " to view different parts of the window content.");
+ // disable wrapping
+ desc.setSizeUndefined();
+ layout.addComponent(desc);
+
+ // Set window position
+ w.setPositionX(400);
+ w.setPositionY(100);
+
+ // Set window size
+ w.setWidth(60, Unit.PIXELS);
+ w.setHeight(60, Unit.PIXELS);
+
+ // Don't disable resizing
- getMainWindow().addWindow(w);
+ return w;
}
}
diff --git a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSizeTest.java b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSizeTest.java
new file mode 100644
index 0000000000..0019900884
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSizeTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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 com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that the styles work correctly in tiny subwindows that have more
+ * content than can fit.
+ *
+ * @author Vaadin Ltd
+ */
+public class TestTooSmallSubwindowSizeTest extends MultiBrowserTest {
+
+ @Test
+ public void testSubwindowStyles() throws IOException {
+ openTestURL();
+
+ compareScreen("initial");
+ }
+}
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/extensions/ResponsiveLayoutUpdate.java b/uitest/src/com/vaadin/tests/extensions/ResponsiveLayoutUpdate.java
new file mode 100644
index 0000000000..4634ebff15
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/extensions/ResponsiveLayoutUpdate.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.extensions;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.Responsive;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+
+@Theme("tests-responsive")
+public class ResponsiveLayoutUpdate extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ HorizontalLayout layout = new HorizontalLayout();
+ layout.addStyleName("layout-update");
+ layout.setWidth("100%");
+ setContent(layout);
+ Responsive.makeResponsive(layout);
+
+ Label label = new Label(
+ "This label changes its size between the breakpoints, allowing more space for the adjacent component.");
+ label.addStyleName("change-width");
+ label.setSizeUndefined();
+ layout.addComponent(label);
+
+ Panel panel = new Panel("Panel");
+ panel.setContent(new Label(
+ "This Panel should be maximized in both breakpoints."));
+ panel.setSizeFull();
+ layout.addComponent(panel);
+ layout.setExpandRatio(panel, 1);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "A new layout phase should be requested after a new breakpoint is triggered, ensuring any style changes affecting component sizes are taken into account.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14354;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/extensions/ResponsiveLayoutUpdateTest.java b/uitest/src/com/vaadin/tests/extensions/ResponsiveLayoutUpdateTest.java
new file mode 100644
index 0000000000..cd0a92d339
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/extensions/ResponsiveLayoutUpdateTest.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.extensions;
+
+import org.junit.Test;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.PanelElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class ResponsiveLayoutUpdateTest extends MultiBrowserTest {
+
+ @Test
+ public void testWidthAndHeightRanges() throws Exception {
+ openTestURL();
+
+ final PanelElement panelElement = $(PanelElement.class).first();
+ // I currently have no idea why PhantomJS wants a click here to work
+ // properly
+ panelElement.click();
+ waitForElementVisible(By.cssSelector(".layout-update"));
+
+ compareScreen("large");
+
+ // Resize below 600px width breakpoint
+ testBench().resizeViewPortTo(400, 768);
+
+ waitUntil(new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver input) {
+ return panelElement.getSize().getWidth() < 500;
+ }
+ });
+ compareScreen("small");
+ }
+}
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/serialization/SerializerTest.java b/uitest/src/com/vaadin/tests/serialization/SerializerTest.java
index 1c18fb1912..333964e9bf 100644
--- a/uitest/src/com/vaadin/tests/serialization/SerializerTest.java
+++ b/uitest/src/com/vaadin/tests/serialization/SerializerTest.java
@@ -93,13 +93,13 @@ public class SerializerTest extends AbstractTestUI {
rpc.sendInt(Integer.MAX_VALUE, Integer.valueOf(0), new int[] { 5, 7 });
state.intValue = Integer.MAX_VALUE;
- state.intObjectValue = Integer.valueOf(0);
+ state.intObjectValue = Integer.valueOf(42);
state.intArray = new int[] { 5, 7 };
rpc.sendLong(577431841358l, Long.valueOf(0), new long[] {
-57841235865l, 57 });
- state.longValue = 577431841358l;
- state.longObjectValue = Long.valueOf(0);
+ state.longValue = 577431841359l;
+ state.longObjectValue = Long.valueOf(577431841360l);
state.longArray = new long[] { -57841235865l, 57 };
rpc.sendFloat(3.14159f, Float.valueOf(Math.nextUp(1)), new float[] {
@@ -111,7 +111,7 @@ public class SerializerTest extends AbstractTestUI {
rpc.sendDouble(Math.PI, Double.valueOf(-Math.E), new double[] {
Double.MAX_VALUE, Double.MIN_VALUE });
state.doubleValue = Math.PI;
- state.doubleValue = Double.valueOf(-Math.E);
+ state.doubleObjectValue = Double.valueOf(-Math.E);
state.doubleArray = new double[] { Double.MAX_VALUE, Double.MIN_VALUE };
rpc.sendString("This is a tesing string ‡");
diff --git a/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java b/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java
index 5ca1e9ce6a..47bb212347 100644
--- a/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java
+++ b/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java
@@ -77,5 +77,36 @@ public class SerializerTestTest extends MultiBrowserTest {
"sendBoolean: false, false, [false, false, true, false, true, true]",
getLogRow(logRow++));
Assert.assertEquals("sendBeanSubclass: 43", getLogRow(logRow++));
+ Assert.assertEquals(
+ "state.doubleArray: [1.7976931348623157e+308, 5e-324]",
+ getLogRow(logRow++));
+ Assert.assertEquals("state.doubleObjectValue: -2.718281828459045",
+ getLogRow(logRow++));
+ Assert.assertEquals("state.doubleValue: 3.141592653589793",
+ getLogRow(logRow++));
+ Assert.assertEquals("state.floatArray: [57, 0, -12]",
+ getLogRow(logRow++));
+ Assert.assertEquals("state.floatObjectValue: 1.0000001",
+ getLogRow(logRow++));
+ Assert.assertEquals("state.floatValue: 3.14159", getLogRow(logRow++));
+ Assert.assertEquals("state.longArray: [-57841235865, 57]",
+ getLogRow(logRow++));
+ Assert.assertEquals("state.longObjectValue: 577431841360",
+ getLogRow(logRow++));
+ Assert.assertEquals("state.longValue: 577431841359",
+ getLogRow(logRow++));
+ Assert.assertEquals("state.intArray: [5, 7]", getLogRow(logRow++));
+ Assert.assertEquals("state.intObjectValue: 42", getLogRow(logRow++));
+ Assert.assertEquals("state.intValue: 2147483647", getLogRow(logRow++));
+ Assert.assertEquals("state.charArray: aBcD", getLogRow(logRow++));
+ Assert.assertEquals("state.charObjectValue: å", getLogRow(logRow++));
+ Assert.assertEquals("state.charValue: ∫", getLogRow(logRow++));
+ Assert.assertEquals("state.byteArray: [3, 1, 2]", getLogRow(logRow++));
+ Assert.assertEquals("state.byteObjectValue: -12", getLogRow(logRow++));
+ Assert.assertEquals("state.byteValue: 5", getLogRow(logRow++));
+ Assert.assertEquals(
+ "state.booleanArray: [true, true, false, true, false, false]",
+ getLogRow(logRow++));
+
}
}
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index fa704d7b0b..b892fbe4a0 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -16,19 +16,36 @@
package com.vaadin.tests.tb3;
+import static com.vaadin.tests.tb3.TB3Runner.localWebDriverIsUsed;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import java.lang.reflect.Field;
import java.net.URL;
import java.util.Collections;
import java.util.List;
-import com.vaadin.testbench.TestBenchElement;
+import org.apache.commons.io.IOUtils;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpResponse;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicHttpEntityEnclosingRequest;
+import org.json.JSONException;
+import org.json.JSONObject;
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;
@@ -36,6 +53,7 @@ import org.openqa.selenium.interactions.internal.Coordinates;
import org.openqa.selenium.internal.Locatable;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.HttpCommandExecutor;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
@@ -45,13 +63,13 @@ 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.TestBenchDriverProxy;
+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 +103,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;
@@ -95,6 +115,11 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
desiredCapabilities = Browser.FIREFOX.getDesiredCapabilities();
}
+ static {
+ com.vaadin.testbench.Parameters
+ .setScreenshotComparisonCursorDetection(true);
+ }
+
/**
* Connect to the hub using a remote web driver, set the canvas size and
* opens the initial URL as specified by {@link #getTestUrl()}
@@ -120,9 +145,13 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
protected void setupDriver() throws Exception {
DesiredCapabilities capabilities;
- RunLocally runLocally = getClass().getAnnotation(RunLocally.class);
- if (runLocally != null) {
- capabilities = runLocally.value().getDesiredCapabilities();
+ Browser runLocallyBrowser = getRunLocallyBrowser();
+ if (runLocallyBrowser != null) {
+ if (System.getenv().containsKey("TEAMCITY_VERSION")) {
+ throw new RuntimeException(
+ "@RunLocally is not supported for tests run on the build server");
+ }
+ capabilities = runLocallyBrowser.getDesiredCapabilities();
setupLocalDriver(capabilities);
} else {
capabilities = getDesiredCapabilities();
@@ -130,9 +159,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);
}
}
@@ -152,8 +179,18 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
}
+ protected Browser getRunLocallyBrowser() {
+ RunLocally runLocally = getClass().getAnnotation(RunLocally.class);
+ if (runLocally != null) {
+ return runLocally.value();
+ } else {
+ return null;
+ }
+ }
+
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) {
@@ -205,12 +242,63 @@ 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 {
+ if (BrowserUtil.isIE(capabilities)) {
+ capabilities.setCapability(
+ InternetExplorerDriver.REQUIRE_WINDOW_FOCUS,
+ requireWindowFocusForIE());
+ capabilities.setCapability(
+ InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING,
+ usePersistentHoverForIE());
+ }
+
+ for (int i = 1; i <= BROWSER_INIT_ATTEMPTS; i++) {
+ try {
+ WebDriver dr = TestBench.createDriver(new RemoteWebDriver(
+ new URL(getHubURL()), capabilities));
+ setDriver(dr);
+ return;
+ } 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);
}
/**
@@ -328,8 +416,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 {
@@ -338,6 +425,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
@@ -383,7 +483,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);
}
@@ -395,7 +495,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);
}
@@ -408,7 +508,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);
}
@@ -420,14 +520,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;
}
/**
@@ -804,6 +932,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;
}
@@ -1025,4 +1155,93 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
return findElement(By.xpath("//button[@title='Debug message log']"));
}
+ /**
+ * Should the "require window focus" be enabled for Internet Explorer.
+ * RequireWindowFocus makes tests more stable but seems to be broken with
+ * certain commands such as sendKeys. Therefore it is not enabled by default
+ * for all tests
+ *
+ * @return true, to use the "require window focus" feature, false otherwise
+ */
+ protected boolean requireWindowFocusForIE() {
+ return false;
+ }
+
+ /**
+ * Should the "enable persistent hover" be enabled for Internet Explorer.
+ *
+ * Persistent hovering causes continuous firing of mouse over events at the
+ * last location the mouse cursor has been moved to. This is to avoid
+ * problems where the real mouse cursor is inside the browser window and
+ * Internet Explorer uses that location for some undefined operation
+ * (http://
+ * jimevansmusic.blogspot.fi/2012/06/whats-wrong-with-internet-explorer
+ * .html)
+ *
+ * @return true, to use the "persistent hover" feature, false otherwise
+ */
+ protected boolean usePersistentHoverForIE() {
+ return true;
+ }
+
+ // FIXME: Remove this once TB4 getRemoteControlName works properly
+ private RemoteWebDriver getRemoteDriver() {
+ WebDriver d = getDriver();
+ if (d instanceof TestBenchDriverProxy) {
+ try {
+ Field f = TestBenchDriverProxy.class
+ .getDeclaredField("actualDriver");
+ f.setAccessible(true);
+ return (RemoteWebDriver) f.get(d);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ if (d instanceof RemoteWebDriver) {
+ return (RemoteWebDriver) d;
+ }
+
+ return null;
+
+ }
+
+ // FIXME: Remove this once TB4 getRemoteControlName works properly
+ protected String getRemoteControlName() {
+ try {
+ RemoteWebDriver d = getRemoteDriver();
+ if (d == null) {
+ return null;
+ }
+ HttpCommandExecutor ce = (HttpCommandExecutor) d
+ .getCommandExecutor();
+ String hostName = ce.getAddressOfRemoteServer().getHost();
+ int port = ce.getAddressOfRemoteServer().getPort();
+ HttpHost host = new HttpHost(hostName, port);
+ DefaultHttpClient client = new DefaultHttpClient();
+ URL sessionURL = new URL("http://" + hostName + ":" + port
+ + "/grid/api/testsession?session=" + d.getSessionId());
+ BasicHttpEntityEnclosingRequest r = new BasicHttpEntityEnclosingRequest(
+ "POST", sessionURL.toExternalForm());
+ HttpResponse response = client.execute(host, r);
+ JSONObject object = extractObject(response);
+ URL myURL = new URL(object.getString("proxyId"));
+ if ((myURL.getHost() != null) && (myURL.getPort() != -1)) {
+ return myURL.getHost();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ private static JSONObject extractObject(HttpResponse resp)
+ throws IOException, JSONException {
+ InputStream contents = resp.getEntity().getContent();
+ StringWriter writer = new StringWriter();
+ IOUtils.copy(contents, writer, "UTF8");
+ JSONObject objToReturn = new JSONObject(writer.toString());
+ return objToReturn;
+ }
+
}
diff --git a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
index 305caf1cb5..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
@@ -22,11 +22,13 @@ import java.io.IOException;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
+import java.util.Arrays;
import java.util.Enumeration;
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;
@@ -34,23 +36,26 @@ import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.safari.SafariDriver;
import com.vaadin.testbench.TestBench;
+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 {
+ private static final String RUN_LOCALLY_PROPERTY = "com.vaadin.testbench.runLocally";
private static final String HOSTNAME_PROPERTY = "com.vaadin.testbench.deployment.hostname";
private static final String PORT_PROPERTY = "com.vaadin.testbench.deployment.port";
private static final Properties properties = new Properties();
+ private static final File propertiesFile = new File("work",
+ "eclipse-run-selected-test.properties");
static {
- File file = new File("work", "eclipse-run-selected-test.properties");
- if (file.exists()) {
+ if (propertiesFile.exists()) {
try {
- properties.load(new FileInputStream(file));
+ properties.load(new FileInputStream(propertiesFile));
} catch (IOException e) {
throw new RuntimeException(e);
}
@@ -66,6 +71,16 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
return property;
}
+ private static String getSource(String propertyName) {
+ if (properties.containsKey(propertyName)) {
+ return propertiesFile.getAbsolutePath();
+ } else if (System.getProperty(propertyName) != null) {
+ return "System.getProperty()";
+ } else {
+ return null;
+ }
+ }
+
@Override
protected String getScreenshotDirectory() {
String screenshotDirectory = getProperty("com.vaadin.testbench.screenshot.directory");
@@ -83,7 +98,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
@Override
protected String getDeploymentHostname() {
- if (getClass().getAnnotation(RunLocally.class) != null) {
+ if (getRunLocallyBrowser() != null) {
return "localhost";
}
return getConfiguredDeploymentHostname();
@@ -91,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() {
@@ -111,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() {
@@ -128,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
@@ -165,7 +180,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.tests.tb3.AbstractTB3Test#setupLocalDriver()
*/
@Override
@@ -180,9 +195,28 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
driver = new FirefoxDriver();
}
} else if (BrowserUtil.isChrome(desiredCapabilities)) {
- System.setProperty("webdriver.chrome.driver",
- getProperty("chrome.driver.path"));
- driver = new ChromeDriver();
+ String propertyName = "chrome.driver.path";
+ String chromeDriverPath = getProperty(propertyName);
+ if (chromeDriverPath == null) {
+ throw new RuntimeException(
+ "You need to install ChromeDriver to use @"
+ + RunLocally.class.getSimpleName()
+ + " with Chrome."
+ + "\nFirst install it from https://code.google.com/p/selenium/wiki/ChromeDriver."
+ + "\nThen update "
+ + propertiesFile.getAbsolutePath()
+ + " to define a property named "
+ + propertyName
+ + " containing the path of your local ChromeDriver installation.");
+ }
+ System.setProperty("webdriver.chrome.driver", chromeDriverPath);
+
+ // 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)) {
@@ -196,4 +230,28 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
setDriver(TestBench.createDriver(driver));
setDesiredCapabilities(desiredCapabilities);
}
+
+ @Override
+ protected Browser getRunLocallyBrowser() {
+ Browser runLocallyBrowser = super.getRunLocallyBrowser();
+ if (runLocallyBrowser != null) {
+ // Always use annotation value if present
+ return runLocallyBrowser;
+ }
+
+ String runLocallyValue = getProperty(RUN_LOCALLY_PROPERTY);
+ if (runLocallyValue == null || runLocallyValue.trim().isEmpty()) {
+ return null;
+ }
+
+ String browserName = runLocallyValue.trim().toUpperCase();
+ try {
+ return Browser.valueOf(browserName);
+ } catch (IllegalArgumentException e) {
+ throw new RuntimeException("Invalid " + RUN_LOCALLY_PROPERTY
+ + " property from " + getSource(RUN_LOCALLY_PROPERTY)
+ + ": " + runLocallyValue + ". Expected one of "
+ + Arrays.toString(Browser.values()));
+ }
+ }
}
diff --git a/uitest/src/com/vaadin/tests/tb3/SingleBrowserTest.java b/uitest/src/com/vaadin/tests/tb3/SingleBrowserTest.java
new file mode 100644
index 0000000000..f5dc337138
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tb3/SingleBrowserTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.tb3;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+public abstract class SingleBrowserTest extends PrivateTB3Configuration {
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ return Collections.unmodifiableList(Collections
+ .singletonList(MultiBrowserTest.Browser.PHANTOMJS
+ .getDesiredCapabilities()));
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/tb3/TB3Runner.java b/uitest/src/com/vaadin/tests/tb3/TB3Runner.java
index 4d29e479e2..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,10 +38,12 @@ 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;
-import com.vaadin.tests.tb3.AbstractTB3Test.RunLocally;
+import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
/**
* This runner is loosely based on FactoryTestRunner by Ted Young
@@ -50,6 +56,13 @@ import com.vaadin.tests.tb3.AbstractTB3Test.RunLocally;
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 {
@@ -185,17 +220,17 @@ public class TB3Runner extends BlockJUnit4ClassRunner {
/*
* Returns a list of desired browser capabilities according to browsers
* defined in the test class, filtered by possible filter parameters. Use
- * {@code @RunLocally} annotation to override all capabilities.
+ * {@code @RunLocally} annotation or com.vaadin.testbench.runLocally
+ * property to override all capabilities.
*/
private Collection<DesiredCapabilities> getDesiredCapabilities(
AbstractTB3Test testClassInstance) {
Collection<DesiredCapabilities> desiredCapabilites = getFilteredCapabilities(testClassInstance);
- if (isRunLocally(testClassInstance)) {
+ Browser runLocallyBrowser = testClassInstance.getRunLocallyBrowser();
+ if (runLocallyBrowser != null) {
desiredCapabilites = new ArrayList<DesiredCapabilities>();
- desiredCapabilites.add(testClassInstance.getClass()
- .getAnnotation(RunLocally.class).value()
- .getDesiredCapabilities());
+ desiredCapabilites.add(runLocallyBrowser.getDesiredCapabilities());
}
return desiredCapabilites;
@@ -237,10 +272,6 @@ public class TB3Runner extends BlockJUnit4ClassRunner {
return filteredCapabilities;
}
- private boolean isRunLocally(AbstractTB3Test testClassInstance) {
- return testClassInstance.getClass().getAnnotation(RunLocally.class) != null;
- }
-
private AbstractTB3Test getTestClassInstance()
throws InstantiationException, IllegalAccessException,
InvocationTargetException {
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/CalendarTest.java b/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java
index 17dfd6cb67..280ddf98b7 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java
@@ -4,7 +4,6 @@ import java.text.DateFormatSymbols;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
-import java.util.Map;
import java.util.TimeZone;
import com.vaadin.annotations.Theme;
@@ -51,6 +50,7 @@ import com.vaadin.ui.components.calendar.event.BasicEventProvider;
import com.vaadin.ui.components.calendar.event.CalendarEvent;
import com.vaadin.ui.components.calendar.handler.BasicDateClickHandler;
import com.vaadin.ui.components.calendar.handler.BasicWeekClickHandler;
+import com.vaadin.ui.themes.ValoTheme;
/** Calendar component test application */
@Theme("valo-test")
@@ -108,7 +108,7 @@ public class CalendarTest extends GridLayout implements View {
private Button applyEventButton;
- private Mode viewMode = Mode.MONTH;
+ private Mode viewMode = Mode.WEEK;
private BasicEventProvider dataSource;
@@ -152,52 +152,11 @@ public class CalendarTest extends GridLayout implements View {
setSpacing(true);
// handleURLParams(request.getParameterMap());
+ testBench = ValoThemeUI.isTestMode();
initContent();
}
- private void handleURLParams(Map<String, String[]> parameters) {
- testBench = parameters.containsKey("testBench")
- || parameters.containsKey("?testBench");
-
- if (parameters.containsKey("width")) {
- calendarWidth = parameters.get("width")[0];
- }
-
- if (parameters.containsKey("height")) {
- calendarHeight = parameters.get("height")[0];
- }
-
- if (parameters.containsKey("firstDay")) {
- firstDay = Integer.parseInt(parameters.get("firstDay")[0]);
- }
-
- if (parameters.containsKey("lastDay")) {
- lastDay = Integer.parseInt(parameters.get("lastDay")[0]);
- }
-
- if (parameters.containsKey("firstHour")) {
- firstHour = Integer.parseInt(parameters.get("firstHour")[0]);
- }
-
- if (parameters.containsKey("lastHour")) {
- lastHour = Integer.parseInt(parameters.get("lastHour")[0]);
- }
-
- if (parameters.containsKey("locale")) {
- String localeArray[] = parameters.get("locale")[0].split("_");
- defaultLocale = new Locale(localeArray[0], localeArray[1]);
- setLocale(defaultLocale);
- }
-
- if (parameters.containsKey(("secondsResolution"))) {
- useSecondResolution = true;
- }
-
- showWeeklyView = parameters.containsKey("weekly");
-
- }
-
public void initContent() {
// Set default Locale for this application
if (testBench) {
@@ -365,6 +324,9 @@ public class CalendarTest extends GridLayout implements View {
Alignment.MIDDLE_LEFT);
controlPanel.setComponentAlignment(addNewEvent, Alignment.MIDDLE_LEFT);
+ Label viewCaption = new Label("Calendar");
+ viewCaption.setStyleName(ValoTheme.LABEL_H1);
+ addComponent(viewCaption);
addComponent(controlPanel);
addComponent(hl);
addComponent(calendarComponent);
@@ -645,6 +607,11 @@ public class CalendarTest extends GridLayout implements View {
calendar.setTime(today);
calendarComponent.getInternalCalendar().setTime(today);
+ // Calendar getStartDate (and getEndDate) has some strange logic which
+ // returns Monday of the current internal time if no start date has been
+ // set
+ calendarComponent.setStartDate(calendarComponent.getStartDate());
+ calendarComponent.setEndDate(calendarComponent.getEndDate());
int rollAmount = calendar.get(GregorianCalendar.DAY_OF_MONTH) - 1;
calendar.add(GregorianCalendar.DAY_OF_MONTH, -rollAmount);
currentMonthsFirstDate = calendar.getTime();
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/CommonParts.java b/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
index 75d51ed2a6..52cc43ac28 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
@@ -131,9 +131,11 @@ public class CommonParts extends VerticalLayout implements View {
spinnerDesc.setCaption("Spinner");
content.addComponent(spinnerDesc);
- Label spinner = new Label();
- spinner.addStyleName("spinner");
- content.addComponent(spinner);
+ if (!ValoThemeUI.isTestMode()) {
+ Label spinner = new Label();
+ spinner.addStyleName("spinner");
+ content.addComponent(spinner);
+ }
return p;
}
@@ -240,6 +242,7 @@ public class CommonParts extends VerticalLayout implements View {
};
style.setCaption("Additional style");
+ style.addItem("Dark", styleCommand).setCheckable(true);
style.addItem("Success", styleCommand).setCheckable(true);
style.addItem("Failure", styleCommand).setCheckable(true);
style.addItem("Bar", styleCommand).setCheckable(true);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java
index ae520e07c2..41aa287f9f 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java
@@ -46,16 +46,16 @@ public class DateFields extends VerticalLayout implements View {
addComponent(row);
DateField date = new DateField("Default resolution");
- date.setValue(new Date());
+ setDate(date);
row.addComponent(date);
date = new DateField("Error");
- date.setValue(new Date());
+ setDate(date);
date.setComponentError(new UserError("Fix it, now!"));
row.addComponent(date);
date = new DateField("Error, borderless");
- date.setValue(new Date());
+ setDate(date);
date.setComponentError(new UserError("Fix it, now!"));
date.addStyleName("borderless");
row.addComponent(date);
@@ -77,110 +77,120 @@ public class DateFields extends VerticalLayout implements View {
group.addComponent(today);
date = new DateField("Default resolution, explicit size");
- date.setValue(new Date());
+ setDate(date);
row.addComponent(date);
date.setWidth("260px");
date.setHeight("60px");
date = new DateField("Second resolution");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.SECOND);
row.addComponent(date);
date = new DateField("Minute resolution");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.MINUTE);
row.addComponent(date);
date = new DateField("Hour resolution");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.HOUR);
row.addComponent(date);
date = new DateField("Disabled");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.HOUR);
date.setEnabled(false);
row.addComponent(date);
date = new DateField("Day resolution");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
row.addComponent(date);
date = new DateField("Month resolution");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.MONTH);
row.addComponent(date);
date = new DateField("Year resolution");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.YEAR);
row.addComponent(date);
date = new DateField("Custom color");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.addStyleName("color1");
row.addComponent(date);
date = new DateField("Custom color");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.addStyleName("color2");
row.addComponent(date);
date = new DateField("Custom color");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.addStyleName("color3");
row.addComponent(date);
date = new DateField("Small");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.addStyleName("small");
row.addComponent(date);
date = new DateField("Large");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.addStyleName("large");
row.addComponent(date);
date = new DateField("Borderless");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.addStyleName("borderless");
row.addComponent(date);
date = new DateField("Week numbers");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.setLocale(new Locale("fi", "fi"));
date.setShowISOWeekNumbers(true);
row.addComponent(date);
date = new DateField("US locale");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.SECOND);
date.setLocale(new Locale("en", "US"));
row.addComponent(date);
date = new DateField("Custom format");
- date.setValue(new Date());
+ setDate(date);
date.setDateFormat("E dd/MM/yyyy");
row.addComponent(date);
date = new InlineDateField("Date picker");
+ setDate(date);
row.addComponent(date);
date = new InlineDateField("Date picker with week numbers");
+ setDate(date);
date.setLocale(new Locale("fi", "fi"));
date.setShowISOWeekNumbers(true);
row.addComponent(date);
}
+ private void setDate(DateField date) {
+ if (ValoThemeUI.isTestMode()) {
+ date.setValue(new Date(2014 - 1900, 5, 7));
+ } else {
+ date.setValue(new Date());
+ }
+ }
+
@Override
public void enter(ViewChangeEvent event) {
// TODO Auto-generated method stub
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Forms.java b/uitest/src/com/vaadin/tests/themes/valo/Forms.java
index 9451b5c5d3..c5b08902be 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Forms.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Forms.java
@@ -47,7 +47,7 @@ public class Forms extends VerticalLayout implements View {
setSpacing(true);
setMargin(true);
- Label title = new Label("Form");
+ Label title = new Label("Forms");
title.addStyleName("h1");
addComponent(title);
@@ -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/Sliders.java b/uitest/src/com/vaadin/tests/themes/valo/Sliders.java
index 363c698c32..8ed846e39f 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Sliders.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Sliders.java
@@ -158,11 +158,12 @@ public class Sliders extends VerticalLayout implements View {
// pb2.setValue(0.6f);
row.addComponent(pb2);
- ProgressBar pb3 = new ProgressBar();
- pb3.setIndeterminate(true);
- pb3.setCaption("Indeterminate");
- row.addComponent(pb3);
-
+ if (!ValoThemeUI.isTestMode()) {
+ ProgressBar pb3 = new ProgressBar();
+ pb3.setIndeterminate(true);
+ pb3.setCaption("Indeterminate");
+ row.addComponent(pb3);
+ }
}
float progress = 0;
@@ -196,14 +197,21 @@ public class Sliders extends VerticalLayout implements View {
@Override
public void enter(ViewChangeEvent event) {
- getUI().setPollInterval(1000);
- update.start();
+ if (!ValoThemeUI.isTestMode()) {
+ getUI().setPollInterval(1000);
+ update.start();
+ } else {
+ pb.setValue(0.3f);
+ pb2.setValue(0.6f);
+ }
}
@Override
public void detach() {
- getUI().setPollInterval(-1);
- update.interrupt();
+ if (!ValoThemeUI.isTestMode()) {
+ getUI().setPollInterval(-1);
+ update.interrupt();
+ }
super.detach();
}
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..62ef67f9f3 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,16 +40,15 @@ 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);
CheckBox sized = new CheckBox("Sized");
CheckBox expandRatios = new CheckBox("Expand ratios");
- CheckBox stripes = new CheckBox("Sripes", true);
+ CheckBox stripes = new CheckBox("Stripes", true);
CheckBox verticalLines = new CheckBox("Vertical lines", true);
CheckBox horizontalLines = new CheckBox("Horizontal lines", true);
CheckBox borderless = new CheckBox("Borderless");
@@ -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..501b5f573b 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
@@ -36,13 +36,14 @@ import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.server.FontAwesome;
import com.vaadin.server.Page;
import com.vaadin.server.Resource;
+import com.vaadin.server.Responsive;
+import com.vaadin.server.ThemeResource;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.label.ContentMode;
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.CheckBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.CssLayout;
@@ -50,22 +51,45 @@ 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;
+import com.vaadin.ui.themes.ValoTheme;
@Theme("tests-valo")
@Title("Valo Theme Test")
@PreserveOnRefresh
-public class ValoThemeTest extends UI {
+public class ValoThemeUI extends UI {
+
+ private boolean testMode = false;
+
+ 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();
CssLayout menu = new CssLayout();
+ CssLayout menuItemsLayout = new CssLayout();
+ {
+ menu.setId("testMenu");
+ }
private Navigator navigator;
private LinkedHashMap<String, String> menuItems = new LinkedHashMap<String, String>();
@Override
protected void init(VaadinRequest request) {
+ if (request.getParameter("test") != null) {
+ testMode = true;
+ }
// Show .v-app-loading valo-menu-badge
// try {
// Thread.sleep(2000);
@@ -73,11 +97,12 @@ public class ValoThemeTest extends UI {
// e.printStackTrace();
// }
+ Responsive.makeResponsive(this);
+
getPage().setTitle("Valo Theme Test");
setContent(root);
root.setWidth("100%");
- root.addMenu(buildTestMenu());
root.addMenu(buildMenu());
navigator = new Navigator(this, viewDisplay);
@@ -118,13 +143,14 @@ public class ValoThemeTest extends UI {
@Override
public void afterViewChange(ViewChangeEvent event) {
- for (Iterator<Component> it = menu.iterator(); it.hasNext();) {
+ for (Iterator<Component> it = menuItemsLayout.iterator(); it
+ .hasNext();) {
it.next().removeStyleName("selected");
}
for (Entry<String, String> item : menuItems.entrySet()) {
if (event.getViewName().equals(item.getKey())) {
- for (Iterator<Component> it = menu.iterator(); it
- .hasNext();) {
+ for (Iterator<Component> it = menuItemsLayout
+ .iterator(); it.hasNext();) {
Component c = it.next();
if (c.getCaption() != null
&& c.getCaption().startsWith(
@@ -141,6 +167,10 @@ public class ValoThemeTest extends UI {
}
+ static boolean isTestMode() {
+ return ((ValoThemeUI) getCurrent()).testMode;
+ }
+
Component buildTestMenu() {
CssLayout menu = new CssLayout();
menu.addStyleName("large-icons");
@@ -201,31 +231,45 @@ 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>",
+ Button showMenu = new Button("Menu", new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (menu.getStyleName().contains("valo-menu-visible")) {
+ menu.removeStyleName("valo-menu-visible");
+ } else {
+ menu.addStyleName("valo-menu-visible");
+ }
+ }
+ });
+ showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
+ showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
+ showMenu.addStyleName("valo-menu-toggle");
+ showMenu.setIcon(FontAwesome.LIST);
+ menu.addComponent(showMenu);
+
+ Label title = new Label("<h3>Vaadin <strong>Valo Theme</strong></h3>",
ContentMode.HTML);
title.setSizeUndefined();
top.addComponent(title);
top.setExpandRatio(title, 1);
MenuBar settings = new MenuBar();
- MenuItem settingsItem = settings.addItem("", FontAwesome.COG, null);
- settingsItem.setStyleName("icon-only");
+ settings.addStyleName("user-menu");
+ StringGenerator sg = new StringGenerator();
+ MenuItem settingsItem = settings.addItem(
+ sg.nextString(true) + " " + sg.nextString(true)
+ + sg.nextString(false), new ThemeResource(
+ "../tests-valo/img/profile-pic-300px.jpg"), null);
settingsItem.addItem("Edit Profile", null);
settingsItem.addItem("Preferences", null);
settingsItem.addSeparator();
settingsItem.addItem("Sign Out", null);
- top.addComponent(settings);
+ menu.addComponent(settings);
- final CheckBox enabled = new CheckBox("Enabled", true);
- enabled.setDescription("Enable or disable the components on the right side");
- menu.addComponent(enabled);
- enabled.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- viewDisplay.setEnabled(enabled.getValue());
- }
- });
+ menuItemsLayout.setPrimaryStyleName("valo-menuitems");
+ menu.addComponent(menuItemsLayout);
Label label = null;
int count = -1;
@@ -235,7 +279,7 @@ public class ValoThemeTest extends UI {
label.setPrimaryStyleName("valo-menu-subtitle");
label.addStyleName("h4");
label.setSizeUndefined();
- menu.addComponent(label);
+ menuItemsLayout.addComponent(label);
}
if (item.getKey().equals("panels")) {
label.setValue(label.getValue()
@@ -246,7 +290,7 @@ public class ValoThemeTest extends UI {
label.setPrimaryStyleName("valo-menu-subtitle");
label.addStyleName("h4");
label.setSizeUndefined();
- menu.addComponent(label);
+ menuItemsLayout.addComponent(label);
}
if (item.getKey().equals("calendar")) {
label.setValue(label.getValue()
@@ -257,7 +301,7 @@ public class ValoThemeTest extends UI {
label.setPrimaryStyleName("valo-menu-subtitle");
label.addStyleName("h4");
label.setSizeUndefined();
- menu.addComponent(label);
+ menuItemsLayout.addComponent(label);
}
Button b = new Button(item.getValue(), new ClickListener() {
@Override
@@ -271,8 +315,8 @@ public class ValoThemeTest extends UI {
}
b.setHtmlContentAllowed(true);
b.setPrimaryStyleName("valo-menu-item");
- b.setIcon(TestIcon.get());
- menu.addComponent(b);
+ b.setIcon(testIcon.get());
+ menuItemsLayout.addComponent(b);
count++;
}
label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">"
@@ -281,17 +325,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 +376,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 +388,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,11 +404,37 @@ 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());
- ((Hierarchical) container).setChildrenAllowed(id, false);
+ testIcon.get());
+ // ((Hierarchical) container).setChildrenAllowed(id, false);
((Hierarchical) container).setParent(id, i);
+
+ for (int k = 1; k < 6; k++) {
+ String id2 = id + " -> " + k;
+ child = container.addItem(id2);
+ child.getItemProperty(CAPTION_PROPERTY).setValue(
+ sg.nextString(true) + " "
+ + sg.nextString(false));
+ child.getItemProperty(ICON_PROPERTY).setValue(
+ testIcon.get());
+ // ((Hierarchical) container)
+ // .setChildrenAllowed(id, false);
+ ((Hierarchical) container).setParent(id2, id);
+
+ for (int l = 1; l < 5; l++) {
+ String id3 = id2 + " -> " + l;
+ child = container.addItem(id3);
+ child.getItemProperty(CAPTION_PROPERTY).setValue(
+ sg.nextString(true) + " "
+ + sg.nextString(false));
+ child.getItemProperty(ICON_PROPERTY).setValue(
+ testIcon.get());
+ // ((Hierarchical) container)
+ // .setChildrenAllowed(id, false);
+ ((Hierarchical) container).setParent(id3, id2);
+ }
+ }
}
}
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java
new file mode 100644
index 0000000000..fdb2eabeee
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java
@@ -0,0 +1,239 @@
+/*
+ * 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 org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.CssLayoutElement;
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.testbench.elements.TreeElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class ValoThemeUITest extends MultiBrowserTest {
+
+ @Test
+ public void labels() throws Exception {
+ openTestURL("test");
+ open("Labels");
+ compareScreen("labels");
+ }
+
+ @Test
+ public void buttonsLinks() throws Exception {
+ openTestURL("test");
+ open("Buttons & Links", "Buttons");
+ compareScreen("buttonsLinks");
+ }
+
+ @Test
+ public void textFields() throws Exception {
+ openTestURL("test");
+ open("Text Fields <span class=\"valo-menu-badge\">123</span>",
+ "Text Fields");
+ compareScreen("textFields");
+ }
+
+ @Test
+ public void common() throws Exception {
+ openTestURL("test");
+ open("Common UI Elements");
+ compareScreen("common");
+ }
+
+ @Test
+ public void datefields() throws Exception {
+ openTestURL("test");
+ open("Date Fields");
+ // Note that this can look broken in IE9 because of some browser
+ // rendering issue... The problem seems to be in the customized
+ // horizontal layout in the test app
+ compareScreen("datefields");
+ }
+
+ @Test
+ public void comboboxes() throws Exception {
+ openTestURL("test");
+ open("Combo Boxes");
+ compareScreen("comboboxes");
+ }
+
+ @Test
+ public void selects() throws Exception {
+ openTestURL("test");
+ open("Selects");
+ compareScreen("selects");
+ }
+
+ @Test
+ public void checkboxes() throws Exception {
+ openTestURL("test");
+ open("Check Boxes & Option Groups", "Check Boxes");
+ compareScreen("checkboxes");
+ }
+
+ @Test
+ public void sliders() throws Exception {
+ openTestURL("test");
+ open("Sliders & Progress Bars", "Sliders");
+ compareScreen("sliders");
+ }
+
+ @Test
+ public void colorpickers() throws Exception {
+ openTestURL("test");
+ open("Color Pickers");
+ compareScreen("colorpickers");
+ }
+
+ @Test
+ public void menubars() throws Exception {
+ openTestURL("test");
+ open("Menu Bars");
+ compareScreen("menubars");
+ }
+
+ @Test
+ public void trees() throws Exception {
+ openTestURL("test");
+ open("Trees");
+ selectTreeNodeByCaption("Quid securi");
+ compareScreen("trees");
+ }
+
+ private void selectTreeNodeByCaption(String string) {
+ WebElement e = $(TreeElement.class).first().findElement(
+ By.xpath("//div[@class='v-tree-node-caption']//span[text()='"
+ + string + "']"));
+ e.click();
+ }
+
+ @Test
+ public void tables() throws Exception {
+ openTestURL("test");
+ open("Tables");
+ compareScreen("tables");
+ }
+
+ @Test
+ public void dragging() throws Exception {
+ openTestURL("test");
+ open("Drag and Drop", "Dragging Components");
+ compareScreen("dragging");
+ }
+
+ @Test
+ public void panels() throws Exception {
+ openTestURL("test");
+ open("Panels", "Panels & Layout panels");
+ compareScreen("panels");
+ }
+
+ @Test
+ public void splitpanels() throws Exception {
+ openTestURL("test");
+ open("Split Panels");
+ compareScreen("splitpanels");
+ }
+
+ @Test
+ public void tabs() throws Exception {
+ openTestURL("test");
+ open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
+ compareScreen("tabs");
+ }
+
+ @Test
+ public void accordions() throws Exception {
+ openTestURL("test");
+ open("Accordions");
+ compareScreen("accordions");
+ }
+
+ @Test
+ public void popupviews() throws Exception {
+ openTestURL("test");
+ open("Popup Views");
+ scrollTo(500, 0);
+ compareScreen("popupviews");
+ }
+
+ @Test
+ public void calendar() throws Exception {
+ openTestURL("test");
+ scrollTo(500, 0);
+ open("Calendar");
+
+ compareScreen("calendar");
+ }
+
+ @Test
+ public void forms() throws Exception {
+ openTestURL("test");
+ scrollTo(500, 0);
+ open("Forms");
+ compareScreen("forms");
+ }
+
+ private void open(String link) {
+ open(link, link);
+ }
+
+ private void open(String link, String caption) {
+ open(link, caption, 10);
+ }
+
+ // FIXME: Remove this once click works properly on IE...
+ private void open(String link, String caption, int tries) {
+ if (tries <= 0) {
+ throw new RuntimeException(
+ "Tried many times but was not able to click the link...");
+ }
+
+ $(ButtonElement.class).caption(link).first().click();
+ CssLayoutElement content = wrap(CssLayoutElement.class,
+ findElement(By.className("valo-content")));
+ LabelElement captionElem = content.$(LabelElement.class).first();
+ if (!captionElem.getText().equals(caption)) {
+ // IE ... why you fail clicks
+ System.err.println("Extra click needed on '" + link
+ + "' on remote " + getDesiredCapabilities() + " "
+ + getRemoteControlName());
+
+ open(link, caption, tries - 1);
+ }
+ }
+
+ private void scrollTo(int top, int left) {
+ CssLayoutElement testMenu = $(CssLayoutElement.class).id("testMenu");
+
+ testBenchElement(testMenu).scroll(top);
+ testBenchElement(testMenu).scrollLeft(left);
+ }
+
+ @Override
+ protected boolean requireWindowFocusForIE() {
+ return true;
+ }
+
+ @Override
+ protected boolean usePersistentHoverForIE() {
+ return false;
+ }
+
+}
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/tooltip/ButtonTooltips.java b/uitest/src/com/vaadin/tests/tooltip/ButtonTooltips.java
index d212a13058..c341aa689b 100644
--- a/uitest/src/com/vaadin/tests/tooltip/ButtonTooltips.java
+++ b/uitest/src/com/vaadin/tests/tooltip/ButtonTooltips.java
@@ -1,14 +1,18 @@
package com.vaadin.tests.tooltip;
-import com.vaadin.tests.components.TestBase;
+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.VerticalLayout;
-public class ButtonTooltips extends TestBase {
+public class ButtonTooltips extends AbstractTestUI {
+
+ public static final String shortDescription = "Another";
+ public static final String longDescription = "long descidescidescpription";
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "Button tooltip's size gets messed up if moving from one tooltip to another before a timer expires.";
}
@@ -18,12 +22,12 @@ public class ButtonTooltips extends TestBase {
}
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
VerticalLayout vl = new VerticalLayout();
Button button = new Button("One");
- button.setDescription("long descidescidescpription");
+ button.setDescription(longDescription);
Button button2 = new Button("Two");
- button2.setDescription("Another");
+ button2.setDescription(shortDescription);
vl.addComponent(button);
vl.addComponent(button2);
vl.setComponentAlignment(button, Alignment.TOP_RIGHT);
diff --git a/uitest/src/com/vaadin/tests/tooltip/ButtonTooltipsTest.java b/uitest/src/com/vaadin/tests/tooltip/ButtonTooltipsTest.java
index d64dd900a7..08436b1332 100644
--- a/uitest/src/com/vaadin/tests/tooltip/ButtonTooltipsTest.java
+++ b/uitest/src/com/vaadin/tests/tooltip/ButtonTooltipsTest.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
@@ -26,7 +26,7 @@ import com.vaadin.tests.tb3.TooltipTest;
/**
* Tests that tooltip sizes do not change when moving between adjacent elements
- *
+ *
* @author Vaadin Ltd
*/
public class ButtonTooltipsTest extends TooltipTest {
@@ -38,12 +38,12 @@ public class ButtonTooltipsTest extends TooltipTest {
WebElement buttonOne = $(ButtonElement.class).caption("One").first();
WebElement buttonTwo = $(ButtonElement.class).caption("Two").first();
- checkTooltip(buttonOne, "long descidescidescpription");
+ checkTooltip(buttonOne, ButtonTooltips.longDescription);
int originalWidth = getTooltipElement().getSize().getWidth();
int originalHeight = getTooltipElement().getSize().getHeight();
clearTooltip();
- checkTooltip(buttonTwo, "Another");
+ checkTooltip(buttonTwo, ButtonTooltips.shortDescription);
moveMouseTo(buttonOne, 5, 5);
sleep(100);
assertThat(getTooltipElement().getSize().getWidth(), is(originalWidth));
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/TestingWidgetSet.gwt.xml b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
index fd52e5cd0e..2c25c54e04 100644
--- a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
+++ b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
@@ -13,4 +13,9 @@
<when-type-is class="com.vaadin.client.communication.PushConnection" />
</replace-with>
+ <replace-with
+ class="com.vaadin.tests.widgetset.client.MockApplicationConnection">
+ <when-type-is class="com.vaadin.client.ApplicationConnection" />
+ </replace-with>
+
</module>
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/MockApplicationConnection.java b/uitest/src/com/vaadin/tests/widgetset/client/MockApplicationConnection.java
new file mode 100644
index 0000000000..4ee5b71387
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/MockApplicationConnection.java
@@ -0,0 +1,81 @@
+/*
+ * 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.client;
+
+import java.util.Date;
+import java.util.logging.Logger;
+
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONValue;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.ValueMap;
+import com.vaadin.shared.ApplicationConstants;
+import com.vaadin.tests.widgetset.server.csrf.ui.CsrfTokenDisabled;
+
+/**
+ * Mock ApplicationConnection for several issues where we need to hack it.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class MockApplicationConnection extends ApplicationConnection {
+
+ private static final Logger LOGGER = Logger
+ .getLogger(MockApplicationConnection.class.getName());
+
+ // The last token received from the server.
+ private String lastCsrfTokenReceiver;
+
+ // The last token sent to the server.
+ private String lastCsrfTokenSent;
+
+ /**
+ * Provide the last token received from the server. <br/>
+ * We added this to test the change done on CSRF token.
+ *
+ * @see CsrfTokenDisabled
+ */
+ public String getLastCsrfTokenReceiver() {
+ return lastCsrfTokenReceiver;
+ }
+
+ /**
+ * Provide the last token sent to the server. <br/>
+ * We added this to test the change done on CSRF token.
+ *
+ * @see CsrfTokenDisabled
+ */
+ public String getLastCsrfTokenSent() {
+ return lastCsrfTokenSent;
+ }
+
+ @Override
+ protected void handleUIDLMessage(Date start, String jsonText, ValueMap json) {
+ lastCsrfTokenReceiver = json
+ .getString(ApplicationConstants.UIDL_SECURITY_TOKEN_ID);
+
+ super.handleUIDLMessage(start, jsonText, json);
+ }
+
+ @Override
+ protected void doUidlRequest(String uri, JSONObject payload) {
+ JSONValue jsonValue = payload.get(ApplicationConstants.CSRF_TOKEN);
+ lastCsrfTokenSent = jsonValue != null ? jsonValue.toString() : null;
+
+ super.doUidlRequest(uri, payload);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java
index 0ef4b664ac..7758cdc2ac 100644
--- a/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java
+++ b/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java
@@ -284,11 +284,12 @@ public class SerializerTestConnector extends AbstractExtensionConnector {
public void onStateChanged(StateChangeEvent stateChangeEvent) {
rpc.log("state.booleanValue: " + getState().booleanValue);
rpc.log("state.booleanObjectValue: " + getState().booleanObjectValue);
- rpc.log("state.booleanArray: " + getState().booleanArray);
+ rpc.log("state.booleanArray: "
+ + Arrays.toString(getState().booleanArray));
rpc.log("state.byteValue: " + getState().byteValue);
rpc.log("state.byteObjectValue: " + getState().byteObjectValue);
- rpc.log("state.byteArray: " + getState().byteArray);
+ rpc.log("state.byteArray: " + Arrays.toString(getState().byteArray));
rpc.log("state.charValue: " + getState().charValue);
rpc.log("state.charObjectValue: " + getState().charObjectValue);
@@ -296,19 +297,19 @@ public class SerializerTestConnector extends AbstractExtensionConnector {
rpc.log("state.intValue: " + getState().intValue);
rpc.log("state.intObjectValue: " + getState().intObjectValue);
- rpc.log("state.intArray: " + getState().intArray);
+ rpc.log("state.intArray: " + Arrays.toString(getState().intArray));
rpc.log("state.longValue: " + getState().longValue);
rpc.log("state.longObjectValue: " + getState().longObjectValue);
- rpc.log("state.longArray: " + getState().longArray);
+ rpc.log("state.longArray: " + Arrays.toString(getState().longArray));
rpc.log("state.floatValue: " + getState().floatValue);
rpc.log("state.floatObjectValue: " + getState().floatObjectValue);
- rpc.log("state.floatArray: " + getState().floatArray);
+ rpc.log("state.floatArray: " + Arrays.toString(getState().floatArray));
rpc.log("state.doubleValue: " + getState().doubleValue);
rpc.log("state.doubleObjectValue: " + getState().doubleObjectValue);
- rpc.log("state.doubleArray: " + getState().doubleArray);
+ rpc.log("state.doubleArray: " + Arrays.toString(getState().doubleArray));
/*
* TODO public double doubleValue; public Double DoubleValue; public
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/csrf/CsrfButtonConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/csrf/CsrfButtonConnector.java
new file mode 100644
index 0000000000..cf24ed6921
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/csrf/CsrfButtonConnector.java
@@ -0,0 +1,82 @@
+/*
+ * 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.client.csrf;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.google.gwt.core.shared.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.vaadin.client.ui.AbstractComponentConnector;
+import com.vaadin.client.ui.VButton;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.tests.widgetset.client.MockApplicationConnection;
+import com.vaadin.tests.widgetset.server.csrf.CsrfButton;
+
+/**
+ * Dummy connector to test our CSRF bug. See #14111.
+ *
+ * @author Vaadin Ltd
+ */
+@SuppressWarnings("serial")
+@Connect(CsrfButton.class)
+public class CsrfButtonConnector extends AbstractComponentConnector {
+
+ static Logger logger = Logger
+ .getLogger(CsrfButtonConnector.class.getName());
+ static {
+ logger.setLevel(Level.ALL);
+ }
+
+ @Override
+ public VButton getWidget() {
+ return (VButton) super.getWidget();
+ }
+
+ @Override
+ protected VButton createWidget() {
+ return GWT.create(VButton.class);
+ }
+
+ public final static String ID = "CsrfButton";
+
+ @Override
+ public void init() {
+ super.init();
+
+ getWidget().getElement().setId(ID);
+ getWidget().setText(csrfTokenInfo());
+ getWidget().addClickHandler(new ClickHandler() {
+
+ @Override
+ public void onClick(ClickEvent event) {
+ getWidget().setText(csrfTokenInfo());
+ }
+ });
+ }
+
+ private String csrfTokenInfo() {
+ return getMockConnection().getCsrfToken() + ", "
+ + getMockConnection().getLastCsrfTokenReceiver() + ", "
+ + getMockConnection().getLastCsrfTokenSent();
+ }
+
+ private MockApplicationConnection getMockConnection() {
+ return (MockApplicationConnection) getConnection();
+ }
+
+}
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/csrf/CsrfButton.java b/uitest/src/com/vaadin/tests/widgetset/server/csrf/CsrfButton.java
new file mode 100644
index 0000000000..567127927d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/csrf/CsrfButton.java
@@ -0,0 +1,30 @@
+/*
+ * 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.csrf;
+
+import com.vaadin.ui.AbstractComponent;
+
+/**
+ * Dummy client connector to link with the client functionality if the
+ * CsrfToken.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+@SuppressWarnings("serial")
+public class CsrfButton extends AbstractComponent {
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/AbstractCsrfTokenUI.java b/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/AbstractCsrfTokenUI.java
new file mode 100644
index 0000000000..f8f1754385
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/AbstractCsrfTokenUI.java
@@ -0,0 +1,60 @@
+/*
+ * 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.csrf.ui;
+
+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.tests.widgetset.server.csrf.CsrfButton;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Label;
+
+/**
+ * Abstract UI to test the CSRF token issue as reported in (#14111)
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+@SuppressWarnings("serial")
+@Widgetset(TestingWidgetSet.NAME)
+public abstract class AbstractCsrfTokenUI extends AbstractTestUI {
+
+ public static final String PRESS_ID = "PressMe";
+
+ @Override
+ protected void setup(VaadinRequest request) {
+
+ addComponent(new Label("The button's text is the client token:"));
+ addComponent(new CsrfButton());
+ addComponent(new Label("This one is from the server"));
+ addComponent(new Label(getSession().getCsrfToken()));
+ Button pressMe = new Button("Click me to send a request");
+ pressMe.setId(PRESS_ID);
+ addComponent(pressMe);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Remove csrfToken from the request if security protection is disabled.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14111;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/AbstractCsrfTokenUITest.java b/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/AbstractCsrfTokenUITest.java
new file mode 100644
index 0000000000..614eaa063e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/AbstractCsrfTokenUITest.java
@@ -0,0 +1,116 @@
+/*
+ * 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.csrf.ui;
+
+import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.widgetset.client.csrf.CsrfButtonConnector;
+
+public abstract class AbstractCsrfTokenUITest extends MultiBrowserTest {
+
+ static final Logger LOGGER = Logger.getLogger(AbstractCsrfTokenUITest.class
+ .getName());
+
+ @Test
+ public void testTokens() {
+ openTestURL();
+
+ final By debugButton = By.id(CsrfButtonConnector.ID);
+
+ final String debugMessage1 = getDriver().findElement(debugButton)
+ .getText();
+
+ getDriver().findElement(By.id(CsrfTokenDisabled.PRESS_ID)).click();
+
+ waitUntil(new ExpectedCondition<Boolean>() {
+
+ @Override
+ public Boolean apply(WebDriver input) {
+ getDriver().findElement(debugButton).click();
+ String debugMessage2 = input.findElement(debugButton).getText();
+
+ LOGGER.log(Level.INFO, "1: " + debugMessage1);
+ LOGGER.log(Level.INFO, "2: " + debugMessage2);
+
+ if (!debugMessage1.equals(debugMessage2)) {
+
+ compareMessage(split(debugMessage1), split(debugMessage2));
+
+ LOGGER.log(Level.INFO, "DONE");
+
+ return true;
+
+ } else {
+ return false;
+ }
+ }
+ });
+ }
+
+ private TokenGroup split(String debugMessage) {
+ StringTokenizer tokenizer = new StringTokenizer(debugMessage, ", \"");
+
+ return new TokenGroup(tokenizer.nextToken(), tokenizer.nextToken(),
+ tokenizer.nextToken());
+ }
+
+ /*
+ * Just implement this.
+ */
+ protected abstract boolean compareMessage(TokenGroup tokenGroup1,
+ TokenGroup tokenGroup2);
+
+ boolean isNullOrUndefined(String value) {
+ return isNull(value) || isUndefined(value);
+ }
+
+ boolean isUndefined(String value) {
+ return value.equals("undefined");
+ }
+
+ boolean isNull(String value) {
+ return value.equals("null");
+ }
+
+ /*
+ * Wrapps all tokens from the client app.
+ */
+ static class TokenGroup {
+
+ public final String clientToken;
+
+ public final String tokenReceivedFromServer;
+
+ public final String tokenSentToServer;
+
+ public TokenGroup(String clientToken, String tokenReceivedFromServer,
+ String tokenSentToServer) {
+ this.clientToken = clientToken;
+ this.tokenReceivedFromServer = tokenReceivedFromServer;
+ this.tokenSentToServer = tokenSentToServer;
+ }
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenDisabled.java b/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenDisabled.java
new file mode 100644
index 0000000000..6283285b40
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenDisabled.java
@@ -0,0 +1,35 @@
+/*
+ * 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.csrf.ui;
+
+import com.vaadin.launcher.CustomDeploymentConfiguration;
+import com.vaadin.launcher.CustomDeploymentConfiguration.Conf;
+
+/**
+ * When the disable-xsrf-protection is true csrfToken is not present anymore
+ * with the requests.<br/>
+ * This is useful mostly when the client is not Vaadin and so it will not push
+ * the parameter anyway. So now the server knows how to deal the issue if the
+ * csrfToken is not present.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+@SuppressWarnings("serial")
+@CustomDeploymentConfiguration({ @Conf(name = "disable-xsrf-protection", value = "true") })
+public class CsrfTokenDisabled extends AbstractCsrfTokenUI {
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenDisabledTest.java b/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenDisabledTest.java
new file mode 100644
index 0000000000..504425fead
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenDisabledTest.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.widgetset.server.csrf.ui;
+
+import com.vaadin.shared.ApplicationConstants;
+
+/**
+ * Test the CSRF Token issue.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class CsrfTokenDisabledTest extends AbstractCsrfTokenUITest {
+
+ @Override
+ protected boolean compareMessage(TokenGroup tokenGroup1,
+ TokenGroup tokenGroup2) {
+
+ return tokenGroup1.clientToken
+ .equals(ApplicationConstants.CSRF_TOKEN_DEFAULT_VALUE)
+ && isUndefined(tokenGroup1.tokenReceivedFromServer)
+ && isUndefined(tokenGroup1.tokenSentToServer)
+ && tokenGroup2.clientToken
+ .equals(ApplicationConstants.CSRF_TOKEN_DEFAULT_VALUE)
+ && isUndefined(tokenGroup2.tokenReceivedFromServer)
+ // This is it actually, no token sent to the server.
+ && isNull(tokenGroup2.tokenSentToServer);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenEnabled.java b/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenEnabled.java
new file mode 100644
index 0000000000..cd02c6da77
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenEnabled.java
@@ -0,0 +1,25 @@
+/*
+ * 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.csrf.ui;
+
+import com.vaadin.launcher.CustomDeploymentConfiguration;
+import com.vaadin.launcher.CustomDeploymentConfiguration.Conf;
+
+@SuppressWarnings("serial")
+@CustomDeploymentConfiguration({ @Conf(name = "disable-xsrf-protection", value = "false") })
+public class CsrfTokenEnabled extends AbstractCsrfTokenUI {
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenEnabledTest.java b/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenEnabledTest.java
new file mode 100644
index 0000000000..1d51f1c372
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/csrf/ui/CsrfTokenEnabledTest.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.widgetset.server.csrf.ui;
+
+/**
+ * Test the CSRF Token issue.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class CsrfTokenEnabledTest extends AbstractCsrfTokenUITest {
+
+ @Override
+ protected boolean compareMessage(TokenGroup tokenGroup1,
+ TokenGroup tokenGroup2) {
+
+ return tokenGroup1.clientToken.equals(tokenGroup2.clientToken)
+ // Valid token received and set on the client
+ && tokenGroup1.clientToken
+ .equals(tokenGroup1.tokenReceivedFromServer)
+ // No token sent yet to the server.
+ && isUndefined(tokenGroup1.tokenSentToServer)
+ // Token is sent to the server.
+ && tokenGroup2.clientToken
+ .equals(tokenGroup2.tokenSentToServer)
+ // And no more token received from the server.
+ && isUndefined(tokenGroup2.tokenReceivedFromServer);
+ }
+
+}
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);
}
diff --git a/uitest/test.xml b/uitest/test.xml
index 57f61d67fa..2ee655ecf6 100644
--- a/uitest/test.xml
+++ b/uitest/test.xml
@@ -7,7 +7,7 @@
<!-- Configuration -->
<!-- ================================================================== -->
<!-- Browsers to use for testing -->
- <property name="browsers-windows" value="winxp-ie8,win7-ie9,win7-ie10,winxp-firefox17-esr,winxp-safari5,winxp-googlechrome21,winxp-opera12" />
+ <property name="browsers-windows" value="winxp-ie8,win7-ie9,win7-ie10,winxp-firefox17-esr,winxp-googlechrome21" />
<property name="browsers-linux" value="linux-firefox3,linux-opera10,linux-googlechrome8" />
<property name="browsers-mac" value="osx-firefox3,osx-opera10,osx-googlechrome8,osx-safari4,osx-safari5" />