summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorJouni Koivuviita <jouni@vaadin.com>2014-06-26 11:45:23 +0300
committerJouni Koivuviita <jouni@vaadin.com>2014-06-26 11:46:08 +0300
commit6327a7ea520aa314fc416d2ba94ab99d0e27dcab (patch)
tree80157093d6c2bdcc133850a16ac9e42671a2e314 /uitest
parent2701ad52c4824e815200784464e8341e1fd135ed (diff)
parent9a84fb14f2b7fc3c405f1446a007d5b9cd796c97 (diff)
downloadvaadin-framework-6327a7ea520aa314fc416d2ba94ab99d0e27dcab.tar.gz
vaadin-framework-6327a7ea520aa314fc416d2ba94ab99d0e27dcab.zip
Merge branch 'master' into valo
Change-Id: I9f804f3ba10922a3d59999df06a23f2daa4cd4e8
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/LongTooltip.html324
-rw-r--r--uitest/src/com/vaadin/tests/components/calendar/CalendarResizeOverlappingEvents.java103
-rw-r--r--uitest/src/com/vaadin/tests/components/calendar/CalendarResizeOverlappingEventsTest.java153
-rw-r--r--uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRpcCount.java62
-rw-r--r--uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRpcCountTest.java63
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxInputPrompt.java62
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxInputPromptTest.java70
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxScrollingWithArrowsTest.java81
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowedTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.java9
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/LocaleChange.java82
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/LocaleChangeTest.java62
-rw-r--r--uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.html53
-rw-r--r--uitest/src/com/vaadin/tests/components/form/FormTooltipsTest.java7
-rw-r--r--uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutExpandRatioTest.java53
-rw-r--r--uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutHideMiddleCellsTest.java40
-rw-r--r--uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentFromGridLayoutToInnerLayout.html37
-rw-r--r--uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayout.java14
-rw-r--r--uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayoutTest.java22
-rw-r--r--uitest/src/com/vaadin/tests/components/menubar/SpaceMenuBarNavigationTest.java17
-rw-r--r--uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeak.java53
-rw-r--r--uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java49
-rw-r--r--uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResize.java58
-rw-r--r--uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResizeTest.java55
-rw-r--r--uitest/src/com/vaadin/tests/components/slider/SliderTooltip.html72
-rw-r--r--uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelMoveComponent.java64
-rw-r--r--uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelMoveComponentTest.java55
-rw-r--r--uitest/src/com/vaadin/tests/components/table/SelectAllConstantViewport.java98
-rw-r--r--uitest/src/com/vaadin/tests/components/table/SelectAllConstantViewportTest.java61
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/TooltipConfigurationTest.java106
-rw-r--r--uitest/src/com/vaadin/tests/components/upload/TestFileUploadTest.java128
-rw-r--r--uitest/src/com/vaadin/tests/fieldgroup/IntegerRangeValidator.html95
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.html57
-rw-r--r--uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.html47
-rw-r--r--uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponent.java (renamed from uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.java)11
-rw-r--r--uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponentTest.java31
-rw-r--r--uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutWidthChange.java (renamed from uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.java)12
-rw-r--r--uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutWidthChangeTest.java24
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java2
-rw-r--r--uitest/src/com/vaadin/tests/tb3/TooltipTest.java27
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltips.java82
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java75
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/ButtonTooltips.java (renamed from uitest/src/com/vaadin/tests/components/button/ButtonTooltips.java)8
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/ButtonTooltipsTest.java53
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltips.java (renamed from uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.java)16
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltipsTest.java44
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/LongTooltip.java (renamed from uitest/src/com/vaadin/tests/components/LongTooltip.java)7
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/LongTooltipTest.java47
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/SliderTooltip.java42
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/SliderTooltipTest.java40
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/TooltipConfiguration.java (renamed from uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java)2
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/TooltipConfigurationTest.java73
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltip.java62
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltipTest.java46
55 files changed, 2059 insertions, 961 deletions
diff --git a/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java b/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java
index 53317bd581..43d6a55a8b 100644
--- a/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java
+++ b/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java
@@ -49,7 +49,7 @@ public class VerifyBrowserVersionTest extends MultiBrowserTest {
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36");
expectedUserAgent
.put(Browser.PHANTOMJS.getDesiredCapabilities(),
- "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.7 Safari/534.34");
+ "Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.7 Safari/534.34");
}
diff --git a/uitest/src/com/vaadin/tests/components/LongTooltip.html b/uitest/src/com/vaadin/tests/components/LongTooltip.html
deleted file mode 100644
index a5055741f1..0000000000
--- a/uitest/src/com/vaadin/tests/components/LongTooltip.html
+++ /dev/null
@@ -1,324 +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>
-<!--Lower-right-->
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.LongTooltip?restartApplication</td>
- <td></td>
-</tr>
-<!--Show tooltip, which should be on screen-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[3]/VTextField[0]</td>
- <td>0,0</td>
-</tr>
-<!--Wait for tooltip to appear-->
-<tr>
- <td>waitForVisible</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-lower-right-1</td>
-</tr>
-<!--Hide tooltip-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
- <td>55,43</td>
-</tr>
-<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
-<tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[3]/VTextField[0]</td>
- <td>0,0</td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-lower-right-2</td>
-</tr>
-<!--Hide tooltip-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
- <td>55,43</td>
-</tr>
-<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
-<tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[3]/VTextField[0]</td>
- <td>100,20</td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-lower-right-3</td>
-</tr>
-<!--Upper-right-->
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.LongTooltip?restartApplication</td>
- <td></td>
-</tr>
-<!--Show tooltip, which should be on screen-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[1]/VTextField[0]</td>
- <td>0,0</td>
-</tr>
-<!--Wait for tooltip to appear-->
-<tr>
- <td>waitForVisible</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-upper-right-1</td>
-</tr>
-<!--Hide tooltip-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
- <td>55,43</td>
-</tr>
-<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
-<tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[1]/VTextField[0]</td>
- <td>0,0</td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-upper-right-2</td>
-</tr>
-<!--Hide tooltip-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
- <td>55,43</td>
-</tr>
-<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
-<tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[1]/VTextField[0]</td>
- <td>100,20</td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-upper-right-3</td>
-</tr>
-<!--Lower-left-->
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.LongTooltip?restartApplication</td>
- <td></td>
-</tr>
-<!--Show tooltip, which should be on screen-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[2]/VTextField[0]</td>
- <td>0,0</td>
-</tr>
-<!--Wait for tooltip to appear-->
-<tr>
- <td>waitForVisible</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-lower-left-1</td>
-</tr>
-<!--Hide tooltip-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
- <td>55,43</td>
-</tr>
-<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
-<tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[2]/VTextField[0]</td>
- <td>0,0</td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-lower-left-2</td>
-</tr>
-<!--Hide tooltip-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
- <td>55,43</td>
-</tr>
-<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
-<tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[2]/VTextField[0]</td>
- <td>100,20</td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-lower-left-3</td>
-</tr>
-<!--Upper-left-->
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.LongTooltip?restartApplication</td>
- <td></td>
-</tr>
-<!--Show tooltip, which should be on screen-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VTextField[0]</td>
- <td>0,0</td>
-</tr>
-<!--Wait for tooltip to appear-->
-<tr>
- <td>waitForVisible</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-upper-left-1</td>
-</tr>
-<!--Hide tooltip-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
- <td>55,43</td>
-</tr>
-<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
-<tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VTextField[0]</td>
- <td>0,0</td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-upper-left-2</td>
-</tr>
-<!--Hide tooltip-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/VVerticalLayout[0]/VGridLayout[0]</td>
- <td>55,43</td>
-</tr>
-<!--Wait for tooltip to disappear. Cannot for some reason use waitForNotVisible-->
-<tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VTextField[0]</td>
- <td>100,20</td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>vaadin=runcomvaadintestscomponentsLongTooltip::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-upper-left-3</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarResizeOverlappingEvents.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarResizeOverlappingEvents.java
new file mode 100644
index 0000000000..2025ce2ea7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarResizeOverlappingEvents.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.calendar;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Calendar;
+import com.vaadin.ui.components.calendar.event.BasicEvent;
+import com.vaadin.ui.components.calendar.event.CalendarEvent;
+import com.vaadin.ui.components.calendar.event.CalendarEventProvider;
+
+/**
+ *
+ * @author Vaadin Ltd
+ */
+public class CalendarResizeOverlappingEvents extends AbstractTestUI {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+ Calendar calendar = new Calendar(new CalendarEventProvider() {
+
+ @Override
+ public List<CalendarEvent> getEvents(Date startDate, Date endDate) {
+ DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ DateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd");
+ List<CalendarEvent> events = new ArrayList<CalendarEvent>();
+ try {
+ java.util.Calendar today = java.util.Calendar.getInstance();
+
+ String todayString = dayFormat.format(today.getTime());
+
+ Date date1 = format.parse(todayString + " 09:00:00");
+ Date date2 = format.parse(todayString + " 11:00:00");
+ Date date3 = format.parse(todayString + " 12:00:00");
+ Date date4 = format.parse(todayString + " 14:00:00");
+ Date date5 = format.parse(todayString + " 15:00:00");
+ Date date6 = format.parse(todayString + " 17:00:00");
+
+ CalendarEvent event1 = new BasicEvent("First", "", date1,
+ date2);
+ CalendarEvent event2 = new BasicEvent("Second", "", date3,
+ date4);
+ CalendarEvent event3 = new BasicEvent("Third", "", date5,
+ date6);
+
+ events.add(event1);
+ events.add(event2);
+ events.add(event3);
+ } catch (ParseException e) {
+ }
+ return events;
+ }
+ });
+ calendar.setSizeFull();
+ setContent(calendar);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "Verify the widths of the events are correctly recalculated when these are resized and overlapped";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 13961;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarResizeOverlappingEventsTest.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarResizeOverlappingEventsTest.java
new file mode 100644
index 0000000000..f664149cce
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarResizeOverlappingEventsTest.java
@@ -0,0 +1,153 @@
+/*
+ * 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.calendar;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ *
+ * @author Vaadin Ltd
+ */
+public class CalendarResizeOverlappingEventsTest extends MultiBrowserTest {
+
+ private int noOverlapWidth;
+ private int oneOverlapWidth;
+ private int twoOverlapsWidth;
+
+ private WebElement firstEvent;
+ private WebElement secondEvent;
+ private WebElement thirdEvent;
+
+ private WebElement firstEventBottomResize;
+ private WebElement secondEventBottomResize;
+ private WebElement thirdEventBottomResize;
+
+ @Test
+ public void testCalendarResizeOverlappingEvents()
+ throws InterruptedException, IOException {
+
+ openTestURL();
+ initParams();
+ doTest();
+ }
+
+ private void doTest() {
+ assertWidths(noOverlapWidth, noOverlapWidth, noOverlapWidth);
+
+ dragAndDrop(firstEventBottomResize, 240);
+ assertWidths(oneOverlapWidth, oneOverlapWidth, oneOverlapWidth);
+
+ dragAndDrop(secondEventBottomResize, 240);
+ assertWidths(twoOverlapsWidth, twoOverlapsWidth, twoOverlapsWidth);
+
+ dragAndDrop(secondEventBottomResize, -240);
+ dragAndDrop(firstEventBottomResize, -240);
+ assertWidths(noOverlapWidth, noOverlapWidth, noOverlapWidth);
+
+ }
+
+ private void assertWidths(int firstEventExpectedWidth,
+ int secondEventExpectedWidth, int thirdEventExpectedWidth) {
+ int widthTolerance = 5;
+ String errorMessage = "Wrong event width after resizing, expected [%d] (+/-%d), obtained [%d]";
+
+ int actualWidth = firstEvent.getSize().getWidth();
+ int expectedWidth = firstEventExpectedWidth;
+ Assert.assertTrue(String.format(errorMessage, expectedWidth,
+ widthTolerance, actualWidth),
+ isAproximateWidth(actualWidth, expectedWidth, widthTolerance));
+
+ actualWidth = secondEvent.getSize().getWidth();
+ expectedWidth = secondEventExpectedWidth;
+ Assert.assertTrue(String.format(errorMessage, expectedWidth,
+ widthTolerance, actualWidth),
+ isAproximateWidth(actualWidth, expectedWidth, widthTolerance));
+
+ actualWidth = thirdEvent.getSize().getWidth();
+ expectedWidth = thirdEventExpectedWidth;
+ Assert.assertTrue(String.format(errorMessage, expectedWidth,
+ widthTolerance, actualWidth),
+ isAproximateWidth(actualWidth, expectedWidth, widthTolerance));
+ }
+
+ private boolean isAproximateWidth(int actualWidth, int expectedWidth,
+ int tolerance) {
+ return Math.abs(expectedWidth - actualWidth) <= tolerance;
+ }
+
+ private void dragAndDrop(WebElement element, int yOffset) {
+ /*
+ * Selenium doesn't properly drag and drop items in IE8. It tries to
+ * start dragging an element from a position above the element itself.
+ */
+ if (BrowserUtil.isIE8(getDesiredCapabilities())) {
+ Actions action = new Actions(getDriver());
+ action.moveToElement(element);
+ action.moveByOffset(0, 1);
+ action.clickAndHold();
+ action.moveByOffset(0, yOffset);
+ action.release();
+ action.build().perform();
+ } else {
+ Actions action = new Actions(getDriver());
+ action.dragAndDropBy(element, 0, yOffset);
+ action.build().perform();
+ }
+ }
+
+ private void initParams() {
+ WebElement dateSlot = getDriver().findElement(
+ By.className("v-datecellslot"));
+ int dateSlotWidth = dateSlot.getSize().getWidth();
+ noOverlapWidth = dateSlotWidth;
+ oneOverlapWidth = dateSlotWidth / 2;
+ twoOverlapsWidth = dateSlotWidth / 3;
+
+ Comparator<WebElement> startTimeComparator = new Comparator<WebElement>() {
+ @Override
+ public int compare(WebElement e1, WebElement e2) {
+ int e1Top = e1.getLocation().getY();
+ int e2Top = e2.getLocation().getY();
+ return e1Top - e2Top;
+ }
+ };
+
+ List<WebElement> eventElements = getDriver().findElements(
+ By.className("v-calendar-event-content"));
+ Collections.sort(eventElements, startTimeComparator);
+ firstEvent = eventElements.get(0);
+ secondEvent = eventElements.get(1);
+ thirdEvent = eventElements.get(2);
+
+ List<WebElement> resizeBottomElements = getDriver().findElements(
+ By.className("v-calendar-event-resizebottom"));
+ Collections.sort(resizeBottomElements, startTimeComparator);
+ firstEventBottomResize = resizeBottomElements.get(0);
+ secondEventBottomResize = resizeBottomElements.get(1);
+ thirdEventBottomResize = resizeBottomElements.get(2);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRpcCount.java b/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRpcCount.java
new file mode 100644
index 0000000000..bd44e8a074
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRpcCount.java
@@ -0,0 +1,62 @@
+/*
+ * 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.checkbox;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.checkbox.CheckBoxServerRpc;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Label;
+
+public class CheckBoxRpcCount extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Label countLabel = new Label("No RPC calls made yet.");
+ countLabel.setId("count-label");
+ addComponent(countLabel);
+
+ CheckBox cb = new CheckBox("Click me to start counting...") {
+ {
+ // Register a new RPC that counts the number of invocations.
+ registerRpc(new CheckBoxServerRpc() {
+ private int rpcCount = 0;
+
+ @Override
+ public void setChecked(boolean checked,
+ MouseEventDetails mouseEventDetails) {
+ rpcCount++;
+ countLabel.setValue(rpcCount + " RPC call(s) made.");
+ }
+
+ });
+ }
+ };
+ addComponent(cb);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Test for verifying that no extra RPC calls are made when clicking on CheckBox label.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8259;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRpcCountTest.java b/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRpcCountTest.java
new file mode 100644
index 0000000000..9d6640eb6d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRpcCountTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.checkbox;
+
+import static org.junit.Assert.assertEquals;
+
+import com.vaadin.testbench.elements.CheckBoxElement;
+import com.vaadin.testbench.elements.LabelElement;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+public class CheckBoxRpcCountTest extends MultiBrowserTest {
+
+ @Test
+ public void numberOfRpcCallsIsEqualToClicks() {
+ openTestURL();
+
+ CheckBoxElement checkBoxElement = $(CheckBoxElement.class).first();
+ WebElement labelElem = checkBoxElement.findElement(By.tagName("label"));
+ WebElement inputElem = checkBoxElement.findElement(By.tagName("input"));
+ final WebElement countElem = $(LabelElement.class).id("count-label");
+
+ // Click on the actual checkbox.
+ inputElem.click();
+ //Have to use waitUntil to make this test more stable.
+ waitUntilLabelIsUpdated(countElem, "1 RPC call(s) made.");
+
+ // Click on the checkbox label.
+ labelElem.click();
+ waitUntilLabelIsUpdated(countElem, "2 RPC call(s) made.");
+
+ // Again on the label.
+ labelElem.click();
+ waitUntilLabelIsUpdated(countElem, "3 RPC call(s) made.");
+ }
+
+ private void waitUntilLabelIsUpdated(final WebElement countElem, final String expectedText) {
+ waitUntil(new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver input) {
+ return countElem.getText().equals(expectedText);
+ }
+ }, 5);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInputPrompt.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInputPrompt.java
new file mode 100644
index 0000000000..082aca6989
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInputPrompt.java
@@ -0,0 +1,62 @@
+/*
+ * 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.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.ComboBox;
+
+public class ComboBoxInputPrompt extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final ComboBox cb1 = new ComboBox("Normal");
+ cb1.setInputPrompt("Normal input prompt");
+
+ final ComboBox cb2 = new ComboBox("Disabled");
+ cb2.setEnabled(false);
+ cb2.setInputPrompt("Disabled input prompt");
+
+ final ComboBox cb3 = new ComboBox("Read-only");
+ cb3.setReadOnly(true);
+ cb3.setInputPrompt("Read-only input prompt");
+
+ Button enableButton = new Button("Toggle enabled",
+ new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ cb2.setEnabled(!cb2.isEnabled());
+ cb3.setReadOnly(!cb3.isReadOnly());
+ }
+ });
+
+ addComponents(cb1, cb2, cb3, enableButton);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "ComboBox should not display the input prompt if disabled or read-only.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 10573;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInputPromptTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInputPromptTest.java
new file mode 100644
index 0000000000..96151022ff
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInputPromptTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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 static org.hamcrest.Matchers.isEmptyString;
+import static org.junit.Assert.assertEquals;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.ComboBoxElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.AbstractTB3Test;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class ComboBoxInputPromptTest extends MultiBrowserTest {
+
+ @Test
+ public void promptIsHiddenForDisabledAndReadonly() {
+ openTestURL();
+
+ ComboBoxElement normalComboBox = getComboBoxWithCaption("Normal");
+ ComboBoxElement disabledComboBox = getComboBoxWithCaption("Disabled");
+ ComboBoxElement readOnlyComboBox = getComboBoxWithCaption("Read-only");
+
+ 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"));
+
+ toggleDisabledAndReadonly();
+ assertThat(getInputPromptValue(disabledComboBox), isEmptyString());
+ assertThat(getInputPromptValue(readOnlyComboBox), isEmptyString());
+ }
+
+ private void toggleDisabledAndReadonly() {
+ $(ButtonElement.class).first().click();
+ }
+
+ private String getInputPromptValue(ComboBoxElement comboBox) {
+ WebElement input = comboBox.findElement(By.tagName("input"));
+
+ return input.getAttribute("value");
+ }
+
+ private ComboBoxElement getComboBoxWithCaption(String caption) {
+ return $(ComboBoxElement.class).caption(caption).first();
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxScrollingWithArrowsTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxScrollingWithArrowsTest.java
index bc03593e3f..fa6f5a3a93 100644
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxScrollingWithArrowsTest.java
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxScrollingWithArrowsTest.java
@@ -15,16 +15,19 @@
*/
package com.vaadin.tests.components.combobox;
-import java.util.List;
-
-import org.junit.Assert;
-import org.junit.Before;
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ComboBoxElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
import org.junit.Test;
import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedCondition;
-import com.vaadin.testbench.By;
-import com.vaadin.tests.tb3.MultiBrowserTest;
+import java.util.List;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
/**
* When pressed down key, while positioned on the last item - should show next
@@ -32,52 +35,72 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
*/
public class ComboBoxScrollingWithArrowsTest extends MultiBrowserTest {
- @Before
- public void openURL() {
+ private final int PAGESIZE = 10;
+
+ @Override
+ public void setup() throws Exception {
+ super.setup();
+
openTestURL();
+ openPopup();
}
- @Test
- public void scrollDownArrowKeyTest() throws InterruptedException {
- final int ITEMS_PER_PAGE = 10;
+ private WebElement getDropDown() {
// Selenium is used instead of TestBench4, because there is no method to
// access the popup of the combobox
// The method ComboBoxElement.openPopup() opens the popup, but doesn't
// provide any way to access the popup and send keys to it.
// Ticket #13756
- WebElement dropDownComboBox = driver.findElement(By
+
+ return driver.findElement(By
.className("v-filterselect-input"));
- // opens Lookup
- dropDownComboBox.sendKeys(Keys.DOWN);
+ }
+
+ private void openPopup() {
+ ComboBoxElement cb = $(ComboBoxElement.class).first();
+ cb.openPopup();
+ }
+
+ @Test
+ public void scrollDownArrowKeyTest() throws InterruptedException {
+ WebElement dropDownComboBox = getDropDown();
+
// go to the last item and then one more
- for (int i = 0; i < ITEMS_PER_PAGE + 1; i++) {
+ for (int i = 0; i < PAGESIZE + 1; i++) {
dropDownComboBox.sendKeys(Keys.DOWN);
}
- String expected = "item " + ITEMS_PER_PAGE;// item 10
+ assertThat(getSelectedItemText(), is("item " + PAGESIZE)); //item 10
+ }
+
+ private String getSelectedItemText() {
List<WebElement> items = driver.findElements(By
.className("gwt-MenuItem-selected"));
- String actual = items.get(0).getText();
- Assert.assertEquals(expected, actual);
+ return items.get(0).getText();
}
@Test
public void scrollUpArrowKeyTest() throws InterruptedException {
- final int ITEMS_PER_PAGE = 10;
- WebElement dropDownComboBox = driver.findElement(By
- .className("v-filterselect-input"));
- // opens Lookup
- dropDownComboBox.sendKeys(Keys.DOWN);
+ WebElement dropDownComboBox = getDropDown();
+
// go to the last item and then one more
- for (int i = 0; i < ITEMS_PER_PAGE + 1; i++) {
+ for (int i = 0; i < PAGESIZE + 1; i++) {
dropDownComboBox.sendKeys(Keys.DOWN);
}
+
// move to one item up
+ waitUntilNextPageIsVisible();
dropDownComboBox.sendKeys(Keys.UP);
- String expected = "item " + (ITEMS_PER_PAGE - 1);// item 9
- List<WebElement> items = driver.findElements(By
- .className("gwt-MenuItem-selected"));
- String actual = items.get(0).getText();
- Assert.assertEquals(expected, actual);
+
+ assertThat(getSelectedItemText(), is("item " + (PAGESIZE - 1))); //item 9
+ }
+
+ private void waitUntilNextPageIsVisible() {
+ waitUntil(new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver input) {
+ return getSelectedItemText().equals("item " + PAGESIZE);
+ }
+ }, 5);
}
}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowedTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowedTest.java
index 54d355ab0a..7951187fa7 100644
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowedTest.java
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowedTest.java
@@ -46,9 +46,11 @@ public class ComboBoxSetNullWhenNewItemsAllowedTest extends MultiBrowserTest {
assertEquals("New value", element.getAttribute("value"));
if (BrowserUtil.isPhantomJS(getDesiredCapabilities())) {
new Actions(getDriver()).sendKeys(Keys.ENTER).perform();
+ Thread.sleep(500);
} else {
element.sendKeys(Keys.RETURN);
}
+
assertEquals("", element.getAttribute("value"));
}
}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.java
index 392dbaf9c6..304c978381 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.java
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.java
@@ -3,16 +3,18 @@ package com.vaadin.tests.components.datefield;
import java.util.Calendar;
import java.util.Locale;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.DateField;
-public class DateFieldReadOnly extends TestBase {
+public class DateFieldReadOnly extends AbstractTestUI {
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "A read-only DateField should not show the popup button and not be editable.";
}
@@ -22,7 +24,7 @@ public class DateFieldReadOnly extends TestBase {
}
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
final DateField timeField = new DateField("A read-only datefield");
timeField.setResolution(DateField.RESOLUTION_SEC);
timeField.setDateFormat("HH:mm:ss");
@@ -30,6 +32,7 @@ public class DateFieldReadOnly extends TestBase {
timeField.setIcon(null);
timeField.setWidth("8em");
timeField.addStyleName("timeField");
+ timeField.setLocale(new Locale("fi"));
// Set date so that testing always has same time
Calendar c = Calendar.getInstance(Locale.ENGLISH);
diff --git a/uitest/src/com/vaadin/tests/components/datefield/LocaleChange.java b/uitest/src/com/vaadin/tests/components/datefield/LocaleChange.java
new file mode 100644
index 0000000000..f69c93419b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/LocaleChange.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.components.datefield;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+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;
+
+public class LocaleChange extends AbstractTestUI {
+
+ private final Locale locale12hClock = Locale.US;
+ private final Locale locale24hClock = Locale.FRANCE;
+
+ private final String caption = "Switch to %s hour clock";
+ private static final Date dateValue;
+ static {
+ try {
+ dateValue = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss")
+ .parse("2014-05-22 20:00:00");
+ } catch (ParseException e) {
+ throw new ExceptionInInitializerError("Should never happen.");
+ }
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final DateField df = new DateField();
+ df.setLocale(locale24hClock);
+ df.setResolution(Resolution.SECOND);
+ df.setValue(dateValue);
+
+ Button button = new Button(String.format(caption, "12"));
+ button.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (locale12hClock.equals(df.getLocale())) {
+ df.setLocale(locale24hClock);
+ event.getButton().setCaption(String.format(caption, "12"));
+ } else {
+ df.setLocale(locale12hClock);
+ event.getButton().setCaption(String.format(caption, "24"));
+ }
+ }
+ });
+
+ addComponent(df);
+ addComponent(button);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Testing locale change from one with 24h clock to a 12h clock locale.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 13722;
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/datefield/LocaleChangeTest.java b/uitest/src/com/vaadin/tests/components/datefield/LocaleChangeTest.java
new file mode 100644
index 0000000000..cf756034a1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/LocaleChangeTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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 org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class LocaleChangeTest extends MultiBrowserTest {
+
+ @Test
+ public void testLocaleChange() {
+ openTestURL();
+
+ // Check the initial value and that popup can be opened.
+ assertEquals("22/05/14 20:00:00", getDateValue());
+ toggleDatePopup();
+ assertPopupOpen(true);
+
+ // Close the popup and change the locale.
+ toggleDatePopup();
+ assertPopupOpen(false);
+ driver.findElement(By.className("v-button")).click(); // Locale change.
+
+ // Check that the value has changed and the popup can still be opened
+ // without problems.
+ assertEquals("5/22/14 08:00:00 PM", getDateValue());
+ toggleDatePopup();
+ assertPopupOpen(true);
+ }
+
+ private void assertPopupOpen(boolean open) {
+ assertEquals("Date popup was not " + (open ? "open" : "closed") + ".",
+ (open ? 1 : 0),
+ driver.findElements(By.className("v-datefield-popup")).size());
+ }
+
+ private void toggleDatePopup() {
+ driver.findElement(By.className("v-datefield-button")).click();
+ }
+
+ private String getDateValue() {
+ return driver.findElement(By.className("v-datefield-textfield"))
+ .getAttribute("value");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.html b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.html
deleted file mode 100644
index 3c91c8b24f..0000000000
--- a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.html
+++ /dev/null
@@ -1,53 +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.draganddropwrapper.DragAndDropWrapperTooltips?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragAndDropWrapperTooltips::PID_Swrapper3/VLabel[0]</td>
- <td>0,0</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-initial</td>
-</tr>
-<!--Drag Block 4 between Block 1 and Block 2-->
-<tr>
- <td>drag</td>
- <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragAndDropWrapperTooltips::PID_Swrapper4/VLabel[0]</td>
- <td>30,41</td>
-</tr>
-<tr>
- <td>drop</td>
- <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragAndDropWrapperTooltips::PID_Swrapper2</td>
- <td>4,42</td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentsdraganddropwrapperDragAndDropWrapperTooltips::PID_Swrapper1/VLabel[0]</td>
- <td>0,0</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tooltip-after-drag</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/form/FormTooltipsTest.java b/uitest/src/com/vaadin/tests/components/form/FormTooltipsTest.java
index df18d4082d..cb71fef3ef 100644
--- a/uitest/src/com/vaadin/tests/components/form/FormTooltipsTest.java
+++ b/uitest/src/com/vaadin/tests/components/form/FormTooltipsTest.java
@@ -33,9 +33,7 @@ public class FormTooltipsTest extends TooltipTest {
WebElement fieldElement = $(FormElement.class).first()
.$(TextFieldElement.class).first();
checkTooltip(fieldElement, "Fields own tooltip");
-
- moveToRoot();
- Thread.sleep(1000);
+ clearTooltip();
checkTooltipNotPresent();
// first name caption tooltip
@@ -43,8 +41,7 @@ public class FormTooltipsTest extends TooltipTest {
$(FormElement.class).first().findElement(
By.className("v-caption")), "Fields own tooltip");
- moveToRoot();
- Thread.sleep(1000);
+ clearTooltip();
checkTooltipNotPresent();
// Form should not have a description tooltip
diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutExpandRatioTest.java b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutExpandRatioTest.java
index 7d5ad1fbc4..d4d36bd10f 100644
--- a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutExpandRatioTest.java
+++ b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutExpandRatioTest.java
@@ -15,32 +15,30 @@
*/
package com.vaadin.tests.components.gridlayout;
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridLayoutElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
import org.junit.Test;
import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedCondition;
-import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.testbench.elements.GridLayoutElement;
-import com.vaadin.tests.tb3.MultiBrowserTest;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
public class GridLayoutExpandRatioTest extends MultiBrowserTest {
@Test
- public void gridLayoutExpandRatioTest() {
+ public void cellSizesAreCorrectlyCalculated() {
openTestURL();
- GridLayoutElement gridLayout5x5 = $(GridLayoutElement.class).get(0);
- GridLayoutElement gridLayout4x4 = $(GridLayoutElement.class).get(1);
- ButtonElement hidingButton = $(ButtonElement.class).get(0);
- hidingButton.click();
- List<WebElement> slots5x5 = gridLayout5x5.findElements(By
- .className("v-gridlayout-slot"));
- List<WebElement> slots4x4 = gridLayout4x4.findElements(By
- .className("v-gridlayout-slot"));
- assertEquals("Different amount of slots", slots5x5.size(),
- slots4x4.size());
+
+ hideMiddleRowAndColumn();
+ final List<WebElement> slots4x4 = getSlots(1);
+
+ waitUntilColumnAndRowAreHidden(slots4x4);
+ final List<WebElement> slots5x5 = getSlots(0);
+
for (int i = 0; i < slots5x5.size(); i++) {
WebElement compared = slots5x5.get(i);
WebElement actual = slots4x4.get(i);
@@ -50,4 +48,23 @@ public class GridLayoutExpandRatioTest extends MultiBrowserTest {
compared.getCssValue("left"), actual.getCssValue("left"));
}
}
+
+ private void waitUntilColumnAndRowAreHidden(final List<WebElement> slots4x4) {
+ waitUntil(new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver input) {
+ return getSlots(0).size() == slots4x4.size();
+ }
+ }, 5);
+ }
+
+ private List<WebElement> getSlots(int index) {
+ GridLayoutElement layout = $(GridLayoutElement.class).get(index);
+
+ return layout.findElements(By.className("v-gridlayout-slot"));
+ }
+
+ private void hideMiddleRowAndColumn() {
+ $(ButtonElement.class).first().click();
+ }
}
diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutHideMiddleCellsTest.java b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutHideMiddleCellsTest.java
index d0225275f7..a5eb9b6e04 100644
--- a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutHideMiddleCellsTest.java
+++ b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutHideMiddleCellsTest.java
@@ -15,43 +15,5 @@
*/
package com.vaadin.tests.components.gridlayout;
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-
-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.GridLayoutElement;
-import com.vaadin.tests.tb3.MultiBrowserTest;
-
-public class GridLayoutHideMiddleCellsTest extends MultiBrowserTest {
- @Test
- public void gridLayoutInvisibleElementsTest() {
- openTestURL();
- GridLayoutElement gridLayout5x5 = $(GridLayoutElement.class).get(0);
- GridLayoutElement gridLayout4x4 = $(GridLayoutElement.class).get(1);
- ButtonElement hidingButton = $(ButtonElement.class).get(0);
- hidingButton.click();
- List<WebElement> slots5x5 = gridLayout5x5.findElements(By
- .className("v-gridlayout-slot"));
- List<WebElement> slots4x4 = gridLayout4x4.findElements(By
- .className("v-gridlayout-slot"));
- assertEquals("Different amount of slots", slots5x5.size(),
- slots4x4.size());
-
- for (int i = 0; i < slots5x5.size(); i++) {
- assertEquals("Different left coordinate for element " + i, slots5x5
- .get(i).getCssValue("left"),
- slots4x4.get(i).getCssValue("left"));
- }
- for (int i = 0; i < slots5x5.size(); i++) {
- assertEquals("Different top coordinate for element " + i, slots5x5
- .get(i).getCssValue("top"),
- slots4x4.get(i).getCssValue("top"));
- }
- }
-
+public class GridLayoutHideMiddleCellsTest extends GridLayoutExpandRatioTest {
}
diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentFromGridLayoutToInnerLayout.html b/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentFromGridLayoutToInnerLayout.html
deleted file mode 100644
index ed6d39f63d..0000000000
--- a/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentFromGridLayoutToInnerLayout.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>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.gridlayout.MoveComponentsFromGridLayoutToInnerLayout?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsgridlayoutMoveComponentsFromGridLayoutToInnerLayout::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsgridlayoutMoveComponentsFromGridLayoutToInnerLayout::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>buttons-with-captions</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayout.java b/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayout.java
index 0106f2e218..4f5b29c91f 100644
--- a/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayout.java
+++ b/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayout.java
@@ -1,20 +1,19 @@
package com.vaadin.tests.components.gridlayout;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
+import com.vaadin.ui.*;
import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.ComponentContainer;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.VerticalLayout;
-public class MoveComponentsFromGridLayoutToInnerLayout extends TestBase {
+public class MoveComponentsFromGridLayoutToInnerLayout extends AbstractTestUI {
protected Button testButton;
private GridLayout gl;
protected ComponentContainer vl;
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
gl = new GridLayout();
gl.setWidth("200px");
gl.setHeight("200px");
@@ -31,6 +30,7 @@ public class MoveComponentsFromGridLayoutToInnerLayout extends TestBase {
gl.addComponent(testButton);
vl = new VerticalLayout();
+ vl.addComponent(new Label("I'm inside the inner layout"));
gl.addComponent(vl);
addComponent(gl);
@@ -48,7 +48,7 @@ public class MoveComponentsFromGridLayoutToInnerLayout extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "Click the first button to move it from an outer layout to an inner. Then click the second button to repaint the inner layout.";
}
diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayoutTest.java b/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayoutTest.java
new file mode 100644
index 0000000000..eb4888ea1a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayoutTest.java
@@ -0,0 +1,22 @@
+package com.vaadin.tests.components.gridlayout;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.AbstractTB3Test;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.*;
+
+public class MoveComponentsFromGridLayoutToInnerLayoutTest extends MultiBrowserTest {
+
+ @Test
+ public void buttonIsMovedInsideInnerLayout() throws IOException {
+ openTestURL();
+
+ $(ButtonElement.class).first().click();
+
+ compareScreen("buttonClicked");
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/menubar/SpaceMenuBarNavigationTest.java b/uitest/src/com/vaadin/tests/components/menubar/SpaceMenuBarNavigationTest.java
index 3e0053d0d1..a32a611d9a 100644
--- a/uitest/src/com/vaadin/tests/components/menubar/SpaceMenuBarNavigationTest.java
+++ b/uitest/src/com/vaadin/tests/components/menubar/SpaceMenuBarNavigationTest.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
@@ -23,10 +23,11 @@ import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.MenuBarElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
/**
- *
+ *
* @since 7.2
* @author Vaadin Ltd
*/
@@ -36,19 +37,21 @@ public class SpaceMenuBarNavigationTest extends MultiBrowserTest {
public void testEnableParentLayout() {
openTestURL();
- WebElement menu = driver.findElement(By.className("menu-bar"));
+ MenuBarElement menu = $(MenuBarElement.class).get(0);
+ menu.focus();
menu.sendKeys(Keys.ARROW_RIGHT);
- menu.sendKeys(Keys.SPACE);
+ menu.sendKeys(Keys.ENTER);
List<WebElement> captions = driver.findElements(By
.className("v-menubar-menuitem-caption"));
boolean found = false;
+
for (WebElement caption : captions) {
if ("subitem".equals(caption.getText())) {
found = true;
}
}
- Assert.assertTrue("Sub menu is not opened on SPACE key", found);
+ Assert.assertTrue("Sub menu is not opened on ENTER key", found);
menu.sendKeys(Keys.SPACE);
diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeak.java b/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeak.java
index 7d347d6180..c715aa383a 100644
--- a/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeak.java
+++ b/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeak.java
@@ -1,13 +1,13 @@
package com.vaadin.tests.components.orderedlayout;
import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.CssLayout;
-import com.vaadin.ui.Label;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TextField;
-import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
/**
@@ -17,23 +17,32 @@ import com.vaadin.ui.VerticalLayout;
* @since 7.1.13
* @author Vaadin Ltd
*/
-public class CaptionLeak extends UI {
-
- public static final String USAGE = "Open this UI with ?debug and count"
- + " measured non-connector elements after setting leaky and non leaky"
- + " content.";
+public class CaptionLeak extends AbstractTestUI {
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
@Override
- public void init(VaadinRequest req) {
- final VerticalLayout root = new VerticalLayout();
- setContent(root);
- Label usage = new Label(USAGE);
+ protected void setup(VaadinRequest request) {
+ VerticalLayout root = new VerticalLayout();
+ root.setSizeFull();
+ root.setMargin(false);
+ root.setSpacing(false);
+
+ HorizontalLayout layout = new HorizontalLayout();
Panel parent = new Panel();
Button setLeakyContent = makeButton("Set leaky content", parent,
VerticalLayout.class);
Button setNonLeakyContent = makeButton("Set non leaky content", parent,
CssLayout.class);
- root.addComponents(usage, setLeakyContent, setNonLeakyContent, parent);
+ layout.addComponent(setLeakyContent);
+ layout.addComponent(setNonLeakyContent);
+ root.addComponent(layout);
+ root.addComponent(parent);
+ setContent(root);
}
private Button makeButton(String caption, final Panel parent,
@@ -59,4 +68,24 @@ public class CaptionLeak extends UI {
return btn;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "Open this UI with ?debug and count measured non-connector elements after setting leaky and non leaky content.";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
}
diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java b/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java
index 0fbd0e5f69..a95ceca22b 100644
--- a/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java
+++ b/uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java
@@ -18,6 +18,7 @@ package com.vaadin.tests.components.orderedlayout;
import org.junit.Test;
import org.openqa.selenium.By;
+import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class CaptionLeakTest extends MultiBrowserTest {
@@ -26,43 +27,53 @@ public class CaptionLeakTest extends MultiBrowserTest {
public void testCaptionLeak() throws Exception {
setDebug(true);
openTestURL();
- openDebugLogTab();
+
+ openLog();
// this should be present
// 3 general non-connector elements, none accumulated on click
- getDriver()
- .findElement(
- By.xpath("//span[text() = 'Measured 3 non connector elements']"));
+ checkConnectorCount();
- getDriver().findElement(By.xpath("//button[@title = 'Clear log']"))
- .click();
- getDriver().findElement(By.id("Set leaky content")).click();
+ clearLog();
- getDriver()
- .findElement(
- By.xpath("//span[text() = 'Measured 3 non connector elements']"));
+ $(ButtonElement.class).caption("Set leaky content").first().click();
+
+ checkConnectorCount();
// nothing accumulates over clicks
- getDriver().findElement(By.xpath("//button[@title = 'Clear log']"))
- .click();
- getDriver().findElement(By.id("Set leaky content")).click();
- getDriver()
- .findElement(
- By.xpath("//span[text() = 'Measured 3 non connector elements']"));
+ clearLog();
+
+ $(ButtonElement.class).caption("Set leaky content").first().click();
+ checkConnectorCount();
}
@Test
public void testNoCaptionLeak() throws Exception {
setDebug(true);
openTestURL();
+
+ openLog();
+
+ clearLog();
+ $(ButtonElement.class).caption("Set non leaky content").first().click();
+ // this should be present
+ // 3 general non-connector elements, none accumulated on click
+ checkConnectorCount();
+ }
+
+ private void openLog() {
openDebugLogTab();
+ if (BrowserUtil.isIE8(getDesiredCapabilities())) {
+ openDebugLogTab();
+ }
+ }
+ private void clearLog() {
getDriver().findElement(By.xpath("//button[@title = 'Clear log']"))
.click();
- getDriver().findElement(By.id("Set non leaky content")).click();
+ }
- // this should be present
- // 3 general non-connector elements, none accumulated on click
+ private void checkConnectorCount() {
getDriver()
.findElement(
By.xpath("//span[text() = 'Measured 3 non connector elements']"));
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResize.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResize.java
new file mode 100644
index 0000000000..870c6cb8cb
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResize.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.richtextarea;
+
+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.RichTextArea;
+import com.vaadin.ui.VerticalLayout;
+
+public class RichTextAreaRelativeHeightResize extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final VerticalLayout layout = new VerticalLayout();
+ layout.setSizeFull();
+ layout.setHeight("300px");
+
+ RichTextArea richTextArea = new RichTextArea();
+ richTextArea.setSizeFull();
+ layout.addComponent(richTextArea);
+
+ addComponent(layout);
+ addComponent(new Button("Increase height", new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ layout.setHeight("400px");
+ }
+ }));
+
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Tests that a RichTextArea with dynamic height "
+ + "updates its editor elements height on resize";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 11320;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResizeTest.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResizeTest.java
new file mode 100644
index 0000000000..5c31ce4dc7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResizeTest.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.components.richtextarea;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class RichTextAreaRelativeHeightResizeTest extends MultiBrowserTest {
+
+ @Test
+ public void testCenteredClosingAndPostLayout() {
+ openTestURL();
+
+ int originalHeight = driver
+ .findElement(By.cssSelector(".v-richtextarea")).getSize()
+ .getHeight();
+ int originalEditorHeight = driver
+ .findElement(By.cssSelector(".v-richtextarea iframe"))
+ .getSize().getHeight();
+
+ // Increase the component height
+ driver.findElement(By.cssSelector(".v-button")).click();
+
+ int newHeight = driver.findElement(By.cssSelector(".v-richtextarea"))
+ .getSize().getHeight();
+ int newEditorHeight = driver
+ .findElement(By.cssSelector(".v-richtextarea iframe"))
+ .getSize().getHeight();
+
+ // Check that the component height changed and that the editor height
+ // changed equally as much
+ Assert.assertTrue("RichTextArea height didn't change",
+ newHeight != originalHeight);
+ Assert.assertEquals(
+ "Editor height change didn't match the Component height change",
+ newHeight - originalHeight, newEditorHeight
+ - originalEditorHeight);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/slider/SliderTooltip.html b/uitest/src/com/vaadin/tests/components/slider/SliderTooltip.html
deleted file mode 100644
index 6014f557e7..0000000000
--- a/uitest/src/com/vaadin/tests/components/slider/SliderTooltip.html
+++ /dev/null
@@ -1,72 +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>SliderTooltip</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">SliderTooltip</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.slider.SliderTest?debug&amp;restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentssliderSliderTest::PID_Smenu#item0</td>
- <td>24,2</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[0]/VMenuBar[0]#item1</td>
- <td>35,12</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[1]/VMenuBar[0]#item1</td>
- <td>74,3</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentssliderSliderTest::Root/VOverlay[2]/VMenuBar[0]#item2</td>
- <td>30,6</td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestscomponentssliderSliderTest::PID_StestComponent/domChild[2]/domChild[0]</td>
- <td>0,0</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runcomvaadintestscomponentssliderSliderTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentssliderSliderTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>This is a semi-long text that might wrap.</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentssliderSliderTest::/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>40,16</td>
-</tr>
-<tr>
- <td>pause</td>
- <td></td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertElementPositionLeft</td>
- <td>vaadin=runcomvaadintestscomponentssliderSliderTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
- <td>-5000</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelMoveComponent.java b/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelMoveComponent.java
new file mode 100644
index 0000000000..b788b568c2
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelMoveComponent.java
@@ -0,0 +1,64 @@
+/*
+ * 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.splitpanel;
+
+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.HorizontalSplitPanel;
+
+public class SplitPanelMoveComponent extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final HorizontalSplitPanel split = new HorizontalSplitPanel();
+ split.setHeight("200px");
+ final Button targetComponent = new Button(
+ "Button in splitpanel. Click to move to the other side");
+ split.setFirstComponent(targetComponent);
+
+ targetComponent.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (split.getFirstComponent() != null) {
+ split.setFirstComponent(null);
+ split.setSecondComponent(targetComponent);
+ } else {
+ split.setSecondComponent(null);
+ split.setFirstComponent(targetComponent);
+
+ }
+ }
+
+ });
+
+ addComponent(split);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Fail to swap components in HorizontalSplitPanel";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 11920;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelMoveComponentTest.java b/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelMoveComponentTest.java
new file mode 100644
index 0000000000..1bf5212185
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelMoveComponentTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.splitpanel;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class SplitPanelMoveComponentTest extends MultiBrowserTest {
+
+ private static final String BUTTON_TEXT = "Button in splitpanel. Click to move to the other side";
+
+ @Test
+ public void moveComponent() {
+ openTestURL();
+ Assert.assertEquals(BUTTON_TEXT, getFirstChild().getText());
+ getFirstChild().click();
+ Assert.assertEquals(BUTTON_TEXT, getSecondChild().getText());
+ getSecondChild().click();
+ Assert.assertEquals(BUTTON_TEXT, getFirstChild().getText());
+ }
+
+ private WebElement getFirstChild() {
+ WebElement container = getDriver()
+ .findElement(
+ By.xpath("//div[contains(@class,'v-splitpanel-first-container')]"));
+ return container.findElement(By
+ .xpath("//div[contains(@class, 'v-button')]"));
+ }
+
+ private WebElement getSecondChild() {
+ WebElement container = getDriver()
+ .findElement(
+ By.xpath("//div[contains(@class,'v-splitpanel-second-container')]"));
+ return container.findElement(By
+ .xpath("//div[contains(@class, 'v-button')]"));
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/SelectAllConstantViewport.java b/uitest/src/com/vaadin/tests/components/table/SelectAllConstantViewport.java
new file mode 100644
index 0000000000..5a406eac48
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/SelectAllConstantViewport.java
@@ -0,0 +1,98 @@
+/*
+ * 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.Property.ValueChangeListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Table;
+
+/**
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class SelectAllConstantViewport extends AbstractTestUIWithLog {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+
+ final Table table = new Table();
+ table.addContainerProperty("", Integer.class, null);
+ table.setSizeFull();
+ table.setMultiSelect(true);
+ table.setNullSelectionAllowed(true);
+ table.setSelectable(true);
+
+ CheckBox selectAllCheckbox = new CheckBox("Select All");
+ selectAllCheckbox.addValueChangeListener(new ValueChangeListener() {
+ @Override
+ public void valueChange(
+ com.vaadin.data.Property.ValueChangeEvent event) {
+ Object checked = event.getProperty().getValue();
+ if (checked instanceof Boolean) {
+ if (((Boolean) checked).booleanValue()) {
+ table.setValue(table.getItemIds());
+ } else {
+ table.setValue(null);
+ }
+ }
+ }
+ });
+
+ for (int i = 0; i < 200; i++) {
+ table.addItem(new Object[] { new Integer(i) }, new Integer(i));
+ }
+
+ table.setCurrentPageFirstItemIndex(185);
+
+ final CssLayout layout = new CssLayout();
+ layout.addComponent(selectAllCheckbox);
+ layout.addComponent(table);
+ layout.setSizeFull();
+ addComponent(layout);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+
+ return "The scroll position of a table with many items should remain constant if all items are selected.";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 13341;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/SelectAllConstantViewportTest.java b/uitest/src/com/vaadin/tests/components/table/SelectAllConstantViewportTest.java
new file mode 100644
index 0000000000..0e7a7c08a4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/SelectAllConstantViewportTest.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.table;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.CheckBoxElement;
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class SelectAllConstantViewportTest extends MultiBrowserTest {
+
+ @Test
+ public void testViewportUnchanged() throws IOException {
+ openTestURL();
+
+ CheckBoxElement checkbox = $(CheckBoxElement.class).first();
+
+ WebElement row = $(TableElement.class).first().getCell(190, 0);
+ final WebElement scrollPositionDisplay = getDriver().findElement(
+ By.className("v-table-scrollposition"));
+ waitUntilNot(new ExpectedCondition<Boolean>() {
+
+ @Override
+ public Boolean apply(WebDriver input) {
+ return scrollPositionDisplay.isDisplayed();
+ }
+ }, 10);
+
+ int rowLocation = row.getLocation().getY();
+
+ // use click x,y with non-zero offset to actually toggle the checkbox. (#13763)
+ checkbox.click(5, 5);
+ int newRowLocation = row.getLocation().getY();
+
+ assertThat(newRowLocation, is(rowLocation));
+
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfigurationTest.java b/uitest/src/com/vaadin/tests/components/ui/TooltipConfigurationTest.java
deleted file mode 100644
index f3e7554579..0000000000
--- a/uitest/src/com/vaadin/tests/components/ui/TooltipConfigurationTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.tests.components.ui;
-
-import java.util.NoSuchElementException;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.openqa.selenium.Keys;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.interactions.Actions;
-
-import com.vaadin.testbench.By;
-import com.vaadin.tests.tb3.MultiBrowserTest;
-
-public class TooltipConfigurationTest extends MultiBrowserTest {
-
- private org.openqa.selenium.By tooltipBy = By
- .vaadin("Root/VTooltip[0]/FlowPanel[0]/domChild[1]");
-
- @Test
- public void testTooltipConfiguration() throws Exception {
- openTestURL();
-
- WebElement uiRoot = getDriver().findElement(By.vaadin("Root"));
- WebElement closeTimeout = vaadinElementById("Close timeout");
- WebElement shortTooltip = vaadinElementById("shortTooltip");
- WebElement longTooltip = vaadinElementById("longTooltip");
- WebElement maxWidth = vaadinElementById("Max width");
-
- selectAndType(closeTimeout, "0");
- testBenchElement(shortTooltip).showTooltip();
- waitForElementToBePresent(tooltipBy);
- Assert.assertEquals("This is a short tooltip", getTooltip().getText());
-
- new Actions(getDriver()).moveToElement(uiRoot, 0, 0).click().perform();
- // uiRoot.click();
- checkTooltipNotPresent();
-
- selectAndType(closeTimeout, "3000");
- moveMouseToTopLeft(uiRoot);
- testBenchElement(shortTooltip).showTooltip();
- waitForElementToBePresent(tooltipBy);
- WebElement tooltip2 = getTooltip();
- Assert.assertEquals("This is a short tooltip", tooltip2.getText());
-
- uiRoot.click();
- // assert that tooltip is present
- getTooltip();
- selectAndType(closeTimeout, "0");
- testBenchElement(longTooltip).showTooltip();
- waitForElementToBePresent(tooltipBy);
- Assert.assertEquals(500, getTooltip().getSize().getWidth());
-
- uiRoot.click();
- selectAndType(maxWidth, "100");
- moveMouseToTopLeft(uiRoot);
- testBenchElement(longTooltip).showTooltip();
- Assert.assertEquals(100, getTooltip().getSize().getWidth());
- }
-
- private WebElement getTooltip() {
- return getDriver().findElement(tooltipBy);
- }
-
- private void checkTooltipNotPresent() {
- try {
- WebElement tooltip = getTooltip();
- if (!"".equals(tooltip.getText())
- || tooltip.getLocation().getX() > -999) {
- Assert.fail("Found tooltip that shouldn't be visible: "
- + tooltip.getText() + " at " + tooltip.getLocation());
- }
- } catch (NoSuchElementException e) {
- Assert.fail("Tooltip element was removed completely, causing extra events to accessibility tools");
- }
- }
-
- private void selectAndType(WebElement element, String value) {
- // select and replace text
- element.clear();
- // if null representation not set as "", need to move cursor to end and
- // remove text "null"
- // element.sendKeys("" + Keys.BACK_SPACE + Keys.BACK_SPACE
- // + Keys.BACK_SPACE + Keys.BACK_SPACE);
- element.sendKeys(value + Keys.ENTER);
- }
-
- private void moveMouseToTopLeft(WebElement element) {
- new Actions(getDriver()).moveToElement(element, 0, 0).perform();
- }
-
-} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/upload/TestFileUploadTest.java b/uitest/src/com/vaadin/tests/components/upload/TestFileUploadTest.java
new file mode 100644
index 0000000000..1887427a72
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/upload/TestFileUploadTest.java
@@ -0,0 +1,128 @@
+/*
+ * 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.upload;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.internal.WrapsElement;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.LocalFileDetector;
+import org.openqa.selenium.remote.RemoteWebElement;
+
+import com.vaadin.testbench.elements.UploadElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TestFileUploadTest extends MultiBrowserTest {
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ // PhantomJS fails to upload files for unknown reasons
+ List<DesiredCapabilities> b = super.getBrowsersToTest();
+ b.remove(Browser.PHANTOMJS.getDesiredCapabilities());
+ return b;
+ }
+
+ @Test
+ public void testUploadAnyFile() throws Exception {
+ openTestURL();
+
+ File tempFile = createTempFile();
+ fillPathToUploadInput(tempFile.getPath());
+
+ getSubmitButton().click();
+
+ String expected = String.format(
+ "1. Upload finished. Name: %s, Size: %s, md5: %s",
+ tempFile.getName(), getTempFileContents().length(),
+ md5(getTempFileContents()));
+
+ String actual = getLogRow(0);
+ Assert.assertEquals("Upload log row does not match expected", expected,
+ actual);
+ }
+
+ private String md5(String string) throws NoSuchAlgorithmException {
+ byte[] digest = MessageDigest.getInstance("MD5").digest(
+ string.getBytes());
+ BigInteger bigInt = new BigInteger(1, digest);
+ String hashtext = bigInt.toString(16);
+ return hashtext;
+ }
+
+ /**
+ * @return The generated temp file handle
+ * @throws IOException
+ */
+ private File createTempFile() throws IOException {
+ File tempFile = File.createTempFile("TestFileUpload", ".txt");
+ BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile));
+ writer.write(getTempFileContents());
+ writer.close();
+ tempFile.deleteOnExit();
+ return tempFile;
+ }
+
+ private String getTempFileContents() {
+ return "This is a test file!\nRow 2\nRow3";
+ }
+
+ private void fillPathToUploadInput(String tempFileName) throws Exception {
+ // create a valid path in upload input element. Instead of selecting a
+ // file by some file browsing dialog, we use the local path directly.
+ WebElement input = getInput();
+ setLocalFileDetector(input);
+ input.sendKeys(tempFileName);
+ }
+
+ private WebElement getSubmitButton() {
+ UploadElement upload = $(UploadElement.class).first();
+ WebElement submitButton = upload.findElement(By.className("v-button"));
+ return submitButton;
+ }
+
+ private WebElement getInput() {
+ return getDriver().findElement(By.className("gwt-FileUpload"));
+ }
+
+ private void setLocalFileDetector(WebElement element) throws Exception {
+ if (getClass().isAnnotationPresent(RunLocally.class)) {
+ return;
+ }
+
+ if (element instanceof WrapsElement) {
+ element = ((WrapsElement) element).getWrappedElement();
+ }
+ if (element instanceof RemoteWebElement) {
+ ((RemoteWebElement) element)
+ .setFileDetector(new LocalFileDetector());
+ } else {
+ throw new IllegalArgumentException(
+ "Expected argument of type RemoteWebElement, received "
+ + element.getClass().getName());
+ }
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/fieldgroup/IntegerRangeValidator.html b/uitest/src/com/vaadin/tests/fieldgroup/IntegerRangeValidator.html
deleted file mode 100644
index 48d48ede80..0000000000
--- a/uitest/src/com/vaadin/tests/fieldgroup/IntegerRangeValidator.html
+++ /dev/null
@@ -1,95 +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>IntegerRangeValidator</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">IntegerRangeValidator</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.fieldgroup.BasicPersonForm?restartApplication</td>
- <td></td>
-</tr>
-<!--64123 -> age-->
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]</td>
- <td>64,20</td>
-</tr>
-<tr>
- <td>enterCharacter</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]</td>
- <td>64123</td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::Root/VTooltip[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::Root/VTooltip[0]/FlowPanel[0]/VErrorMessage[0]/HTML[0]</td>
- <td>Must be between 0 and 150, 64123 is not</td>
-</tr>
-<tr>
- <td>assertCSSClass</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/VVerticalLayout[0]/domChild[5]/domChild[0]/domChild[1]</td>
- <td>v-errorindicator</td>
-</tr>
-<!--Hide tooltip-->
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/VVerticalLayout[0]</td>
- <td></td>
-</tr>
-<!--10 -> age-->
-<tr>
- <td>enterCharacter</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]</td>
- <td>10</td>
-</tr>
-<tr>
- <td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/VVerticalLayout[0]/domChild[5]/domChild[0]/domChild[1]</td>
- <td>v-errorindicator</td>
-</tr>
-<!---1-->
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]</td>
- <td>69,11</td>
-</tr>
-<tr>
- <td>enterCharacter</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VTextField[0]</td>
- <td>-1</td>
-</tr>
-<tr>
- <td>assertCSSClass</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/VVerticalLayout[0]/domChild[5]/domChild[0]/domChild[1]</td>
- <td>v-errorindicator</td>
-</tr>
-<tr>
- <td>showTooltip</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VTextField[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestsfieldgroupBasicPersonForm::Root/VTooltip[0]/FlowPanel[0]/VErrorMessage[0]/HTML[0]</td>
- <td>Must be between 0 and 150, -1 is not</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.html b/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.html
deleted file mode 100644
index 77a17263f8..0000000000
--- a/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.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>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.layouts.GridLayoutMoveComponent?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>all-left</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestslayoutsGridLayoutMoveComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>label-right</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestslayoutsGridLayoutMoveComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>label-button-right</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestslayoutsGridLayoutMoveComponent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>label-button-textfield-right</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.html b/uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.html
deleted file mode 100644
index f01a1a7026..0000000000
--- a/uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.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="" />
-<title>GridLayoutWidthChange</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">GridLayoutWidthChange</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.layouts.GridLayoutWidthChange</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestslayoutsGridLayoutWidthChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</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/layouts/GridLayoutMoveComponent.java b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponent.java
index efd1277653..cd86fbcf3c 100644
--- a/uitest/src/com/vaadin/tests/layouts/GridLayoutMoveComponent.java
+++ b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponent.java
@@ -1,5 +1,7 @@
-package com.vaadin.tests.layouts;
+package com.vaadin.tests.layouts.gridlayout;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -7,10 +9,10 @@ import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextField;
-public class GridLayoutMoveComponent extends TestBase {
+public class GridLayoutMoveComponent extends AbstractTestUI {
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
final GridLayout grid = new GridLayout(2, 3);
grid.setCaption("Fixed size grid");
grid.setWidth("300px");
@@ -51,13 +53,14 @@ public class GridLayoutMoveComponent extends TestBase {
@Override
public void buttonClick(ClickEvent event) {
grid.removeComponent(tf);
+ grid.addComponent(new Label("I'm on left"), 0, 2);
grid.addComponent(tf, 1, 2);
}
}));
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "Click the buttons below the GridLayout to move the components to the right. Should definitely work no matter what.";
}
diff --git a/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponentTest.java b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponentTest.java
new file mode 100644
index 0000000000..0fab64989a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponentTest.java
@@ -0,0 +1,31 @@
+package com.vaadin.tests.layouts.gridlayout;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.junit.Test;
+
+import java.io.IOException;
+
+public class GridLayoutMoveComponentTest extends MultiBrowserTest {
+
+ @Test
+ public void componentsShouldMoveRight() throws IOException {
+ openTestURL();
+
+ compareScreen("all-left");
+
+ clickButtonWithCaption("Shift label right");
+ compareScreen("label-right");
+
+ clickButtonWithCaption("Shift button right");
+ compareScreen("label-button-right");
+
+ clickButtonWithCaption("Shift text field right");
+ compareScreen("label-button-textfield-right");
+ }
+
+ private void clickButtonWithCaption(String caption) {
+ $(ButtonElement.class).caption(caption).first().click();
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.java b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutWidthChange.java
index c0e6b27c7d..96091bdab5 100644
--- a/uitest/src/com/vaadin/tests/layouts/GridLayoutWidthChange.java
+++ b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutWidthChange.java
@@ -1,5 +1,7 @@
-package com.vaadin.tests.layouts;
+package com.vaadin.tests.layouts.gridlayout;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -9,7 +11,7 @@ import com.vaadin.ui.NativeButton;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
-public class GridLayoutWidthChange extends TestBase {
+public class GridLayoutWidthChange extends AbstractTestUI {
private GridLayout generateLayout() {
VerticalLayout fields1 = new VerticalLayout();
@@ -34,7 +36,7 @@ public class GridLayoutWidthChange extends TestBase {
}
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
final GridLayout layout1 = generateLayout();
final CustomComponent cc = new CustomComponent(layout1);
cc.setWidth("500px");
@@ -45,7 +47,7 @@ public class GridLayoutWidthChange extends TestBase {
@Override
public void buttonClick(ClickEvent event) {
- cc.setWidth((cc.getWidth() - 10) + "px");
+ cc.setWidth((cc.getWidth() - 100) + "px");
}
});
@@ -53,7 +55,7 @@ public class GridLayoutWidthChange extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "A 100% wide GridLayout is wrapped inside a CustomComponent. When the width of the CustomComponent is reduced, the size of the GridLayout should be reduced accordingly. The Buttons should stay in place vertically and just move closer to each other horizontally.";
}
diff --git a/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutWidthChangeTest.java b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutWidthChangeTest.java
new file mode 100644
index 0000000000..52ea5f4f8e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/gridlayout/GridLayoutWidthChangeTest.java
@@ -0,0 +1,24 @@
+package com.vaadin.tests.layouts.gridlayout;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.AbstractTB3Test;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.*;
+
+public class GridLayoutWidthChangeTest extends MultiBrowserTest {
+
+ @Test
+ public void layoutIsReduced() throws IOException {
+ openTestURL();
+
+ compareScreen("initial");
+
+ $(ButtonElement.class).caption("Reduce GridLayout parent width").first().click();
+
+ compareScreen("buttonMoved");
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index 8783a4dc42..406f1fe27c 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -791,7 +791,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
*/
public static DesiredCapabilities phantomJS(int version) {
DesiredCapabilities c = DesiredCapabilities.phantomjs();
- c.setPlatform(Platform.XP);
+ c.setPlatform(Platform.LINUX);
c.setVersion("" + version);
return c;
}
diff --git a/uitest/src/com/vaadin/tests/tb3/TooltipTest.java b/uitest/src/com/vaadin/tests/tb3/TooltipTest.java
index 86ac8c1f12..86ea44287a 100644
--- a/uitest/src/com/vaadin/tests/tb3/TooltipTest.java
+++ b/uitest/src/com/vaadin/tests/tb3/TooltipTest.java
@@ -16,11 +16,13 @@
package com.vaadin.tests.tb3;
+import java.util.List;
import java.util.NoSuchElementException;
import org.junit.Assert;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.testbench.By;
@@ -58,10 +60,20 @@ public abstract class TooltipTest extends MultiBrowserTest {
}
protected void checkTooltip(String value) throws Exception {
+ WebElement body = findElement(By.cssSelector("body"));
WebElement tooltip = getTooltip();
Assert.assertEquals(value, tooltip.getText());
- Assert.assertTrue("Tooltip should be in viewport", tooltip
+ Assert.assertTrue("Tooltip overflowed to the left", tooltip
.getLocation().getX() >= 0);
+ Assert.assertTrue("Tooltip overflowed up",
+ tooltip.getLocation().getY() >= 0);
+ Assert.assertTrue("Tooltip overflowed to the right", tooltip
+ .getLocation().getX() + tooltip.getSize().getWidth() < body
+ .getSize().getWidth());
+ Assert.assertTrue("Tooltip overflowed down", tooltip.getLocation()
+ .getY() + tooltip.getSize().getHeight() < body.getSize()
+ .getHeight());
+
}
protected void moveToRoot() {
@@ -88,7 +100,18 @@ public abstract class TooltipTest extends MultiBrowserTest {
}
protected void moveMouseToTopLeft(WebElement element) {
- new Actions(getDriver()).moveToElement(element, 0, 0).perform();
+ moveMouseTo(element, 0, 0);
+ }
+
+ protected void moveMouseTo(WebElement element, int offsetX, int offsetY) {
+ new Actions(getDriver()).moveToElement(element, offsetX, offsetY)
+ .perform();
}
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ // TODO Once we figure out how to get mouse hovering work with the IE
+ // webdriver, exclude them from these tests (#13854)
+ return getBrowsersExcludingIE();
+ }
}
diff --git a/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltips.java b/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltips.java
new file mode 100644
index 0000000000..60167e43b4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltips.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.tooltip;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.TooltipConfiguration;
+
+/**
+ * When moving between adjacent elements, the tooltip replace should obey
+ * quickOpenDelay
+ *
+ * @author Vaadin Ltd
+ */
+public class AdjacentElementsWithTooltips extends AbstractTestUI {
+
+ private int buttonCount = 0;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+ TooltipConfiguration ttc = super.getTooltipConfiguration();
+ ttc.setMaxWidth(350);
+ ttc.setOpenDelay(200);
+ ttc.setCloseTimeout(200);
+ ttc.setQuickOpenDelay(1000);
+ ttc.setQuickOpenTimeout(1000);
+ HorizontalLayout layout = new HorizontalLayout();
+ layout.addComponent(makeButton("first"));
+ layout.addComponent(makeButton("second"));
+ addComponent(layout);
+
+ }
+
+ private Component makeButton(String tooltip) {
+ Button button = new Button("Button " + buttonCount++);
+ button.setDescription(tooltip);
+ return button;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "Moving between adjacent elements with tooltips should open quickOpenDelay";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 13998;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java b/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.java
new file mode 100644
index 0000000000..b9fc788008
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/AdjacentElementsWithTooltipsTest.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.tooltip;
+
+import static org.hamcrest.Matchers.greaterThan;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.lessThan;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.junit.Test;
+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 org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Test to see if tooltips obey quickOpenDelay when moving between directly
+ * adjacent elements.
+ *
+ * @author Vaadin Ltd
+ */
+public class AdjacentElementsWithTooltipsTest extends MultiBrowserTest {
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ return getBrowsersExcludingIE();
+ }
+
+ @Test
+ public void tooltipsHaveQuickOpenDelay() throws InterruptedException {
+ openTestURL();
+ Coordinates button0Coordinates = getButtonCoordinates("Button 0");
+ Coordinates button1Coordinates = getButtonCoordinates("Button 1");
+
+ Mouse mouse = getMouse();
+ mouse.mouseMove(button0Coordinates, 10, 10);
+ sleep(1000);
+ assertThat(getTooltipElement().getLocation().x, is(greaterThan(0)));
+
+ mouse.mouseMove(button1Coordinates, 10, 10);
+ assertThat(getTooltipElement().getLocation().x, is(lessThan(-1000)));
+
+ sleep(1000);
+ assertThat(getTooltipElement().getLocation().x,
+ is(greaterThan(button1Coordinates.onPage().x)));
+ }
+
+ private Coordinates getButtonCoordinates(String caption) {
+ return getCoordinates(getButton(caption));
+ }
+
+ private ButtonElement getButton(String caption) {
+ return $(ButtonElement.class)
+ .caption(caption).first();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonTooltips.java b/uitest/src/com/vaadin/tests/tooltip/ButtonTooltips.java
index fa639918aa..d212a13058 100644
--- a/uitest/src/com/vaadin/tests/components/button/ButtonTooltips.java
+++ b/uitest/src/com/vaadin/tests/tooltip/ButtonTooltips.java
@@ -1,4 +1,4 @@
-package com.vaadin.tests.components.button;
+package com.vaadin.tests.tooltip;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Alignment;
@@ -24,14 +24,8 @@ public class ButtonTooltips extends TestBase {
button.setDescription("long descidescidescpription");
Button button2 = new Button("Two");
button2.setDescription("Another");
- Button button3 = new Button("One");
- button3.setDescription("long descidescidescpription");
- Button button4 = new Button("Two");
- button4.setDescription("Another");
vl.addComponent(button);
vl.addComponent(button2);
- vl.addComponent(button3);
- vl.addComponent(button4);
vl.setComponentAlignment(button, Alignment.TOP_RIGHT);
vl.setComponentAlignment(button2, Alignment.TOP_RIGHT);
addComponent(vl);
diff --git a/uitest/src/com/vaadin/tests/tooltip/ButtonTooltipsTest.java b/uitest/src/com/vaadin/tests/tooltip/ButtonTooltipsTest.java
new file mode 100644
index 0000000000..d64dd900a7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/ButtonTooltipsTest.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.tooltip;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.ButtonElement;
+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 {
+
+ @Test
+ public void tooltipSizeWhenMovingBetweenElements() throws Exception {
+ openTestURL();
+
+ WebElement buttonOne = $(ButtonElement.class).caption("One").first();
+ WebElement buttonTwo = $(ButtonElement.class).caption("Two").first();
+
+ checkTooltip(buttonOne, "long descidescidescpription");
+ int originalWidth = getTooltipElement().getSize().getWidth();
+ int originalHeight = getTooltipElement().getSize().getHeight();
+
+ clearTooltip();
+ checkTooltip(buttonTwo, "Another");
+ moveMouseTo(buttonOne, 5, 5);
+ sleep(100);
+ assertThat(getTooltipElement().getSize().getWidth(), is(originalWidth));
+ assertThat(getTooltipElement().getSize().getHeight(),
+ is(originalHeight));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.java b/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltips.java
index f0010acce8..606a773141 100644
--- a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperTooltips.java
+++ b/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltips.java
@@ -1,4 +1,4 @@
-package com.vaadin.tests.components.draganddropwrapper;
+package com.vaadin.tests.tooltip;
import java.util.Iterator;
@@ -10,7 +10,8 @@ import com.vaadin.event.dd.DropTarget;
import com.vaadin.event.dd.TargetDetails;
import com.vaadin.event.dd.acceptcriteria.AcceptAll;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.util.TestUtils;
import com.vaadin.ui.Component;
import com.vaadin.ui.CssLayout;
@@ -18,7 +19,7 @@ import com.vaadin.ui.DragAndDropWrapper;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
-public class DragAndDropWrapperTooltips extends TestBase {
+public class DragAndDropWrapperTooltips extends AbstractTestUI {
private final String BASE = ".v-widget.greenblock {vertical-align: middle; float:left; width:60px;height:60px;background: green !important; padding:0; margin:2px;-webkit-transition: width 0.3s ease-in-out;color: white;}";
private final String B2 = ".v-widget.b2 {background-color: red !important;}";
@@ -28,9 +29,8 @@ public class DragAndDropWrapperTooltips extends TestBase {
private DragAndDropWrapper dragAndDropWrapper;
@Override
- protected void setup() {
- TestUtils.injectCSS(getMainWindow(), BASE + B4 + B2 + B3
- + HIDEDRAGSOURCE);
+ protected void setup(VaadinRequest request) {
+ TestUtils.injectCSS(this, BASE + B4 + B2 + B3 + HIDEDRAGSOURCE);
VerticalLayout l = new VerticalLayout();
l.setWidth("400px");
@@ -49,7 +49,7 @@ public class DragAndDropWrapperTooltips extends TestBase {
wl.addStyleName("b" + i);
cssLayout.addComponent(wl);
}
-
+ getTooltipConfiguration().setOpenDelay(300);
}
int count;
@@ -123,7 +123,7 @@ public class DragAndDropWrapperTooltips extends TestBase {
};
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "A tooltip should be shown when hovering the DragAndDropWrapper containing all the draggable layouts";
}
diff --git a/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltipsTest.java b/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltipsTest.java
new file mode 100644
index 0000000000..d913c8cc12
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/DragAndDropWrapperTooltipsTest.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.tooltip;
+
+import org.junit.Test;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.tests.tb3.TooltipTest;
+
+/**
+ *
+ *
+ * @author Vaadin Ltd
+ */
+public class DragAndDropWrapperTooltipsTest extends TooltipTest {
+ @Test
+ public void testDragAndDropTooltips() throws Exception {
+ openTestURL();
+ LabelElement element = $(LabelElement.class).get(4);
+ LabelElement targetElement = $(LabelElement.class).get(1);
+ checkTooltip(element,
+ "Tooltip for the wrapper wrapping all the draggable layouts");
+ new Actions(getDriver()).clickAndHold(element)
+ .moveToElement(targetElement).perform();
+ sleep(500);
+ checkTooltipNotPresent();
+ new Actions(getDriver()).release().perform();
+ checkTooltip(element, "Drag was performed and tooltip was changed");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/LongTooltip.java b/uitest/src/com/vaadin/tests/tooltip/LongTooltip.java
index acb498bcee..0eee9d4976 100644
--- a/uitest/src/com/vaadin/tests/components/LongTooltip.java
+++ b/uitest/src/com/vaadin/tests/tooltip/LongTooltip.java
@@ -1,11 +1,13 @@
-package com.vaadin.tests.components;
+package com.vaadin.tests.tooltip;
+import com.vaadin.tests.components.TestBase;
import com.vaadin.tests.util.LoremIpsum;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.TextField;
public class LongTooltip extends TestBase {
+ private int tooltipCount = 0;
@Override
public void setup() {
@@ -33,7 +35,8 @@ public class LongTooltip extends TestBase {
private TextField createField() {
final TextField field = new TextField();
- field.setDescription(LoremIpsum.get(1000));
+ field.setDescription("Tooltip " + Integer.toString(tooltipCount++)
+ + ": " + LoremIpsum.get(1000));
return field;
}
diff --git a/uitest/src/com/vaadin/tests/tooltip/LongTooltipTest.java b/uitest/src/com/vaadin/tests/tooltip/LongTooltipTest.java
new file mode 100644
index 0000000000..191ce6ffec
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/LongTooltipTest.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.tooltip;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.TooltipTest;
+import com.vaadin.tests.util.LoremIpsum;
+
+/**
+ * Test to see if long tooltips behave appropriately
+ *
+ * @author Vaadin Ltd
+ */
+public class LongTooltipTest extends TooltipTest {
+
+ @Test
+ public void tooltipsDontOverflow() throws Exception {
+ openTestURL();
+ List<TextFieldElement> elements = $(TextFieldElement.class).all();
+ checkTooltipNotPresent();
+ int i = 0;
+ for (TextFieldElement element : elements) {
+ checkTooltip(element, "Tooltip " + Integer.toString(i++) + ": "
+ + LoremIpsum.get(1000));
+ clearTooltip();
+ checkTooltipNotPresent();
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/tooltip/SliderTooltip.java b/uitest/src/com/vaadin/tests/tooltip/SliderTooltip.java
new file mode 100644
index 0000000000..8cf7232fab
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/SliderTooltip.java
@@ -0,0 +1,42 @@
+package com.vaadin.tests.tooltip;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Slider;
+
+public class SliderTooltip extends AbstractTestUI {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+ Slider slider = new Slider();
+ slider.setDescription("Tooltip");
+ addComponent(slider);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+ */
+ @Override
+ protected String getTestDescription() {
+ return "Testing that sliders have tooltips.";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+ */
+ @Override
+ protected Integer getTicketNumber() {
+ return 14019;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/tooltip/SliderTooltipTest.java b/uitest/src/com/vaadin/tests/tooltip/SliderTooltipTest.java
new file mode 100644
index 0000000000..743b7c2ab5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/SliderTooltipTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.elements.SliderElement;
+import com.vaadin.tests.tb3.TooltipTest;
+
+/**
+ * Test that sliders can have tooltips
+ *
+ * @author Vaadin Ltd
+ */
+public class SliderTooltipTest extends TooltipTest {
+
+ @Test
+ public void sliderHasTooltip() throws Exception {
+ openTestURL();
+ WebElement slider = $(SliderElement.class).first();
+ checkTooltipNotPresent();
+ checkTooltip(slider, "Tooltip");
+ clearTooltip();
+ checkTooltipNotPresent();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java b/uitest/src/com/vaadin/tests/tooltip/TooltipConfiguration.java
index eeea91b638..f67db4219f 100644
--- a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java
+++ b/uitest/src/com/vaadin/tests/tooltip/TooltipConfiguration.java
@@ -1,4 +1,4 @@
-package com.vaadin.tests.components.ui;
+package com.vaadin.tests.tooltip;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
diff --git a/uitest/src/com/vaadin/tests/tooltip/TooltipConfigurationTest.java b/uitest/src/com/vaadin/tests/tooltip/TooltipConfigurationTest.java
new file mode 100644
index 0000000000..8f84444400
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/TooltipConfigurationTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.tooltip;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.TooltipTest;
+
+public class TooltipConfigurationTest extends TooltipTest {
+
+ @Test
+ public void testTooltipConfiguration() throws Exception {
+ openTestURL();
+
+ WebElement uiRoot = getDriver().findElement(By.vaadin("Root"));
+ WebElement closeTimeout = vaadinElementById("Close timeout");
+ WebElement shortTooltip = vaadinElementById("shortTooltip");
+ WebElement longTooltip = vaadinElementById("longTooltip");
+ WebElement maxWidth = vaadinElementById("Max width");
+
+ selectAndType(closeTimeout, "0");
+
+ checkTooltip(shortTooltip, "This is a short tooltip");
+
+ moveToRoot();
+
+ checkTooltipNotPresent();
+
+ selectAndType(closeTimeout, "3000");
+ checkTooltip(shortTooltip, "This is a short tooltip");
+
+ moveToRoot();
+
+ // The tooltip should still be there despite being "cleared", as the
+ // timeout hasn't expired yet.
+ checkTooltip("This is a short tooltip");
+
+ // assert that tooltip is present
+ selectAndType(closeTimeout, "0");
+ selectAndType(maxWidth, "100");
+
+ testBenchElement(longTooltip).showTooltip();
+ assertThat(getDriver().findElement(By.className("popupContent"))
+ .getSize().getWidth(), is(100));
+ }
+
+ private void selectAndType(WebElement element, String value) {
+ // select and replace text
+ element.clear();
+ // if null representation not set as "", need to move cursor to end and
+ // remove text "null"
+ element.sendKeys(value + Keys.ENTER);
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltip.java b/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltip.java
new file mode 100644
index 0000000000..20dc514c10
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltip.java
@@ -0,0 +1,62 @@
+/*
+ * 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 com.vaadin.data.validator.IntegerRangeValidator;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.TextField;
+
+/**
+ *
+ * UI test class for Tooltip with integer range validator.
+ */
+public class ValidatorCaptionTooltip extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ TextField fieldWithError = new TextField();
+ int min = 0;
+ int max = 100;
+ String errorMessage = "Valid value is between " + min + " and " + max
+ + ". {0} is not.";
+ IntegerRangeValidator validator = new IntegerRangeValidator(
+ errorMessage, min, max);
+ fieldWithError.setValue("142");
+
+ fieldWithError.addValidator(validator);
+ fieldWithError.setConverter(Integer.class);
+ fieldWithError.setImmediate(true);
+
+ TextField fieldWithoutError = new TextField();
+ fieldWithoutError.addValidator(validator);
+ fieldWithoutError.setConverter(Integer.class);
+ fieldWithoutError.setValue("42");
+ addComponent(fieldWithError);
+ addComponent(fieldWithoutError);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Valid value is from 0 to 100.When the value is not valid. An error tooltip should appear";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14046;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltipTest.java b/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltipTest.java
new file mode 100644
index 0000000000..9603b1df36
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/ValidatorCaptionTooltipTest.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.tooltip;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.TooltipTest;
+
+/**
+ * Test to see if validators create error tooltips correctly.
+ *
+ * @author Vaadin Ltd
+ */
+public class ValidatorCaptionTooltipTest extends TooltipTest {
+ @Test
+ public void validatorWithError() throws Exception {
+ openTestURL();
+
+ TextFieldElement field = $(TextFieldElement.class).get(0);
+ String fieldValue = field.getAttribute("value");
+ String expected = "Valid value is between 0 and 100. " + fieldValue
+ + " is not.";
+ checkTooltip(field, expected);
+ }
+
+ @Test
+ public void validatorWithoutError() throws Exception {
+ openTestURL();
+ TextFieldElement field = $(TextFieldElement.class).get(1);
+ checkTooltip(field, null);
+ }
+}