summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2014-08-19 09:40:20 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2014-08-19 09:42:27 +0300
commitc1a873bc9e47b98c58b298aa6935ab0853e6963f (patch)
tree3e8b209c54961473161335159bc98f9316d28a09 /uitest
parent2caaea2df9d558f0ce67daa3b0641cb832538506 (diff)
parent4dcace7123b605115efcbb395a320d460eed9c0e (diff)
downloadvaadin-framework-c1a873bc9e47b98c58b298aa6935ab0853e6963f.tar.gz
vaadin-framework-c1a873bc9e47b98c58b298aa6935ab0853e6963f.zip
Merge remote-tracking branch 'origin/master' into grid
Change-Id: Iac6947bc82bfbbb6856a924e7d538d195cfb405e
Diffstat (limited to 'uitest')
-rw-r--r--uitest/build.xml135
-rw-r--r--uitest/ivy.xml8
-rw-r--r--uitest/src/com/vaadin/tests/applicationservlet/UIProviderInitParameter.html39
-rw-r--r--uitest/src/com/vaadin/tests/applicationservlet/UIProviderInitParameterTest.java58
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupClose.java29
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupCloseTest.java65
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java5
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html136
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java13
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRangeTest.java510
-rw-r--r--uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java31
-rw-r--r--uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModesTest.java1
-rw-r--r--uitest/src/com/vaadin/tests/components/table/SortLabelsInTable.java13
-rw-r--r--uitest/src/com/vaadin/tests/components/table/SortLabelsInTableTest.java93
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.html52
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java20
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottomTest.java73
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.html63
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.java32
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidthTest.java45
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.html241
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java32
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationTest.java188
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScroll.java67
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScrollTest.java54
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0.html56
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0.java11
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0Test.java86
-rw-r--r--uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAria.html136
-rw-r--r--uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAriaTest.java128
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html32
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java113
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSizeTest.java38
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java116
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java8
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java55
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java16
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/CommonParts.java8
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/DateFields.java62
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Forms.java5
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Labels.java13
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/MenuBars.java71
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Sliders.java26
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/TextFields.java20
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java14
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java239
47 files changed, 2322 insertions, 936 deletions
diff --git a/uitest/build.xml b/uitest/build.xml
index 84f44a2d72..e81983f1f5 100644
--- a/uitest/build.xml
+++ b/uitest/build.xml
@@ -11,6 +11,7 @@
<property name="module.name" value="vaadin-uitest" />
<property name="uitest.dir" location="${vaadin.basedir}/uitest" />
<property name="result.dir" value="result" />
+ <property name="theme.result.dir" value="${result.dir}/VAADIN/themes" />
<property name="result.war" location="${result.dir}/lib/${module.name}-${vaadin.version}.war" />
<path id="classpath.compile.custom">
@@ -91,7 +92,7 @@
</target>
- <target name="war" depends="dependencies, compile, testing-widgetset">
+ <target name="war" depends="dependencies, compile, compile-test-themes, testing-widgetset">
<property name="result.dir" location="result" />
<property name="classes" location="${result.dir}/classes" />
<property name="WebContent.dir" location="${vaadin.basedir}/WebContent" />
@@ -121,10 +122,13 @@
<fileset refid="common.files.for.all.jars" />
<fileset dir="${result.dir}">
<include name="VAADIN/widgetsets/**/*" />
+ <include name="VAADIN/themes/tests-valo*/**" />
</fileset>
<fileset dir="${WebContent.dir}">
<include name="statictestfiles/**" />
<include name="VAADIN/themes/tests-*/**" />
+ <!-- Scss themes compiled and included above -->
+ <exclude name="VAADIN/themes/tests-valo*/**" />
<include name="VAADIN/themes/reindeer-tests/**" />
<include name="VAADIN/jquery.atmosphere.js" />
<include name="WEB-INF/*.xml" />
@@ -192,43 +196,43 @@
</target>
<target name="test-server" depends="clean-testbench-errors">
- <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
- <parallel>
- <daemons>
- <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
- </daemons>
- <sequential>
- <ant antfile="${uitest.dir}/integration_tests.xml" target="integration-test-all" inheritall="false" inheritrefs="false">
- <property name="demo.war" value="${war.file}" />
- </ant>
- </sequential>
- </parallel>
+ <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
+ <parallel>
+ <daemons>
+ <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
+ </daemons>
+ <sequential>
+ <ant antfile="${uitest.dir}/integration_tests.xml" target="integration-test-all" inheritall="false" inheritrefs="false">
+ <property name="demo.war" value="${war.file}" />
+ </ant>
+ </sequential>
+ </parallel>
</target>
<target name="test-tb2" depends="clean-testbench-errors">
- <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
- <parallel>
- <daemons>
- <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
- </daemons>
- <sequential>
- <ant antfile="${uitest.dir}/vaadin-server.xml" target="wait-for-startup" />
- <ant antfile="${uitest.dir}/test.xml" target="tb2-tests" />
- </sequential>
- </parallel>
+ <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
+ <parallel>
+ <daemons>
+ <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
+ </daemons>
+ <sequential>
+ <ant antfile="${uitest.dir}/vaadin-server.xml" target="wait-for-startup" />
+ <ant antfile="${uitest.dir}/test.xml" target="tb2-tests" />
+ </sequential>
+ </parallel>
</target>
<target name="test-tb3" depends="clean-testbench-errors">
- <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
- <parallel>
- <daemons>
- <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
- </daemons>
- <sequential>
- <ant antfile="${uitest.dir}/vaadin-server.xml" target="wait-for-startup" />
- <ant antfile="${uitest.dir}/tb3test.xml" target="run-all-tb3-tests" inheritall="true" />
- </sequential>
- </parallel>
+ <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
+ <parallel>
+ <daemons>
+ <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
+ </daemons>
+ <sequential>
+ <ant antfile="${uitest.dir}/vaadin-server.xml" target="wait-for-startup" />
+ <ant antfile="${uitest.dir}/tb3test.xml" target="run-all-tb3-tests" inheritall="true" />
+ </sequential>
+ </parallel>
</target>
<target name="clean-testbench-errors">
@@ -241,4 +245,71 @@
</delete>
</target>
+ <target name="compile-test-themes">
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo" />
+ </antcall>
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo-dark" />
+ </antcall>
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo-metro" />
+ </antcall>
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo-flat" />
+ </antcall>
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo-flatdark" />
+ </antcall>
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo-facebook" />
+ </antcall>
+ <antcall target="compile-theme">
+ <param name="theme" value="tests-valo-blueprint" />
+ </antcall>
+
+ </target>
+ <target name="compile-theme" depends="copy-theme">
+ <fail unless="theme" message="You must give the theme name to compile in the 'theme' parameter" />
+
+ <ivy:resolve log="download-only" resolveid="common" conf="compile-theme" />
+ <ivy:cachepath pathid="classpath.compile.theme" conf="compile-theme" />
+ <ivy:cachepath pathid="classpath.runtime.theme" conf="build" />
+
+ <echo>Compiling ${theme}</echo>
+ <mkdir dir="${theme.result.dir}" />
+
+ <!-- compile the theme -->
+ <java classname="com.vaadin.buildhelpers.CompileTheme" classpathref="classpath.compile.theme" failonerror="yes" fork="yes" maxmemory="512m">
+ <arg value="--theme" />
+ <arg value="${theme}" />
+ <arg value="--theme-folder" />
+ <arg value="${theme.result.dir}" />
+ <arg value="--version" />
+ <arg value="${vaadin.version}" />
+ <jvmarg value="-Xss8M" />
+ <jvmarg value="-XX:MaxPermSize=256M" />
+ <jvmarg value="-Djava.awt.headless=true" />
+ </java>
+
+ </target>
+
+ <target name="copy-theme">
+ <fail unless="theme" message="You must give the theme name to copy n the 'theme' parameter" />
+ <property name="theme.source.dir" location="../WebContent/VAADIN/themes" />
+
+ <copy todir="${theme.result.dir}">
+ <fileset dir="${theme.source.dir}">
+ <include name="${theme}/**/*.scss" />
+ </fileset>
+ <filterset refid="filter-vaadin.version" />
+ </copy>
+ <copy todir="${theme.result.dir}">
+ <fileset dir="${theme.source.dir}">
+ <exclude name="${theme}/**/*.scss" />
+ </fileset>
+ </copy>
+ </target>
+
+
</project>
diff --git a/uitest/ivy.xml b/uitest/ivy.xml
index 020543c53f..9af209662c 100644
--- a/uitest/ivy.xml
+++ b/uitest/ivy.xml
@@ -15,6 +15,7 @@
<conf name="build-provided" visibility="private" />
<conf name="ide" visibility="private" />
<conf name="jetty-run" visibility="private" />
+ <conf name="compile-theme" visibility="private" />
</configurations>
<publications>
<artifact type="war" ext="war" />
@@ -99,6 +100,13 @@
<!-- This should be removed once tests have been updated to use lang3 -->
<dependency org="commons-lang" name="commons-lang"
rev="2.6" conf="build,ide -> default" />
+
+ <dependency org="com.vaadin" name="vaadin-sass-compiler"
+ rev="${vaadin.sass.version}" conf="compile-theme->default" />
+
+ <dependency org="com.vaadin" name="vaadin-buildhelpers"
+ rev="${vaadin.version}" conf="compile-theme->build" />
+
</dependencies>
</ivy-module>
diff --git a/uitest/src/com/vaadin/tests/applicationservlet/UIProviderInitParameter.html b/uitest/src/com/vaadin/tests/applicationservlet/UIProviderInitParameter.html
deleted file mode 100644
index 8a5f89cbad..0000000000
--- a/uitest/src/com/vaadin/tests/applicationservlet/UIProviderInitParameter.html
+++ /dev/null
@@ -1,39 +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>/uiprovider</td>
- <td></td>
-</tr>
-<!--Test that UI parameter is used by default-->
-<tr>
- <td>assertText</td>
- <td>vaadin=uiprovider::/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0]</td>
- <td>Tests whether the testing server is run with assertions enabled.</td>
-</tr>
-<!--Test that UIProvider parameter is more important than UI parameter-->
-<tr>
- <td>open</td>
- <td>/uiprovider/test</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=uiprovider::/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0]</td>
- <td>Test for basic JavaScript component functionality.</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/applicationservlet/UIProviderInitParameterTest.java b/uitest/src/com/vaadin/tests/applicationservlet/UIProviderInitParameterTest.java
new file mode 100644
index 0000000000..8197bbe8b8
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/applicationservlet/UIProviderInitParameterTest.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.applicationservlet;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class UIProviderInitParameterTest extends MultiBrowserTest {
+
+ @Test
+ public void testDefault() {
+ // Test that UI parameter is used by default
+ openTestURL();
+
+ List<LabelElement> labels = $(LabelElement.class).all();
+ assertTrue("unexpected amount of labels", labels.size() > 2);
+
+ LabelElement label = labels.get(labels.size() - 1);
+ String message = "Tests whether the testing server is run with assertions enabled.";
+ assertEquals("unexpected text found", message, label.getText());
+ }
+
+ @Test
+ public void testExtended() {
+ // Test that UIProvider parameter is more important than UI parameter
+ driver.get(getTestUrl().replace("uiprovider", "uiprovider/test"));
+
+ LabelElement label = $(LabelElement.class).first();
+ String message = "Test for basic JavaScript component functionality.";
+ assertEquals("unexpected text found", message, label.getText());
+ }
+
+ @Override
+ protected String getDeploymentPath() {
+ return "/uiprovider";
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupClose.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupClose.java
new file mode 100644
index 0000000000..253d6a0d1e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupClose.java
@@ -0,0 +1,29 @@
+package com.vaadin.tests.components.combobox;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.ComboBox;
+
+public class ComboBoxSuggestionPopupClose extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final ComboBox select = new ComboBox("ComboBox");
+ select.addItem("one");
+ select.addItem("two");
+ select.addItem("three");
+ addComponent(select);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Closing the suggestion popup using Enter key is "
+ + "broken in combobox when opening popup using Enter "
+ + "key and not changin the selection using arrows";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14379;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupCloseTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupCloseTest.java
new file mode 100644
index 0000000000..5e9e076cac
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionPopupCloseTest.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.combobox;
+
+import static org.junit.Assert.assertFalse;
+import static org.openqa.selenium.Keys.ARROW_DOWN;
+import static org.openqa.selenium.Keys.ENTER;
+
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ComboBoxElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * @author Vaadin Ltd
+ */
+public class ComboBoxSuggestionPopupCloseTest extends MultiBrowserTest {
+
+ private WebElement selectTextbox;
+
+ @Test
+ public void closeSuggestionPopupTest() throws Exception {
+ openTestURL();
+
+ waitForElementVisible(By.className("v-filterselect"));
+
+ selectTextbox = $(ComboBoxElement.class).first().findElement(
+ By.vaadin("#textbox"));
+ selectTextbox.click();
+
+ // open popup and select first element
+ sendKeys(new Keys[] { ARROW_DOWN, ARROW_DOWN, ENTER });
+
+ // open popup and hit enter to close it
+ sendKeys(new Keys[] { ARROW_DOWN, ENTER });
+
+ assertFalse(isElementPresent(By.className("v-filterselect-suggestmenu")));
+
+ }
+
+ private void sendKeys(Keys[] keys) throws Exception {
+ for (Keys key : keys) {
+ selectTextbox.sendKeys(key);
+ // wait a while between the key presses, at least PhantomJS fails if
+ // they are sent too fast
+ sleep(10);
+ }
+ }
+};
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java
index 6820410059..e3c85224c0 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldChangeResolutionTest.java
@@ -99,7 +99,10 @@ public class DateFieldChangeResolutionTest extends MultiBrowserTest {
}
private void checkHeaderAndBody(Resolution resolution,
- boolean textFieldIsEmpty) {
+ boolean textFieldIsEmpty) throws Exception {
+ // Popup date field has all kinds of strange timers on the
+ // client side
+ sleep(100);
// Open the popup calendar, perform checks and close the popup.
openPopupDateField();
if (resolution.getCalendarField() >= Resolution.MONTH
diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html
deleted file mode 100644
index 2783ed2aa3..0000000000
--- a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html
+++ /dev/null
@@ -1,136 +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>PopupDateFieldExtendedRange</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">PopupDateFieldExtendedRange</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.datefield.PopupDateFieldExtendedRange?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton</td>
- <td>7,16</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup1-01-2011</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]#prevmon</td>
- <td>8,7</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup1-12-2010</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]#prevy</td>
- <td>12,6</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup1-12-2009</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton</td>
- <td>10,13</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]#popupButton</td>
- <td>14,13</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup2-02-2010</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]</td>
- <td>down</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]</td>
- <td>down</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup2-03-2010</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]</td>
- <td>left</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]</td>
- <td>left</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup2-02-2010-again</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VPopupCalendar[0]#popupButton</td>
- <td>7,16</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]#popupButton</td>
- <td>17,10</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]</td>
- <td>shift left</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup3-01-2010</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::Root/VOverlay[0]/VCalendarPanel[0]</td>
- <td>shift down</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>popup3-01-2009</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldExtendedRange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VPopupCalendar[0]#popupButton</td>
- <td>10,8</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java
index a12bdfa44c..2608e6e081 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java
+++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java
@@ -3,20 +3,21 @@ package com.vaadin.tests.components.datefield;
import java.util.Calendar;
import java.util.Locale;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.DateField;
import com.vaadin.ui.PopupDateField;
@SuppressWarnings("serial")
-public class PopupDateFieldExtendedRange extends TestBase {
+public class PopupDateFieldExtendedRange extends AbstractTestUI {
private Calendar date = Calendar.getInstance();
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
date.set(2011, 0, 1);
getLayout().setSpacing(true);
@@ -52,7 +53,7 @@ public class PopupDateFieldExtendedRange extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "Show a few days of the preceding and following months in the datefield popup";
}
@@ -63,7 +64,7 @@ public class PopupDateFieldExtendedRange extends TestBase {
private PopupDateField makeDateField() {
PopupDateField pdf = new PopupDateField();
- pdf.setResolution(DateField.RESOLUTION_DAY);
+ pdf.setResolution(Resolution.DAY);
pdf.setValue(date.getTime());
return pdf;
}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRangeTest.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRangeTest.java
new file mode 100644
index 0000000000..6d22048d32
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRangeTest.java
@@ -0,0 +1,510 @@
+/*
+ * 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 static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+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.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.DateFieldElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests contents and functionality of PopupDateField's popup.
+ *
+ * @author Vaadin Ltd
+ */
+public class PopupDateFieldExtendedRangeTest extends MultiBrowserTest {
+
+ @Override
+ @Before
+ public void setup() throws Exception {
+ super.setup();
+ openTestURL();
+ }
+
+ @Test
+ public void testFirstDateField() {
+ List<DateFieldElement> dateFields = $(DateFieldElement.class).all();
+ assertEquals("unexpected amount of datefields", 3, dateFields.size());
+
+ DateFieldElement dateField = dateFields.get(0);
+
+ // open the popup
+ dateField.findElement(By.tagName("button")).click();
+
+ assertTrue("popup not found when there should be one",
+ isElementPresent(By.className("v-datefield-popup")));
+
+ // verify contents
+ WebElement popup = findElement(By.className("v-datefield-popup"));
+ assertEquals(
+ "unexpected month",
+ "tammikuu 2011",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ List<WebElement> headerElements = popup.findElement(
+ By.className("v-datefield-calendarpanel-weekdays"))
+ .findElements(By.tagName("td"));
+ List<WebElement> weekdays = new ArrayList<WebElement>();
+ for (WebElement headerElement : headerElements) {
+ if ("columnheader".equals(headerElement.getAttribute("role"))) {
+ weekdays.add(headerElement);
+ }
+ }
+ assertEquals("unexpected weekday count", 7, weekdays.size());
+ assertEquals("unexpected first day of week", "MA", weekdays.get(0)
+ .getText());
+ assertEquals(
+ "unexpected weeknumber count",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-weeknumber"))
+ .size());
+ assertEquals(
+ "unexpected selection",
+ "1",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .getText());
+ assertEquals(
+ "unexpected focus",
+ "1",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ List<WebElement> days = popup.findElements(By
+ .className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "27", days.get(0).getText());
+ assertEquals("unexpected day content", "4", days.get(8).getText());
+ assertEquals("unexpected day content", "21", days.get(25).getText());
+ assertEquals("unexpected day content", "6", days.get(41).getText());
+
+ // move to the previous month
+ popup.findElement(By.className("v-datefield-calendarpanel-prevmonth"))
+ .findElement(By.tagName("button")).click();
+
+ // verify contents
+ assertEquals(
+ "unexpected month",
+ "joulukuu 2010",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ "1",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .getText());
+ assertEquals(
+ "unexpected focus",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .size());
+ days = popup
+ .findElements(By.className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "29", days.get(0).getText());
+ assertEquals("unexpected day content", "7", days.get(8).getText());
+ assertEquals("unexpected day content", "24", days.get(25).getText());
+ assertEquals("unexpected day content", "9", days.get(41).getText());
+
+ // move to the previous year
+ popup.findElement(By.className("v-datefield-calendarpanel-prevyear"))
+ .findElement(By.tagName("button")).click();
+
+ // verify contents
+ assertEquals(
+ "unexpected month",
+ "joulukuu 2009",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .size());
+ assertEquals(
+ "unexpected focus",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .size());
+ days = popup
+ .findElements(By.className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "30", days.get(0).getText());
+ assertEquals("unexpected day content", "8", days.get(8).getText());
+ assertEquals("unexpected day content", "25", days.get(25).getText());
+ assertEquals("unexpected day content", "10", days.get(41).getText());
+
+ // close the popup by clicking the button again
+ dateField.findElement(By.tagName("button")).click();
+
+ // TODO: remove this once #14405 has been fixed
+ if (!getBrowsersExcludingIE().contains(getDesiredCapabilities())) {
+ // click something else outside the popup to close it
+ dateField.findElement(By.tagName("input")).click();
+ }
+
+ assertFalse("popup found when there should be none",
+ isElementPresent(By.className("v-datefield-popup")));
+ }
+
+ @Test
+ public void testSecondDateField() throws InterruptedException {
+ DateFieldElement dateField = $(DateFieldElement.class).all().get(1);
+ ButtonElement button = $(ButtonElement.class).first();
+
+ // change the date
+ button.click();
+ sleep(100);
+
+ // open the popup
+ dateField.findElement(By.tagName("button")).click();
+
+ assertTrue("popup not found when there should be one",
+ isElementPresent(By.className("v-datefield-popup")));
+
+ // verify contents
+ WebElement popup = findElement(By.className("v-datefield-popup"));
+ assertEquals(
+ "unexpected month",
+ "February 2010",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ List<WebElement> headerElements = popup.findElement(
+ By.className("v-datefield-calendarpanel-weekdays"))
+ .findElements(By.tagName("td"));
+ List<WebElement> weekdays = new ArrayList<WebElement>();
+ for (WebElement headerElement : headerElements) {
+ if ("columnheader".equals(headerElement.getAttribute("role"))) {
+ weekdays.add(headerElement);
+ }
+ }
+ assertEquals("unexpected weekday count", 7, weekdays.size());
+ assertEquals("unexpected first day of week", "SUN", weekdays.get(0)
+ .getText());
+ assertEquals(
+ "unexpected weeknumber count",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-weeknumber"))
+ .size());
+ assertEquals(
+ "unexpected selection",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .getText());
+ assertEquals(
+ "unexpected focus",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ List<WebElement> days = popup.findElements(By
+ .className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "31", days.get(0).getText());
+ assertEquals("unexpected day content", "8", days.get(8).getText());
+ assertEquals("unexpected day content", "25", days.get(25).getText());
+ assertEquals("unexpected day content", "13", days.get(41).getText());
+
+ // navigate down
+ WebElement popupBody = popup.findElement(By
+ .className("v-datefield-calendarpanel"));
+ popupBody.sendKeys(Keys.ARROW_DOWN);
+
+ // ensure the focus changed
+ assertEquals(
+ "unexpected focus",
+ "23",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+
+ // navigate down
+ popupBody.sendKeys(Keys.ARROW_DOWN);
+
+ // verify contents
+ assertEquals(
+ "unexpected month",
+ "March 2010",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .size());
+ assertEquals(
+ "unexpected focus",
+ "2",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ days = popup
+ .findElements(By.className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "28", days.get(0).getText());
+ assertEquals("unexpected day content", "8", days.get(8).getText());
+ assertEquals("unexpected day content", "25", days.get(25).getText());
+ assertEquals("unexpected day content", "10", days.get(41).getText());
+
+ // navigate left
+ popupBody = popup
+ .findElement(By.className("v-datefield-calendarpanel"));
+ popupBody.sendKeys(Keys.ARROW_LEFT);
+
+ // ensure the focus changed
+ assertEquals(
+ "unexpected focus",
+ "1",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+
+ // navigate left
+ popupBody.sendKeys(Keys.ARROW_LEFT);
+
+ // verify contents
+ assertEquals(
+ "unexpected month",
+ "February 2010",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .getText());
+ assertEquals(
+ "unexpected focus",
+ "28",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ days = popup
+ .findElements(By.className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "31", days.get(0).getText());
+ assertEquals("unexpected day content", "8", days.get(8).getText());
+ assertEquals("unexpected day content", "25", days.get(25).getText());
+ assertEquals("unexpected day content", "13", days.get(41).getText());
+
+ // close the popup by clicking the input field
+ dateField.findElement(By.tagName("input")).click();
+
+ assertFalse("popup found when there should be none",
+ isElementPresent(By.className("v-datefield-popup")));
+ }
+
+ @Test
+ public void testThirdDateField() throws InterruptedException {
+ DateFieldElement dateField = $(DateFieldElement.class).all().get(2);
+ ButtonElement button = $(ButtonElement.class).first();
+
+ // change the date
+ button.click();
+ sleep(100);
+
+ // open the popup
+ dateField.findElement(By.tagName("button")).click();
+
+ assertTrue("popup not found when there should be one",
+ isElementPresent(By.className("v-datefield-popup")));
+
+ // verify contents
+ WebElement popup = findElement(By.className("v-datefield-popup"));
+ assertEquals(
+ "unexpected month",
+ "helmikuu 2010",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ List<WebElement> headerElements = popup.findElement(
+ By.className("v-datefield-calendarpanel-weekdays"))
+ .findElements(By.tagName("td"));
+ List<WebElement> weekdays = new ArrayList<WebElement>();
+ for (WebElement headerElement : headerElements) {
+ if ("columnheader".equals(headerElement.getAttribute("role"))) {
+ weekdays.add(headerElement);
+ }
+ }
+ assertEquals("unexpected weekday count", 7, weekdays.size());
+ assertEquals("unexpected first day of week", "MA", weekdays.get(0)
+ .getText());
+ List<WebElement> weeknumbers = popup.findElements(By
+ .className("v-datefield-calendarpanel-weeknumber"));
+ assertEquals("unexpected weeknumber count", 6, weeknumbers.size());
+ assertEquals("unexpected weeknumber content", "5", weeknumbers.get(0)
+ .getText());
+ assertEquals("unexpected weeknumber content", "10", weeknumbers.get(5)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .getText());
+ assertEquals(
+ "unexpected focus",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ List<WebElement> days = popup.findElements(By
+ .className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "1", days.get(0).getText());
+ assertEquals("unexpected day content", "9", days.get(8).getText());
+ assertEquals("unexpected day content", "26", days.get(25).getText());
+ assertEquals("unexpected day content", "14", days.get(41).getText());
+
+ // navigate to previous month
+ WebElement popupBody = popup.findElement(By
+ .className("v-datefield-calendarpanel"));
+ new Actions(driver).keyDown(Keys.SHIFT).perform();
+ popupBody.sendKeys(Keys.ARROW_LEFT);
+ new Actions(driver).keyUp(Keys.SHIFT).perform();
+
+ // TODO: remove this once #14406 has been fixed
+ if (!getBrowsersExcludingIE().contains(getDesiredCapabilities())
+ && !Browser.IE8.getDesiredCapabilities().equals(
+ getDesiredCapabilities())) {
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-prevmonth"))
+ .findElement(By.tagName("button")).click();
+ }
+
+ // verify contents
+ assertEquals(
+ "unexpected month",
+ "tammikuu 2010",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ weeknumbers = popup.findElements(By
+ .className("v-datefield-calendarpanel-weeknumber"));
+ assertEquals("unexpected weeknumber count", 6, weeknumbers.size());
+ assertEquals("unexpected weeknumber content", "53", weeknumbers.get(0)
+ .getText());
+ assertEquals("unexpected weeknumber content", "5", weeknumbers.get(5)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .size());
+ // TODO: remove this check once #14406 has been fixed -- clicking the
+ // button instead of navigating with arrow keys steals the focus
+ if (getBrowsersExcludingIE().contains(getDesiredCapabilities())
+ || Browser.IE8.getDesiredCapabilities().equals(
+ getDesiredCapabilities())) {
+ assertEquals(
+ "unexpected focus",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ }
+ days = popup
+ .findElements(By.className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "28", days.get(0).getText());
+ assertEquals("unexpected day content", "5", days.get(8).getText());
+ assertEquals("unexpected day content", "22", days.get(25).getText());
+ assertEquals("unexpected day content", "7", days.get(41).getText());
+
+ // navigate to previous year
+ new Actions(driver).keyDown(Keys.SHIFT).perform();
+ popupBody.sendKeys(Keys.ARROW_DOWN);
+ new Actions(driver).keyUp(Keys.SHIFT).perform();
+
+ // TODO: remove this once #14406 has been fixed
+ popup.findElement(By.className("v-datefield-calendarpanel-prevyear"))
+ .findElement(By.tagName("button")).click();
+
+ // verify contents
+ assertEquals(
+ "unexpected month",
+ "tammikuu 2009",
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-month")).get(1)
+ .getText());
+ weeknumbers = popup.findElements(By
+ .className("v-datefield-calendarpanel-weeknumber"));
+ assertEquals("unexpected weeknumber count", 6, weeknumbers.size());
+ assertEquals("unexpected weeknumber content", "1", weeknumbers.get(0)
+ .getText());
+ assertEquals("unexpected weeknumber content", "6", weeknumbers.get(5)
+ .getText());
+ assertEquals(
+ "unexpected selection",
+ 0,
+ popup.findElements(
+ By.className("v-datefield-calendarpanel-day-selected"))
+ .size());
+ // TODO: remove this check once #14406 has been fixed -- clicking the
+ // button instead of navigating with arrow keys steals the focus
+ if (false) {
+ assertEquals(
+ "unexpected focus",
+ "16",
+ popup.findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ }
+ days = popup
+ .findElements(By.className("v-datefield-calendarpanel-day"));
+ assertEquals("unexpected day count", 42, days.size());
+ assertEquals("unexpected day content", "29", days.get(0).getText());
+ assertEquals("unexpected day content", "6", days.get(8).getText());
+ assertEquals("unexpected day content", "23", days.get(25).getText());
+ assertEquals("unexpected day content", "8", days.get(41).getText());
+
+ // close the popup by clicking an unrelated element
+ button.click();
+
+ assertFalse("popup found when there should be none",
+ isElementPresent(By.className("v-datefield-popup")));
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java
index b143ddf2dc..8539f70b17 100644
--- a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java
+++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java
@@ -3,26 +3,53 @@ package com.vaadin.tests.components.draganddropwrapper;
import com.vaadin.tests.components.TestBase;
import com.vaadin.tests.util.TestUtils;
import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
import com.vaadin.ui.DragAndDropWrapper;
import com.vaadin.ui.DragAndDropWrapper.DragStartMode;
import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
public class DragStartModes extends TestBase {
@Override
protected void setup() {
- TestUtils.injectCSS(getMainWindow(),
- ".v-ddwrapper { background: #ACF; }");
+ TestUtils
+ .injectCSS(getMainWindow(),
+ ".v-ddwrapper { background: #ACF; } .extra{ background: #FFA500; }");
addComponent(makeWrapper(DragStartMode.NONE));
addComponent(makeWrapper(DragStartMode.COMPONENT));
addComponent(makeWrapper(DragStartMode.WRAPPER));
addComponent(makeWrapper(DragStartMode.HTML5));
+ addComponent(makeOtherComponentWrapper(DragStartMode.COMPONENT_OTHER));
addComponent(new Label("Drop here"));
}
+ private Component makeOtherComponentWrapper(DragStartMode componentOther) {
+ VerticalLayout parent = new VerticalLayout();
+ parent.setWidth("200px");
+ parent.setSpacing(true);
+
+ CssLayout header = new CssLayout();
+ header.addComponent(new Label("Drag start mode : COMPONENT_OTHER"));
+ header.setSizeUndefined();
+
+ DragAndDropWrapper wrapper = new DragAndDropWrapper(header);
+ wrapper.setDragStartMode(DragStartMode.COMPONENT_OTHER);
+ wrapper.setDragImageComponent(parent);
+ wrapper.setId("label" + "COMPONENT_OTHER");
+ parent.addComponent(wrapper);
+
+ Label extra = new Label(
+ "Extra label that is not part of the wrapper. This should be dragged along with COMPONENT_OTHER.");
+ extra.addStyleName("extra");
+ parent.addComponent(extra);
+
+ return parent;
+ }
+
private Component makeWrapper(DragStartMode mode) {
Label label = new Label("Drag start mode: " + mode);
label.setId("label" + mode);
diff --git a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModesTest.java b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModesTest.java
index 25aef1b815..ba27ee293e 100644
--- a/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModesTest.java
+++ b/uitest/src/com/vaadin/tests/components/draganddropwrapper/DragStartModesTest.java
@@ -31,6 +31,7 @@ public class DragStartModesTest extends MultiBrowserTest {
WebElement dropTarget = vaadinElement("/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0]");
dragToTarget("COMPONENT", dropTarget);
dragToTarget("WRAPPER", dropTarget);
+ dragToTarget("COMPONENT_OTHER", dropTarget);
}
private void dragToTarget(String dragMode, WebElement dropTarget)
diff --git a/uitest/src/com/vaadin/tests/components/table/SortLabelsInTable.java b/uitest/src/com/vaadin/tests/components/table/SortLabelsInTable.java
index 0dc8584169..499cce58c8 100644
--- a/uitest/src/com/vaadin/tests/components/table/SortLabelsInTable.java
+++ b/uitest/src/com/vaadin/tests/components/table/SortLabelsInTable.java
@@ -16,14 +16,16 @@
package com.vaadin.tests.components.table;
import com.vaadin.data.Item;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
-public class SortLabelsInTable extends TestBase {
+public class SortLabelsInTable extends AbstractTestUI {
+ @SuppressWarnings("unchecked")
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
Table t = new Table("A table with a text column and a Label column");
t.addContainerProperty("text", String.class, null);
t.addContainerProperty("label", Label.class, null);
@@ -37,9 +39,8 @@ public class SortLabelsInTable extends TestBase {
}
@Override
- protected String getDescription() {
- // TODO Auto-generated method stub
- return null;
+ protected String getTestDescription() {
+ return "Tests that Labels are sorted in the same way than Strings are.";
}
@Override
diff --git a/uitest/src/com/vaadin/tests/components/table/SortLabelsInTableTest.java b/uitest/src/com/vaadin/tests/components/table/SortLabelsInTableTest.java
new file mode 100644
index 0000000000..54b5cad9b2
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/SortLabelsInTableTest.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.table;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests sorting labels in table.
+ *
+ * @author Vaadin Ltd
+ */
+public class SortLabelsInTableTest extends MultiBrowserTest {
+
+ @Test
+ public void testSorting() {
+ openTestURL();
+
+ TableElement table = $(TableElement.class).first();
+
+ // check unsorted
+ assertEquals("Text 0", table.getCell(0, 0).getText());
+ assertEquals("Label 0", table.getCell(0, 1).getText());
+ assertEquals("Text 14", table.getCell(14, 0).getText());
+ assertEquals("Label 14", table.getCell(14, 1).getText());
+
+ // sort by first column (ascending order)
+ table.getHeaderCell(0).click();
+
+ // check sorted
+ assertEquals("Text 0", table.getCell(0, 0).getText());
+ assertEquals("Label 0", table.getCell(0, 1).getText());
+ assertEquals("Text 10", table.getCell(2, 0).getText());
+ assertEquals("Label 10", table.getCell(2, 1).getText());
+ assertEquals("Text 19", table.getCell(11, 0).getText());
+ assertEquals("Label 19", table.getCell(11, 1).getText());
+ assertEquals("Text 4", table.getCell(14, 0).getText());
+ assertEquals("Label 4", table.getCell(14, 1).getText());
+
+ // sort by first column (descending order)
+ table.getHeaderCell(0).click();
+
+ // check sorted
+ assertEquals("Text 9", table.getCell(0, 0).getText());
+ assertEquals("Label 9", table.getCell(0, 1).getText());
+ assertEquals("Text 19", table.getCell(8, 0).getText());
+ assertEquals("Label 19", table.getCell(8, 1).getText());
+ assertEquals("Text 13", table.getCell(14, 0).getText());
+ assertEquals("Label 13", table.getCell(14, 1).getText());
+
+ // sort by second column (descending order)
+ table.getHeaderCell(1).click();
+
+ // check no change
+ assertEquals("Text 9", table.getCell(0, 0).getText());
+ assertEquals("Label 9", table.getCell(0, 1).getText());
+ assertEquals("Text 19", table.getCell(8, 0).getText());
+ assertEquals("Label 19", table.getCell(8, 1).getText());
+ assertEquals("Text 13", table.getCell(14, 0).getText());
+ assertEquals("Label 13", table.getCell(14, 1).getText());
+
+ // sort by second column (ascending order)
+ table.getHeaderCell(1).click();
+
+ // check back to first sorting results
+ assertEquals("Text 0", table.getCell(0, 0).getText());
+ assertEquals("Label 0", table.getCell(0, 1).getText());
+ assertEquals("Text 10", table.getCell(2, 0).getText());
+ assertEquals("Label 10", table.getCell(2, 1).getText());
+ assertEquals("Text 19", table.getCell(11, 0).getText());
+ assertEquals("Label 19", table.getCell(11, 1).getText());
+ assertEquals("Text 4", table.getCell(14, 0).getText());
+ assertEquals("Label 4", table.getCell(14, 1).getText());
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.html b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.html
deleted file mode 100644
index 5116fceb49..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="http://localhost:8888/" />
-<title>New Test</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">New Test</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.table.TableRowScrolledBottom?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[44]/VLabel[0]</td>
- <td>This is a test item with long text so that there is something to see Nr. 100. This text must be long otherwise the timing issue on Firefox does not occur. This works fine in IE</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableTableRowScrolledBottom::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[44]/VLabel[0]</td>
- <td>This is a test item with long text so that there is something to see Nr. 200. This text must be long otherwise the timing issue on Firefox does not occur. This works fine in IE</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java
index 7d48dfa11e..e1fe4d0514 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java
+++ b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java
@@ -1,15 +1,19 @@
package com.vaadin.tests.components.table;
+import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.label.ContentMode;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
-public class TableRowScrolledBottom extends TestBase {
+public class TableRowScrolledBottom extends AbstractTestUI {
+
+ final static String part1 = "This is a test item with long text so that there is something to see Nr. ";
+ final static String part2 = ". This text must be long otherwise the timing issue on Firefox does not occur. This works fine in IE";
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
final Table table = new Table();
table.setSizeFull();
@@ -24,12 +28,8 @@ public class TableRowScrolledBottom extends TestBase {
public void buttonClick(Button.ClickEvent event) {
for (int j = 0; j < 100; j++) {
++i;
- table.addItem(
- new Object[] { new Label(
- "This is a test item with long text so that there is something to see Nr. <b>"
- + i
- + "</b>. This text must be long otherwise the timing issue on Firefox does not occur. This works fine in IE",
- ContentMode.HTML) }, i);
+ table.addItem(new Object[] { new Label(part1 + "<b>" + i
+ + "</b>" + part2, ContentMode.HTML) }, i);
table.setCurrentPageFirstItemIndex(table
.getContainerDataSource().size() - 1);
}
@@ -42,7 +42,7 @@ public class TableRowScrolledBottom extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "Table should be scrolled to bottom when adding rows and updating currentPageFirstItemIndex to last item";
}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottomTest.java b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottomTest.java
new file mode 100644
index 0000000000..0fad02b410
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottomTest.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.table;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that adding long labels to a Table and scrolling to the bottom works as
+ * intended.
+ *
+ * @author Vaadin Ltd
+ */
+public class TableRowScrolledBottomTest extends MultiBrowserTest {
+
+ @Test
+ public void testScrolling() throws IOException, InterruptedException {
+ openTestURL();
+
+ ButtonElement button = $(ButtonElement.class).first();
+ TableElement table = $(TableElement.class).first();
+
+ // initialise contents
+ button.click();
+ sleep(500);
+
+ List<WebElement> rows = table.findElement(By.className("v-table-body"))
+ .findElements(By.tagName("tr"));
+
+ // check that the final row is the one intended
+ WebElement finalRow = rows.get(rows.size() - 1);
+ WebElement label = finalRow.findElement(By.className("v-label"));
+ assertEquals(TableRowScrolledBottom.part1 + 100
+ + TableRowScrolledBottom.part2, label.getText());
+
+ // add more rows
+ button.click();
+ sleep(500);
+
+ rows = table.findElement(By.className("v-table-body")).findElements(
+ By.tagName("tr"));
+
+ // check that the final row is the one intended
+ finalRow = rows.get(rows.size() - 1);
+ label = finalRow.findElement(By.className("v-label"));
+ assertEquals(TableRowScrolledBottom.part1 + 200
+ + TableRowScrolledBottom.part2, label.getText());
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.html b/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.html
deleted file mode 100644
index 6e3d86175a..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.html
+++ /dev/null
@@ -1,63 +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>TextFieldRelativeWidth</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TextFieldRelativeWidth</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.table.TextFieldRelativeWidth</td>
- <td></td>
-</tr>
-<!-- Workaround for Opera 10.50 CSS loading problem -->
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.table.TextFieldRelativeWidth</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=runcomvaadintestscomponentstableTextFieldRelativeWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTextFieldRelativeWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[4]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.java b/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.java
index 5c7479d060..4799d05415 100644
--- a/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.java
+++ b/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.java
@@ -1,19 +1,19 @@
package com.vaadin.tests.components.table;
import com.vaadin.data.Item;
-import com.vaadin.data.Property;
import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Component;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
-public class TextFieldRelativeWidth extends TestBase {
+public class TextFieldRelativeWidth extends AbstractTestUI {
@Override
- public void setup() {
+ public void setup(VaadinRequest request) {
TextField tf = new TextField("test", "testing");
tf.setWidth("100%");
@@ -30,15 +30,12 @@ public class TextFieldRelativeWidth extends TestBase {
private Button addButton = new Button("Add new row", this);
private String inputPrompt;
-
private String inputPromptChild;
-
private int nextItemIndex = 1;
- private static final long serialVersionUID = 3326806911297977454L;
-
+ @SuppressWarnings("unchecked")
public EditTable() {
- setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
+ setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
inputPrompt = "";
setPageLength(100);
setHeight("100%");
@@ -51,20 +48,9 @@ public class TextFieldRelativeWidth extends TestBase {
i.getItemProperty("text").setValue(addButton);
setImmediate(true);
setSelectable(true);
- addListener(new Property.ValueChangeListener() {
- private static final long serialVersionUID = 448896474865195605L;
-
- @Override
- public void valueChange(
- com.vaadin.data.Property.ValueChangeEvent event) {
- // IndexedContainer idc = (IndexedContainer)
- // getContainerDataSource();
-
- }
-
- });
}
+ @SuppressWarnings("unchecked")
public void addNewRow() {
IndexedContainer idc = (IndexedContainer) getContainerDataSource();
int size = idc.size();
@@ -87,8 +73,6 @@ public class TextFieldRelativeWidth extends TestBase {
if (inputPromptChild != null && inputPromptChild.length() > 0) {
tf.setInputPrompt(inputPromptChild);
}
- // tf.setRows(1);
- // tf.setHeight("45px");
tf.setWidth("100%");
tf.addStyleName("childtf");
newItem.getItemProperty("text").setValue(tf);
@@ -119,7 +103,7 @@ public class TextFieldRelativeWidth extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "The table has 3 columns. The second column is expanded and contains 100% wide textfields. These should fill the available space. The third column is empty.";
}
diff --git a/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidthTest.java b/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidthTest.java
new file mode 100644
index 0000000000..520ffa1aec
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TextFieldRelativeWidthTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.table;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that a TextField with 100% width fills the expanded column.
+ *
+ * @author Vaadin Ltd
+ */
+public class TextFieldRelativeWidthTest extends MultiBrowserTest {
+
+ @Test
+ public void testWidth() throws IOException {
+ openTestURL();
+
+ compareScreen("initial");
+
+ ButtonElement button = $(ButtonElement.class).first();
+ button.click();
+ button.click();
+
+ compareScreen("after");
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.html b/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.html
deleted file mode 100644
index 825988173a..0000000000
--- a/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.html
+++ /dev/null
@@ -1,241 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<title>TabKeyboardNavigation</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TabKeyboardNavigation</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/TabKeyboardNavigation?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>9,8</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[1]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 1</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>space</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[1]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 2</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>tab2</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[3]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 2</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
- <td>space</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[3]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 5</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>skip-disabled-to-tab5</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[4]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 5</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>space</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[4]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 6</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>18,10</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[9]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[10]</td>
- <td>right</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[8]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 9</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[10]</td>
- <td>space</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[8]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 12</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>scrolled-right-to-tab-12</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[4]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>11,2</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[4]</td>
- <td>left</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
- <td>left</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
- <td>left</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>1000</td>
- <td>1000</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 5</td>
-</tr>
-<tr>
- <td>pressSpecialKey</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
- <td>space</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runTabKeyboardNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Tab 1</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>scrolled-left-to-tab-1</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java
index ba737f1df8..620f04fe60 100644
--- a/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigation.java
@@ -6,7 +6,8 @@ import com.vaadin.event.FieldEvents.BlurEvent;
import com.vaadin.event.FieldEvents.BlurListener;
import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.event.FieldEvents.FocusListener;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.util.Log;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -19,7 +20,16 @@ import com.vaadin.ui.TabSheet.Tab;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
-public class TabKeyboardNavigation extends TestBase {
+/**
+ * Test if the click and key tab selection in a tabsheet generate the correct
+ * focus/blur events.
+ *
+ * The solution was broken in ticket (#14304)
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TabKeyboardNavigation extends AbstractTestUI {
int index = 1;
ArrayList<Component> tabs = new ArrayList<Component>();
@@ -27,18 +37,18 @@ public class TabKeyboardNavigation extends TestBase {
Log focusblur = new Log(10);
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
ts.setWidth("500px");
ts.setHeight("500px");
- ts.addListener(new FocusListener() {
+ ts.addFocusListener(new FocusListener() {
@Override
public void focus(FocusEvent event) {
focusblur.log("Tabsheet focused!");
}
});
- ts.addListener(new BlurListener() {
+ ts.addBlurListener(new BlurListener() {
@Override
public void blur(BlurEvent event) {
focusblur.log("Tabsheet blurred!");
@@ -74,7 +84,7 @@ public class TabKeyboardNavigation extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "The tab bar should be focusable and arrow keys should switch tabs. The del key should close a tab if closable.";
}
@@ -83,10 +93,18 @@ public class TabKeyboardNavigation extends TestBase {
return 5100;
}
+ public final static String LABEL_ID = "sheetLabel";
+
+ public final static String labelID(int index) {
+ return LABEL_ID + index;
+ }
+
private Tab addTab() {
Layout content = new VerticalLayout();
tabs.add(content);
- content.addComponent(new Label("Tab " + index));
+ Label label = new Label("Tab " + index);
+ label.setId(labelID(index));
+ content.addComponent(label);
content.addComponent(new TextField());
Tab tab = ts.addTab(content, "Tab " + index, null);
if (index == 2) {
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationTest.java
new file mode 100644
index 0000000000..65307f9492
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabKeyboardNavigationTest.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.tabsheet;
+
+import java.io.IOException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Add TB3 test as the TB2 one failed on keyboard events.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TabKeyboardNavigationTest extends MultiBrowserTest {
+
+ @Test
+ public void testFocus() throws InterruptedException, IOException {
+ openTestURL();
+
+ click(1);
+ sendKeys(1, Keys.ARROW_RIGHT);
+
+ assertSheet(1);
+ sendKeys(2, Keys.SPACE);
+ assertSheet(2);
+ compareScreen("tab2");
+
+ sendKeys(2, Keys.ARROW_RIGHT);
+ sendKeys(3, Keys.ARROW_RIGHT);
+ assertSheet(2);
+
+ sendKeys(5, Keys.SPACE);
+ assertSheet(5);
+ compareScreen("skip-disabled-to-tab5");
+
+ TestBenchElement addTabButton = (TestBenchElement) getDriver()
+ .findElements(By.className("v-button")).get(0);
+
+ click(addTabButton);
+
+ click(5);
+ sendKeys(5, Keys.ARROW_RIGHT);
+ assertSheet(5);
+
+ sendKeys(6, Keys.SPACE);
+ assertSheet(6);
+
+ click(addTabButton);
+ click(addTabButton);
+ click(addTabButton);
+ click(addTabButton);
+ click(addTabButton);
+ click(addTabButton);
+
+ click(8);
+ compareScreen("click-tab-8");
+
+ sendKeys(8, Keys.ARROW_RIGHT);
+ sendKeys(9, Keys.SPACE);
+ click(9);
+ compareScreen("tab-9");
+
+ sendKeys(9, Keys.ARROW_RIGHT);
+ Thread.sleep(DELAY);
+
+ sendKeys(10, Keys.ARROW_RIGHT);
+
+ // Here PhantomJS used to fail. Or when accessing tab2. The fix was to
+ // call the elem.click(x, y) using the (x, y) position instead of the
+ // elem.click() without any arguments.
+ sendKeys(11, Keys.ARROW_RIGHT);
+
+ assertSheet(9);
+ sendKeys(12, Keys.SPACE);
+ assertSheet(12);
+ compareScreen("scrolled-right-to-tab-12");
+
+ click(5);
+
+ sendKeys(5, Keys.ARROW_LEFT);
+
+ // Here IE8 used to fail. A hidden <div> in IE8 would have the bounds of
+ // it's parent, and when trying to see in which direction to scroll
+ // (left or right) to make the key selected tab visible, the
+ // VTabSheet.scrollIntoView(Tab) used to check first whether the tab
+ // isClipped. On IE8 this will always return true for both hidden tabs
+ // on the left and clipped tabs on the right. So instead of going to
+ // left, it'll search all the way to the right.
+ sendKeys(3, Keys.ARROW_LEFT);
+ sendKeys(2, Keys.ARROW_LEFT);
+ assertSheet(5);
+
+ sendKeys(1, Keys.SPACE);
+ assertSheet(1);
+ compareScreen("scrolled-left-to-tab-1");
+ }
+
+ /*
+ * Press key on the element.
+ */
+ private void sendKeys(int tabIndex, Keys key) throws InterruptedException {
+ sendKeys(tab(tabIndex), key);
+ }
+
+ /*
+ * Press key on the element.
+ */
+ private void sendKeys(TestBenchElement element, Keys key)
+ throws InterruptedException {
+
+ element.sendKeys(key);
+ if (DELAY > 0) {
+ sleep(DELAY);
+ }
+ }
+
+ /*
+ * Click on the element.
+ */
+ private void click(int tabIndex) throws InterruptedException {
+ click(tab(tabIndex));
+ }
+
+ /*
+ * Click on the element.
+ */
+ private void click(TestBenchElement element) throws InterruptedException {
+
+ element.click(10, 10);
+ if (DELAY > 0) {
+ sleep(DELAY);
+ }
+ }
+
+ /*
+ * Delay for PhantomJS.
+ */
+ private final static int DELAY = 10;
+
+ private void assertSheet(int index) {
+ String labelCaption = "Tab " + index;
+
+ By id = By.id(TabKeyboardNavigation.labelID(index));
+ WebElement labelElement = getDriver().findElement(id);
+
+ waitForElementPresent(id);
+
+ Assert.assertEquals(labelCaption, labelCaption, labelElement.getText());
+ }
+
+ /*
+ * Provide the tab at specified index.
+ */
+ private TestBenchElement tab(int index) {
+ By by = By.className("v-tabsheet-tabitemcell");
+
+ TestBenchElement element = (TestBenchElement) getDriver().findElements(
+ by).get(index - 1);
+
+ String expected = "Tab " + index;
+ Assert.assertEquals(expected,
+ element.getText().substring(0, expected.length()));
+
+ return element;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScroll.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScroll.java
new file mode 100644
index 0000000000..3a5be51e47
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScroll.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.tabsheet;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ * If the space is pressed on the tabs of a tabsheet the browser default scroll
+ * behavior must be prevented.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TabSpaceNotScroll extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ TabSheet tabSheet = new TabSheet();
+
+ for (int i = 0; i < 5; i++) {
+ String caption = "Tab " + i;
+ Component c = new Label(caption);
+ tabSheet.addTab(c, caption);
+ }
+
+ addComponent(tabSheet);
+
+ Label dontShowThis = new Label("Page scroll. This is bad.");
+
+ VerticalLayout panel = new VerticalLayout();
+ panel.setHeight("2000px");
+ panel.addComponent(dontShowThis);
+ panel.setComponentAlignment(dontShowThis, Alignment.MIDDLE_CENTER);
+
+ addComponent(panel);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Pressing space on the tab should not scroll.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14320;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScrollTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScrollTest.java
new file mode 100644
index 0000000000..c35248c1f4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSpaceNotScrollTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.tabsheet;
+
+import java.io.IOException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.Point;
+
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Test if the page scroll when press space on a tabsheet's tab.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TabSpaceNotScrollTest extends MultiBrowserTest {
+
+ @Test
+ public void testScroll() throws InterruptedException, IOException {
+ openTestURL();
+
+ TestBenchElement tab = (TestBenchElement) getDriver().findElement(
+ By.className("v-tabsheet-tabitemcell"));
+ tab.click(10, 10);
+
+ Point oldLocation = tab.getLocation();
+
+ tab.sendKeys(Keys.SPACE);
+
+ Point newLocation = tab.getLocation();
+
+ Assert.assertEquals(oldLocation, newLocation);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0.html b/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0.html
deleted file mode 100644
index 34ab0c0c2e..0000000000
--- a/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="" />
-<title>DisappearingComponents</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">DisappearingComponents</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.treetable.TreeTablePartialUpdatesPageLength0?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdatesPageLength0::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>10,2</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>root1-expanded-10-items</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdatesPageLength0::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[12]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>11,3</td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdatesPageLength0::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[11]/domChild[0]/domChild[0]/domChild[0]</td>
- <td>9,7</td>
-</tr>
-<tr>
- <td>scroll</td>
- <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdatesPageLength0::</td>
- <td>12500</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>300</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>all-expanded-bottom</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0.java
index 20412bf0e2..686d86a0dc 100644
--- a/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0.java
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0.java
@@ -2,13 +2,14 @@ package com.vaadin.tests.components.treetable;
import com.vaadin.data.Container.Hierarchical;
import com.vaadin.data.util.HierarchicalContainer;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.TreeTable;
-public class TreeTablePartialUpdatesPageLength0 extends TestBase {
+public class TreeTablePartialUpdatesPageLength0 extends AbstractTestUI {
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
setTheme("reindeer-tests");
TreeTable tt = new TreeTable();
tt.addStyleName("table-equal-rowheight");
@@ -20,6 +21,7 @@ public class TreeTablePartialUpdatesPageLength0 extends TestBase {
tt.getParent().getParent().setHeight(null);
}
+ @SuppressWarnings("unchecked")
private Hierarchical makeHierarchicalContainer() {
HierarchicalContainer hc = new HierarchicalContainer();
hc.addContainerProperty("p1", String.class, "");
@@ -47,6 +49,7 @@ public class TreeTablePartialUpdatesPageLength0 extends TestBase {
return hc;
}
+ @SuppressWarnings("unchecked")
private void addNodesToRoot(HierarchicalContainer hc, Object root, int count) {
for (int ix = 0; ix < count; ix++) {
Object id = hc.addItem();
@@ -56,7 +59,7 @@ public class TreeTablePartialUpdatesPageLength0 extends TestBase {
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "";
}
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0Test.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0Test.java
new file mode 100644
index 0000000000..d88c6ba7ca
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0Test.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.treetable;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.TreeTableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests expanding TreeTable rows when page length is zero.
+ *
+ * @author Vaadin Ltd
+ */
+public class TreeTablePartialUpdatesPageLength0Test extends MultiBrowserTest {
+
+ @Test
+ public void testExpanding() throws IOException {
+ openTestURL();
+
+ TreeTableElement treeTable = $(TreeTableElement.class).first();
+ List<WebElement> rows = treeTable.findElement(
+ By.className("v-table-body")).findElements(By.tagName("tr"));
+ assertEquals("unexpected row count", 4, rows.size());
+ assertEquals("unexpected contents", "root1", treeTable.getCell(0, 0)
+ .getText());
+ assertEquals("unexpected contents", "root2", treeTable.getCell(1, 0)
+ .getText());
+ assertEquals("unexpected contents", "root3", treeTable.getCell(2, 0)
+ .getText());
+ assertEquals("unexpected contents", "END", treeTable.getCell(3, 0)
+ .getText());
+
+ // expand first row, should have 10 children
+ treeTable.getCell(0, 0)
+ .findElement(By.className("v-treetable-treespacer")).click();
+
+ treeTable = $(TreeTableElement.class).first();
+ rows = treeTable.findElement(By.className("v-table-body"))
+ .findElements(By.tagName("tr"));
+ assertEquals("unexpected row count", 14, rows.size());
+
+ // expand root3, should have 200 children
+ assertEquals("unexpected contents", "root3", treeTable.getCell(12, 0)
+ .getText());
+ treeTable.getCell(12, 0)
+ .findElement(By.className("v-treetable-treespacer")).click();
+
+ // expand root2, should have 200 children
+ assertEquals("unexpected contents", "root2", treeTable.getCell(11, 0)
+ .getText());
+ treeTable.getCell(11, 0)
+ .findElement(By.className("v-treetable-treespacer")).click();
+
+ treeTable = $(TreeTableElement.class).first();
+ rows = treeTable.findElement(By.className("v-table-body"))
+ .findElements(By.tagName("tr"));
+ assertEquals("unexpected row count", 414, rows.size());
+
+ // scroll all the way to the bottom
+ WebElement ui = findElement(By.className("v-ui"));
+ testBenchElement(ui).scroll(12500);
+
+ compareScreen("bottom");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java b/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java
index e65a24e907..627efdc5b3 100644
--- a/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java
+++ b/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java
@@ -35,8 +35,6 @@ public class ComboboxScrollableWindowTest extends MultiBrowserTest {
@Test
public void testWindowScrollbars() throws Exception {
openTestURL();
- com.vaadin.testbench.Parameters
- .setScreenshotComparisonCursorDetection(true);
WebElement window = driver.findElement(By.id(WINDOW_ID));
WebElement scrollableElement = window.findElement(By
diff --git a/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAria.html b/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAria.html
deleted file mode 100644
index f5f89d13ef..0000000000
--- a/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAria.html
+++ /dev/null
@@ -1,136 +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>ExtraWindowShownWaiAria</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">ExtraWindowShownWaiAria</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.window.ExtraWindowShownWaiAria?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPresent</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/</td>
- <td></td>
-</tr>
-<tr>
- <td>assertAttribute</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/@role</td>
- <td>dialog</td>
-</tr>
-<tr>
- <td>storeAttribute</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]@id</td>
- <td>headerid</td>
-</tr>
-<tr>
- <td>assertAttribute</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/@aria-labelledby</td>
- <td>${headerid}</td>
-</tr>
-<tr>
- <td>storeAttribute</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/FocusableScrollPanel[0]/VCssLayout[0]/VLabel[0]@id</td>
- <td>descriptionid</td>
-</tr>
-<tr>
- <td>assertAttribute</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/@aria-describedby</td>
- <td>${descriptionid}</td>
-</tr>
-<tr>
- <td>assertAttribute</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]@role</td>
- <td>button</td>
-</tr>
-<tr>
- <td>assertAttribute</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]@role</td>
- <td>button</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/FocusableScrollPanel[0]/VCssLayout[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VCheckBox[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>storeAttribute</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/FocusableScrollPanel[0]/VCssLayout[0]/VLabel[0]@id</td>
- <td>descriptionid</td>
-</tr>
-<tr>
- <td>storeAttribute</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/FocusableScrollPanel[0]/VCssLayout[0]/VLabel[1]@id</td>
- <td>description2id</td>
-</tr>
-<tr>
- <td>assertAttribute</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/@aria-describedby</td>
- <td>${descriptionid} ${description2id}</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/FocusableScrollPanel[0]/VCssLayout[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VWindow[0]/</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[6]/VTextField[0]</td>
- <td>Important</td>
-</tr>
-<tr>
- <td>type</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[7]/VTextField[0]</td>
- <td> - do ASAP</td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentswindowExtraWindowShownWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>xpath=//div[@class='v-window-header']/span[@class='v-assistive-device-only'][1]</td>
- <td>Important</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>xpath=//div[@class='v-window-header']/span[@class='v-assistive-device-only'][2]</td>
- <td>- do ASAP</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAriaTest.java b/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAriaTest.java
new file mode 100644
index 0000000000..44aea3522a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAriaTest.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.window;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.CheckBoxElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.testbench.elements.WindowElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests dialogs with WAI-ARIA.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class ExtraWindowShownWaiAriaTest extends MultiBrowserTest {
+
+ @Test
+ public void testDialogs() throws InterruptedException {
+ openTestURL();
+
+ List<ButtonElement> buttons = $(ButtonElement.class).all();
+ assertFalse(buttons.isEmpty());
+
+ // open alert dialog
+ buttons.get(0).click();
+
+ // ensure dialog opened
+ List<WindowElement> windows = $(WindowElement.class).all();
+ assertFalse(windows.isEmpty());
+
+ // ensure correct attributes
+ assertEquals("alertdialog", windows.get(0).getAttribute("role"));
+
+ WebElement header = windows.get(0).findElement(
+ By.className("v-window-header"));
+ assertEquals(header.getAttribute("id"),
+ windows.get(0).getAttribute("aria-labelledby"));
+
+ WebElement label = windows.get(0).findElement(By.className("v-label"));
+ assertEquals(label.getAttribute("id"),
+ windows.get(0).getAttribute("aria-describedby"));
+
+ List<WebElement> wButtons = windows.get(0).findElements(
+ By.className("v-button"));
+ assertEquals("button", wButtons.get(0).getAttribute("role"));
+ assertEquals("button", wButtons.get(1).getAttribute("role"));
+
+ // close dialog
+ wButtons.get(0).click();
+
+ // ensure dialog closed
+ windows = $(WindowElement.class).all();
+ assertTrue(windows.isEmpty());
+
+ // check additional description (second checkbox on the page)
+ List<CheckBoxElement> checkBoxes = $(CheckBoxElement.class).all();
+ WebElement input = checkBoxes.get(1).findElement(By.tagName("input"));
+ // ensure that not checked yet
+ assertEquals(null, input.getAttribute("checked"));
+ input.click();
+ // ensure that checked now
+ assertEquals("true", input.getAttribute("checked"));
+
+ // open alert dialog
+ buttons = $(ButtonElement.class).all();
+ buttons.get(0).click();
+
+ // ensure correct attributes
+ windows = $(WindowElement.class).all();
+ List<WebElement> labels = windows.get(0).findElements(
+ By.className("v-label"));
+ assertEquals(labels.get(0).getAttribute("id") + " "
+ + labels.get(1).getAttribute("id"), windows.get(0)
+ .getAttribute("aria-describedby"));
+
+ // close dialog
+ wButtons = windows.get(0).findElements(By.className("v-button"));
+ wButtons.get(0).click();
+
+ // ensure dialog closed
+ windows = $(WindowElement.class).all();
+ assertTrue(windows.isEmpty());
+
+ // add prefix and postfix
+ List<TextFieldElement> textFields = $(TextFieldElement.class).all();
+ textFields.get(0).sendKeys("Important");
+ textFields.get(1).sendKeys(" - do ASAP");
+
+ // open alert dialog
+ buttons = $(ButtonElement.class).all();
+ buttons.get(0).click();
+
+ // ensure the assistive spans have been added to the header
+ windows = $(WindowElement.class).all();
+ header = windows.get(0).findElement(By.className("v-window-header"));
+ List<WebElement> assistiveElements = header.findElements(By
+ .className("v-assistive-device-only"));
+ assertEquals("Important",
+ assistiveElements.get(0).getAttribute("innerHTML"));
+ assertEquals(" - do ASAP",
+ assistiveElements.get(1).getAttribute("innerHTML"));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html
deleted file mode 100644
index f926696d63..0000000000
--- a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="" />
-<title>TestTooSmallSubwindowSize</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">TestTooSmallSubwindowSize</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.window.TestTooSmallSubwindowSize</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
index 46845748a3..669774f715 100644
--- a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
+++ b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
@@ -1,15 +1,22 @@
package com.vaadin.tests.components.window;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
-public class TestTooSmallSubwindowSize extends TestBase {
+/**
+ * Tests that the styles work correctly in tiny subwindows that have more
+ * content than can fit.
+ *
+ * @author Vaadin Ltd
+ */
+public class TestTooSmallSubwindowSize extends AbstractTestUI {
@Override
- protected String getDescription() {
- return "The size of the subwindow (outer size) is set to 60x60 pixels. Minimum size for the content area is 150x100, which means the window and shadow should be around 155x155 and the content area 150x100. The decoration at the lower left corner of the window must not be missing either.";
+ protected String getTestDescription() {
+ return "The size of the subwindows (outer size) is set to 60x60 pixels. Make sure the shadows fits the windows instead of the contents. The decorations at the lower right corners of the resizable windows must not be missing either.";
}
@Override
@@ -18,7 +25,14 @@ public class TestTooSmallSubwindowSize extends TestBase {
}
@Override
- protected void setup() {
+ protected void setup(VaadinRequest request) {
+ getUI().addWindow(createNonResizableWindow());
+ getUI().addWindow(createNonResizableWindowWithHorizontalScrollbar());
+ getUI().addWindow(createResizableWindow());
+ getUI().addWindow(createResizableWindowWithHorizontalScrollbar());
+ }
+
+ private Window createNonResizableWindow() {
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
Window w = new Window("Scroll", layout);
@@ -35,13 +49,94 @@ public class TestTooSmallSubwindowSize extends TestBase {
w.setPositionY(100);
// Set window size
- w.setWidth(60, Window.UNITS_PIXELS);
- w.setHeight(60, Window.UNITS_PIXELS);
+ w.setWidth(60, Unit.PIXELS);
+ w.setHeight(60, Unit.PIXELS);
+
+ // Disable resizing
+ w.setResizable(false);
+
+ return w;
+ }
+
+ private Window createNonResizableWindowWithHorizontalScrollbar() {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("Scroll", layout);
+ Label desc = new Label(
+ "This is a new child window with a preset"
+ + " width, height and position. Resizing has been"
+ + " disabled for this window. Additionally, this text label"
+ + " is intentionally too large to fit the window. You could"
+ + " use the scrollbars to view different parts of the window content,"
+ + " except it's too small for that either.");
+ // disable wrapping
+ desc.setSizeUndefined();
+ layout.addComponent(desc);
+
+ // Set window position
+ w.setPositionX(200);
+ w.setPositionY(100);
+
+ // Set window size
+ w.setWidth(60, Unit.PIXELS);
+ w.setHeight(60, Unit.PIXELS);
// Disable resizing
- w.setResizable(true);
+ w.setResizable(false);
+
+ return w;
+ }
+
+ private Window createResizableWindow() {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("Resize", layout);
+ Label desc = new Label(
+ "This is a new child window with a preset"
+ + " width, height and position. Resizing has not been"
+ + " disabled for this window. Additionally, this text label"
+ + " is intentionally too large to fit the window. You can resize or"
+ + " use the scrollbars to view different parts of the window content.");
+ layout.addComponent(desc);
+
+ // Set window position
+ w.setPositionX(300);
+ w.setPositionY(100);
+
+ // Set window size
+ w.setWidth(60, Unit.PIXELS);
+ w.setHeight(60, Unit.PIXELS);
+
+ // Don't disable resizing
+
+ return w;
+ }
+
+ private Window createResizableWindowWithHorizontalScrollbar() {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("Resize", layout);
+ Label desc = new Label(
+ "This is a new child window with a preset"
+ + " width, height and position. Resizing has not been"
+ + " disabled for this window. Additionally, this text label"
+ + " is intentionally too large to fit the window. You can resize"
+ + " to view different parts of the window content.");
+ // disable wrapping
+ desc.setSizeUndefined();
+ layout.addComponent(desc);
+
+ // Set window position
+ w.setPositionX(400);
+ w.setPositionY(100);
+
+ // Set window size
+ w.setWidth(60, Unit.PIXELS);
+ w.setHeight(60, Unit.PIXELS);
+
+ // Don't disable resizing
- getMainWindow().addWindow(w);
+ return w;
}
}
diff --git a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSizeTest.java b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSizeTest.java
new file mode 100644
index 0000000000..0019900884
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSizeTest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.window;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that the styles work correctly in tiny subwindows that have more
+ * content than can fit.
+ *
+ * @author Vaadin Ltd
+ */
+public class TestTooSmallSubwindowSizeTest extends MultiBrowserTest {
+
+ @Test
+ public void testSubwindowStyles() throws IOException {
+ openTestURL();
+
+ compareScreen("initial");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index e463f666d9..b892fbe4a0 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -18,14 +18,25 @@ package com.vaadin.tests.tb3;
import static com.vaadin.tests.tb3.TB3Runner.localWebDriverIsUsed;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import java.lang.reflect.Field;
import java.net.URL;
import java.util.Collections;
import java.util.List;
+import org.apache.commons.io.IOUtils;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpResponse;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicHttpEntityEnclosingRequest;
+import org.json.JSONException;
+import org.json.JSONObject;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
@@ -42,6 +53,7 @@ import org.openqa.selenium.interactions.internal.Coordinates;
import org.openqa.selenium.internal.Locatable;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.HttpCommandExecutor;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
@@ -51,6 +63,7 @@ import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
import com.vaadin.server.LegacyApplication;
import com.vaadin.server.UIProvider;
import com.vaadin.testbench.TestBench;
+import com.vaadin.testbench.TestBenchDriverProxy;
import com.vaadin.testbench.TestBenchElement;
import com.vaadin.testbench.TestBenchTestCase;
import com.vaadin.tests.components.AbstractTestUIWithLog;
@@ -102,6 +115,11 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
desiredCapabilities = Browser.FIREFOX.getDesiredCapabilities();
}
+ static {
+ com.vaadin.testbench.Parameters
+ .setScreenshotComparisonCursorDetection(true);
+ }
+
/**
* Connect to the hub using a remote web driver, set the canvas size and
* opens the initial URL as specified by {@link #getTestUrl()}
@@ -233,6 +251,15 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
*/
private void setupRemoteDriver(DesiredCapabilities capabilities)
throws Exception {
+ if (BrowserUtil.isIE(capabilities)) {
+ capabilities.setCapability(
+ InternetExplorerDriver.REQUIRE_WINDOW_FOCUS,
+ requireWindowFocusForIE());
+ capabilities.setCapability(
+ InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING,
+ usePersistentHoverForIE());
+ }
+
for (int i = 1; i <= BROWSER_INIT_ATTEMPTS; i++) {
try {
WebDriver dr = TestBench.createDriver(new RemoteWebDriver(
@@ -1128,4 +1155,93 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
return findElement(By.xpath("//button[@title='Debug message log']"));
}
+ /**
+ * Should the "require window focus" be enabled for Internet Explorer.
+ * RequireWindowFocus makes tests more stable but seems to be broken with
+ * certain commands such as sendKeys. Therefore it is not enabled by default
+ * for all tests
+ *
+ * @return true, to use the "require window focus" feature, false otherwise
+ */
+ protected boolean requireWindowFocusForIE() {
+ return false;
+ }
+
+ /**
+ * Should the "enable persistent hover" be enabled for Internet Explorer.
+ *
+ * Persistent hovering causes continuous firing of mouse over events at the
+ * last location the mouse cursor has been moved to. This is to avoid
+ * problems where the real mouse cursor is inside the browser window and
+ * Internet Explorer uses that location for some undefined operation
+ * (http://
+ * jimevansmusic.blogspot.fi/2012/06/whats-wrong-with-internet-explorer
+ * .html)
+ *
+ * @return true, to use the "persistent hover" feature, false otherwise
+ */
+ protected boolean usePersistentHoverForIE() {
+ return true;
+ }
+
+ // FIXME: Remove this once TB4 getRemoteControlName works properly
+ private RemoteWebDriver getRemoteDriver() {
+ WebDriver d = getDriver();
+ if (d instanceof TestBenchDriverProxy) {
+ try {
+ Field f = TestBenchDriverProxy.class
+ .getDeclaredField("actualDriver");
+ f.setAccessible(true);
+ return (RemoteWebDriver) f.get(d);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ if (d instanceof RemoteWebDriver) {
+ return (RemoteWebDriver) d;
+ }
+
+ return null;
+
+ }
+
+ // FIXME: Remove this once TB4 getRemoteControlName works properly
+ protected String getRemoteControlName() {
+ try {
+ RemoteWebDriver d = getRemoteDriver();
+ if (d == null) {
+ return null;
+ }
+ HttpCommandExecutor ce = (HttpCommandExecutor) d
+ .getCommandExecutor();
+ String hostName = ce.getAddressOfRemoteServer().getHost();
+ int port = ce.getAddressOfRemoteServer().getPort();
+ HttpHost host = new HttpHost(hostName, port);
+ DefaultHttpClient client = new DefaultHttpClient();
+ URL sessionURL = new URL("http://" + hostName + ":" + port
+ + "/grid/api/testsession?session=" + d.getSessionId());
+ BasicHttpEntityEnclosingRequest r = new BasicHttpEntityEnclosingRequest(
+ "POST", sessionURL.toExternalForm());
+ HttpResponse response = client.execute(host, r);
+ JSONObject object = extractObject(response);
+ URL myURL = new URL(object.getString("proxyId"));
+ if ((myURL.getHost() != null) && (myURL.getPort() != -1)) {
+ return myURL.getHost();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ private static JSONObject extractObject(HttpResponse resp)
+ throws IOException, JSONException {
+ InputStream contents = resp.getEntity().getContent();
+ StringWriter writer = new StringWriter();
+ IOUtils.copy(contents, writer, "UTF8");
+ JSONObject objToReturn = new JSONObject(writer.toString());
+ return objToReturn;
+ }
+
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java b/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java
index 758d2de200..e66cd2668b 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java
@@ -136,6 +136,14 @@ public class ButtonsAndLinks extends VerticalLayout implements View {
button = new Button("Three");
group.addComponent(button);
+ button = new Button("Tiny");
+ button.addStyleName("tiny");
+ row.addComponent(button);
+
+ button = new Button("Huge");
+ button.addStyleName("huge");
+ row.addComponent(button);
+
NativeButton nbutton = new NativeButton("Native");
row.addComponent(nbutton);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java b/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java
index 17dfd6cb67..280ddf98b7 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java
@@ -4,7 +4,6 @@ import java.text.DateFormatSymbols;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
-import java.util.Map;
import java.util.TimeZone;
import com.vaadin.annotations.Theme;
@@ -51,6 +50,7 @@ import com.vaadin.ui.components.calendar.event.BasicEventProvider;
import com.vaadin.ui.components.calendar.event.CalendarEvent;
import com.vaadin.ui.components.calendar.handler.BasicDateClickHandler;
import com.vaadin.ui.components.calendar.handler.BasicWeekClickHandler;
+import com.vaadin.ui.themes.ValoTheme;
/** Calendar component test application */
@Theme("valo-test")
@@ -108,7 +108,7 @@ public class CalendarTest extends GridLayout implements View {
private Button applyEventButton;
- private Mode viewMode = Mode.MONTH;
+ private Mode viewMode = Mode.WEEK;
private BasicEventProvider dataSource;
@@ -152,52 +152,11 @@ public class CalendarTest extends GridLayout implements View {
setSpacing(true);
// handleURLParams(request.getParameterMap());
+ testBench = ValoThemeUI.isTestMode();
initContent();
}
- private void handleURLParams(Map<String, String[]> parameters) {
- testBench = parameters.containsKey("testBench")
- || parameters.containsKey("?testBench");
-
- if (parameters.containsKey("width")) {
- calendarWidth = parameters.get("width")[0];
- }
-
- if (parameters.containsKey("height")) {
- calendarHeight = parameters.get("height")[0];
- }
-
- if (parameters.containsKey("firstDay")) {
- firstDay = Integer.parseInt(parameters.get("firstDay")[0]);
- }
-
- if (parameters.containsKey("lastDay")) {
- lastDay = Integer.parseInt(parameters.get("lastDay")[0]);
- }
-
- if (parameters.containsKey("firstHour")) {
- firstHour = Integer.parseInt(parameters.get("firstHour")[0]);
- }
-
- if (parameters.containsKey("lastHour")) {
- lastHour = Integer.parseInt(parameters.get("lastHour")[0]);
- }
-
- if (parameters.containsKey("locale")) {
- String localeArray[] = parameters.get("locale")[0].split("_");
- defaultLocale = new Locale(localeArray[0], localeArray[1]);
- setLocale(defaultLocale);
- }
-
- if (parameters.containsKey(("secondsResolution"))) {
- useSecondResolution = true;
- }
-
- showWeeklyView = parameters.containsKey("weekly");
-
- }
-
public void initContent() {
// Set default Locale for this application
if (testBench) {
@@ -365,6 +324,9 @@ public class CalendarTest extends GridLayout implements View {
Alignment.MIDDLE_LEFT);
controlPanel.setComponentAlignment(addNewEvent, Alignment.MIDDLE_LEFT);
+ Label viewCaption = new Label("Calendar");
+ viewCaption.setStyleName(ValoTheme.LABEL_H1);
+ addComponent(viewCaption);
addComponent(controlPanel);
addComponent(hl);
addComponent(calendarComponent);
@@ -645,6 +607,11 @@ public class CalendarTest extends GridLayout implements View {
calendar.setTime(today);
calendarComponent.getInternalCalendar().setTime(today);
+ // Calendar getStartDate (and getEndDate) has some strange logic which
+ // returns Monday of the current internal time if no start date has been
+ // set
+ calendarComponent.setStartDate(calendarComponent.getStartDate());
+ calendarComponent.setEndDate(calendarComponent.getEndDate());
int rollAmount = calendar.get(GregorianCalendar.DAY_OF_MONTH) - 1;
calendar.add(GregorianCalendar.DAY_OF_MONTH, -rollAmount);
currentMonthsFirstDate = calendar.getTime();
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java
index 1b8b290d91..98a9cad83c 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java
@@ -162,6 +162,22 @@ public class ComboBoxes extends VerticalLayout implements View {
combo.addItem("Option Three");
combo.addStyleName("borderless");
row.addComponent(combo);
+
+ combo = new ComboBox("Tiny");
+ combo.setInputPrompt("You can type here");
+ combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
+ combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
+ combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
+ combo.addStyleName("tiny");
+ row.addComponent(combo);
+
+ combo = new ComboBox("Huge");
+ combo.setInputPrompt("You can type here");
+ combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
+ combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
+ combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
+ combo.addStyleName("huge");
+ row.addComponent(combo);
}
@Override
diff --git a/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java b/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
index cd378c3754..52cc43ac28 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
@@ -131,9 +131,11 @@ public class CommonParts extends VerticalLayout implements View {
spinnerDesc.setCaption("Spinner");
content.addComponent(spinnerDesc);
- Label spinner = new Label();
- spinner.addStyleName("spinner");
- content.addComponent(spinner);
+ if (!ValoThemeUI.isTestMode()) {
+ Label spinner = new Label();
+ spinner.addStyleName("spinner");
+ content.addComponent(spinner);
+ }
return p;
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java
index ae520e07c2..7738b2d6db 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java
@@ -46,16 +46,16 @@ public class DateFields extends VerticalLayout implements View {
addComponent(row);
DateField date = new DateField("Default resolution");
- date.setValue(new Date());
+ setDate(date);
row.addComponent(date);
date = new DateField("Error");
- date.setValue(new Date());
+ setDate(date);
date.setComponentError(new UserError("Fix it, now!"));
row.addComponent(date);
date = new DateField("Error, borderless");
- date.setValue(new Date());
+ setDate(date);
date.setComponentError(new UserError("Fix it, now!"));
date.addStyleName("borderless");
row.addComponent(date);
@@ -77,110 +77,132 @@ public class DateFields extends VerticalLayout implements View {
group.addComponent(today);
date = new DateField("Default resolution, explicit size");
- date.setValue(new Date());
+ setDate(date);
row.addComponent(date);
date.setWidth("260px");
date.setHeight("60px");
date = new DateField("Second resolution");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.SECOND);
row.addComponent(date);
date = new DateField("Minute resolution");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.MINUTE);
row.addComponent(date);
date = new DateField("Hour resolution");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.HOUR);
row.addComponent(date);
date = new DateField("Disabled");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.HOUR);
date.setEnabled(false);
row.addComponent(date);
date = new DateField("Day resolution");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
row.addComponent(date);
date = new DateField("Month resolution");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.MONTH);
row.addComponent(date);
date = new DateField("Year resolution");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.YEAR);
row.addComponent(date);
date = new DateField("Custom color");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.addStyleName("color1");
row.addComponent(date);
date = new DateField("Custom color");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.addStyleName("color2");
row.addComponent(date);
date = new DateField("Custom color");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.addStyleName("color3");
row.addComponent(date);
date = new DateField("Small");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.addStyleName("small");
row.addComponent(date);
date = new DateField("Large");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.addStyleName("large");
row.addComponent(date);
date = new DateField("Borderless");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.addStyleName("borderless");
row.addComponent(date);
date = new DateField("Week numbers");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.DAY);
date.setLocale(new Locale("fi", "fi"));
date.setShowISOWeekNumbers(true);
row.addComponent(date);
date = new DateField("US locale");
- date.setValue(new Date());
+ setDate(date);
date.setResolution(Resolution.SECOND);
date.setLocale(new Locale("en", "US"));
row.addComponent(date);
date = new DateField("Custom format");
- date.setValue(new Date());
+ setDate(date);
date.setDateFormat("E dd/MM/yyyy");
row.addComponent(date);
+ date = new DateField("Tiny");
+ setDate(date);
+ date.setResolution(Resolution.DAY);
+ date.addStyleName("tiny");
+ row.addComponent(date);
+
+ date = new DateField("Huge");
+ setDate(date);
+ date.setResolution(Resolution.DAY);
+ date.addStyleName("huge");
+ row.addComponent(date);
+
date = new InlineDateField("Date picker");
+ setDate(date);
row.addComponent(date);
date = new InlineDateField("Date picker with week numbers");
+ setDate(date);
date.setLocale(new Locale("fi", "fi"));
date.setShowISOWeekNumbers(true);
row.addComponent(date);
}
+ private void setDate(DateField date) {
+ if (ValoThemeUI.isTestMode()) {
+ date.setValue(new Date(2014 - 1900, 5, 7));
+ } else {
+ date.setValue(new Date());
+ }
+ }
+
@Override
public void enter(ViewChangeEvent event) {
// TODO Auto-generated method stub
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Forms.java b/uitest/src/com/vaadin/tests/themes/valo/Forms.java
index 6f1b8bbf7a..90a6c51496 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Forms.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Forms.java
@@ -47,7 +47,7 @@ public class Forms extends VerticalLayout implements View {
setSpacing(true);
setMargin(true);
- Label title = new Label("Form");
+ Label title = new Label("Forms");
title.addStyleName("h1");
addComponent(title);
@@ -59,6 +59,7 @@ public class Forms extends VerticalLayout implements View {
Label section = new Label("Personal Info");
section.addStyleName("h2");
+ section.addStyleName("colored");
form.addComponent(section);
StringGenerator sg = new StringGenerator();
@@ -85,6 +86,7 @@ public class Forms extends VerticalLayout implements View {
section = new Label("Contact Info");
section.addStyleName("h3");
+ section.addStyleName("colored");
form.addComponent(section);
TextField email = new TextField("Email");
@@ -125,6 +127,7 @@ public class Forms extends VerticalLayout implements View {
section = new Label("Additional Info");
section.addStyleName("h4");
+ section.addStyleName("colored");
form.addComponent(section);
TextField website = new TextField("Website");
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Labels.java b/uitest/src/com/vaadin/tests/themes/valo/Labels.java
index 08378ad9e6..b5bab3a1d3 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Labels.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Labels.java
@@ -45,6 +45,10 @@ public class Labels extends VerticalLayout implements View {
left.setMargin(new MarginInfo(false, true, false, false));
split.addComponent(left);
+ Label huge = new Label("Huge type for display text.");
+ huge.addStyleName("huge");
+ left.addComponent(huge);
+
Label large = new Label(
"Large type for introductory text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
large.addStyleName("large");
@@ -68,6 +72,10 @@ public class Labels extends VerticalLayout implements View {
small.addStyleName("small");
left.addComponent(small);
+ Label tiny = new Label("Tiny type for minor text.");
+ tiny.addStyleName("tiny");
+ left.addComponent(tiny);
+
Label h4 = new Label("Section Title");
h4.addStyleName("h4");
left.addComponent(h4);
@@ -94,6 +102,11 @@ public class Labels extends VerticalLayout implements View {
label.addStyleName("light");
right.addComponent(label);
+ label = new Label(
+ "Colored type for highlighted text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
+ label.addStyleName("colored");
+ right.addComponent(label);
+
label = new Label("A label for success");
label.addStyleName("success");
right.addComponent(label);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java b/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java
index 88eea73513..4a0130931e 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java
@@ -18,6 +18,7 @@ package com.vaadin.tests.themes.valo;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.server.FontAwesome;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.MenuBar;
import com.vaadin.ui.MenuBar.Command;
@@ -53,6 +54,62 @@ public class MenuBars extends VerticalLayout implements View {
menuBar.addStyleName("borderless");
menuBar.addStyleName("small");
addComponent(menuBar);
+
+ Label h2 = new Label("Drop Down Button");
+ h2.addStyleName("h2");
+ addComponent(h2);
+
+ HorizontalLayout wrap = new HorizontalLayout();
+ wrap.addStyleName("wrapping");
+ wrap.setSpacing(true);
+ addComponent(wrap);
+
+ wrap.addComponent(getMenuButton("Normal", false));
+
+ MenuBar split = getMenuButton("Small", false);
+ split.addStyleName("small");
+ wrap.addComponent(split);
+
+ split = getMenuButton("Borderless", false);
+ split.addStyleName("borderless");
+ wrap.addComponent(split);
+
+ split = getMenuButton("Themed", false);
+ split.addStyleName("color1");
+ wrap.addComponent(split);
+
+ split = getMenuButton("Small", false);
+ split.addStyleName("color1");
+ split.addStyleName("small");
+ wrap.addComponent(split);
+
+ h2 = new Label("Split Button");
+ h2.addStyleName("h2");
+ addComponent(h2);
+
+ wrap = new HorizontalLayout();
+ wrap.addStyleName("wrapping");
+ wrap.setSpacing(true);
+ addComponent(wrap);
+
+ wrap.addComponent(getMenuButton("Normal", true));
+
+ split = getMenuButton("Small", true);
+ split.addStyleName("small");
+ wrap.addComponent(split);
+
+ split = getMenuButton("Borderless", true);
+ split.addStyleName("borderless");
+ wrap.addComponent(split);
+
+ split = getMenuButton("Themed", true);
+ split.addStyleName("color1");
+ wrap.addComponent(split);
+
+ split = getMenuButton("Small", true);
+ split.addStyleName("color1");
+ split.addStyleName("small");
+ wrap.addComponent(split);
}
static MenuBar getMenuBar() {
@@ -180,6 +237,20 @@ public class MenuBars extends VerticalLayout implements View {
return menubar;
}
+ static MenuBar getMenuButton(String caption, boolean splitButton) {
+ MenuBar split = new MenuBar();
+ MenuBar.MenuItem dropdown = split.addItem(caption, null);
+ if (splitButton) {
+ dropdown = split.addItem("", null);
+ }
+ dropdown.addItem("Another Action", null);
+ dropdown.addItem("Secondary Action", null);
+ dropdown.addSeparator();
+ dropdown.addItem("Last Action", null);
+
+ return split;
+ }
+
@Override
public void enter(ViewChangeEvent event) {
// TODO Auto-generated method stub
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Sliders.java b/uitest/src/com/vaadin/tests/themes/valo/Sliders.java
index 363c698c32..8ed846e39f 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Sliders.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Sliders.java
@@ -158,11 +158,12 @@ public class Sliders extends VerticalLayout implements View {
// pb2.setValue(0.6f);
row.addComponent(pb2);
- ProgressBar pb3 = new ProgressBar();
- pb3.setIndeterminate(true);
- pb3.setCaption("Indeterminate");
- row.addComponent(pb3);
-
+ if (!ValoThemeUI.isTestMode()) {
+ ProgressBar pb3 = new ProgressBar();
+ pb3.setIndeterminate(true);
+ pb3.setCaption("Indeterminate");
+ row.addComponent(pb3);
+ }
}
float progress = 0;
@@ -196,14 +197,21 @@ public class Sliders extends VerticalLayout implements View {
@Override
public void enter(ViewChangeEvent event) {
- getUI().setPollInterval(1000);
- update.start();
+ if (!ValoThemeUI.isTestMode()) {
+ getUI().setPollInterval(1000);
+ update.start();
+ } else {
+ pb.setValue(0.3f);
+ pb2.setValue(0.6f);
+ }
}
@Override
public void detach() {
- getUI().setPollInterval(-1);
- update.interrupt();
+ if (!ValoThemeUI.isTestMode()) {
+ getUI().setPollInterval(-1);
+ update.interrupt();
+ }
super.detach();
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
index f8606bb7c9..347a683673 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
@@ -182,6 +182,16 @@ public class TextFields extends VerticalLayout implements View {
pwf.setIcon(FontAwesome.LOCK);
row.addComponent(pwf);
+ tf = new TextField("Tiny");
+ tf.setValue("Field value");
+ tf.addStyleName("tiny");
+ row.addComponent(tf);
+
+ tf = new TextField("Huge");
+ tf.setValue("Field value");
+ tf.addStyleName("huge");
+ row.addComponent(tf);
+
h1 = new Label("Text Areas");
h1.addStyleName("h1");
addComponent(h1);
@@ -242,6 +252,16 @@ public class TextFields extends VerticalLayout implements View {
ta.setValue("Field value, spanning multiple lines of text");
row.addComponent(ta);
+ ta = new TextArea("Tiny");
+ ta.addStyleName("tiny");
+ ta.setInputPrompt("Write your comment…");
+ row.addComponent(ta);
+
+ ta = new TextArea("Huge");
+ ta.addStyleName("huge");
+ ta.setInputPrompt("Write your comment…");
+ row.addComponent(ta);
+
RichTextArea rta = new RichTextArea();
rta.setValue("<b>Some</b> <i>rich</i> content");
row.addComponent(rta);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
index 5f286989a0..501b5f573b 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
@@ -61,6 +61,8 @@ import com.vaadin.ui.themes.ValoTheme;
@PreserveOnRefresh
public class ValoThemeUI extends UI {
+ private boolean testMode = false;
+
private static LinkedHashMap<String, String> themeVariants = new LinkedHashMap<String, String>();
static {
themeVariants.put("tests-valo", "Default");
@@ -77,11 +79,17 @@ public class ValoThemeUI extends UI {
ComponentContainer viewDisplay = root.getContentContainer();
CssLayout menu = new CssLayout();
CssLayout menuItemsLayout = new CssLayout();
+ {
+ menu.setId("testMenu");
+ }
private Navigator navigator;
private LinkedHashMap<String, String> menuItems = new LinkedHashMap<String, String>();
@Override
protected void init(VaadinRequest request) {
+ if (request.getParameter("test") != null) {
+ testMode = true;
+ }
// Show .v-app-loading valo-menu-badge
// try {
// Thread.sleep(2000);
@@ -159,6 +167,10 @@ public class ValoThemeUI extends UI {
}
+ static boolean isTestMode() {
+ return ((ValoThemeUI) getCurrent()).testMode;
+ }
+
Component buildTestMenu() {
CssLayout menu = new CssLayout();
menu.addStyleName("large-icons");
@@ -398,7 +410,7 @@ public class ValoThemeUI extends UI {
// ((Hierarchical) container).setChildrenAllowed(id, false);
((Hierarchical) container).setParent(id, i);
- for (int k = 1; k < 5; k++) {
+ for (int k = 1; k < 6; k++) {
String id2 = id + " -> " + k;
child = container.addItem(id2);
child.getItemProperty(CAPTION_PROPERTY).setValue(
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java
new file mode 100644
index 0000000000..fdb2eabeee
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java
@@ -0,0 +1,239 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.themes.valo;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.CssLayoutElement;
+import com.vaadin.testbench.elements.LabelElement;
+import com.vaadin.testbench.elements.TreeElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class ValoThemeUITest extends MultiBrowserTest {
+
+ @Test
+ public void labels() throws Exception {
+ openTestURL("test");
+ open("Labels");
+ compareScreen("labels");
+ }
+
+ @Test
+ public void buttonsLinks() throws Exception {
+ openTestURL("test");
+ open("Buttons & Links", "Buttons");
+ compareScreen("buttonsLinks");
+ }
+
+ @Test
+ public void textFields() throws Exception {
+ openTestURL("test");
+ open("Text Fields <span class=\"valo-menu-badge\">123</span>",
+ "Text Fields");
+ compareScreen("textFields");
+ }
+
+ @Test
+ public void common() throws Exception {
+ openTestURL("test");
+ open("Common UI Elements");
+ compareScreen("common");
+ }
+
+ @Test
+ public void datefields() throws Exception {
+ openTestURL("test");
+ open("Date Fields");
+ // Note that this can look broken in IE9 because of some browser
+ // rendering issue... The problem seems to be in the customized
+ // horizontal layout in the test app
+ compareScreen("datefields");
+ }
+
+ @Test
+ public void comboboxes() throws Exception {
+ openTestURL("test");
+ open("Combo Boxes");
+ compareScreen("comboboxes");
+ }
+
+ @Test
+ public void selects() throws Exception {
+ openTestURL("test");
+ open("Selects");
+ compareScreen("selects");
+ }
+
+ @Test
+ public void checkboxes() throws Exception {
+ openTestURL("test");
+ open("Check Boxes & Option Groups", "Check Boxes");
+ compareScreen("checkboxes");
+ }
+
+ @Test
+ public void sliders() throws Exception {
+ openTestURL("test");
+ open("Sliders & Progress Bars", "Sliders");
+ compareScreen("sliders");
+ }
+
+ @Test
+ public void colorpickers() throws Exception {
+ openTestURL("test");
+ open("Color Pickers");
+ compareScreen("colorpickers");
+ }
+
+ @Test
+ public void menubars() throws Exception {
+ openTestURL("test");
+ open("Menu Bars");
+ compareScreen("menubars");
+ }
+
+ @Test
+ public void trees() throws Exception {
+ openTestURL("test");
+ open("Trees");
+ selectTreeNodeByCaption("Quid securi");
+ compareScreen("trees");
+ }
+
+ private void selectTreeNodeByCaption(String string) {
+ WebElement e = $(TreeElement.class).first().findElement(
+ By.xpath("//div[@class='v-tree-node-caption']//span[text()='"
+ + string + "']"));
+ e.click();
+ }
+
+ @Test
+ public void tables() throws Exception {
+ openTestURL("test");
+ open("Tables");
+ compareScreen("tables");
+ }
+
+ @Test
+ public void dragging() throws Exception {
+ openTestURL("test");
+ open("Drag and Drop", "Dragging Components");
+ compareScreen("dragging");
+ }
+
+ @Test
+ public void panels() throws Exception {
+ openTestURL("test");
+ open("Panels", "Panels & Layout panels");
+ compareScreen("panels");
+ }
+
+ @Test
+ public void splitpanels() throws Exception {
+ openTestURL("test");
+ open("Split Panels");
+ compareScreen("splitpanels");
+ }
+
+ @Test
+ public void tabs() throws Exception {
+ openTestURL("test");
+ open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
+ compareScreen("tabs");
+ }
+
+ @Test
+ public void accordions() throws Exception {
+ openTestURL("test");
+ open("Accordions");
+ compareScreen("accordions");
+ }
+
+ @Test
+ public void popupviews() throws Exception {
+ openTestURL("test");
+ open("Popup Views");
+ scrollTo(500, 0);
+ compareScreen("popupviews");
+ }
+
+ @Test
+ public void calendar() throws Exception {
+ openTestURL("test");
+ scrollTo(500, 0);
+ open("Calendar");
+
+ compareScreen("calendar");
+ }
+
+ @Test
+ public void forms() throws Exception {
+ openTestURL("test");
+ scrollTo(500, 0);
+ open("Forms");
+ compareScreen("forms");
+ }
+
+ private void open(String link) {
+ open(link, link);
+ }
+
+ private void open(String link, String caption) {
+ open(link, caption, 10);
+ }
+
+ // FIXME: Remove this once click works properly on IE...
+ private void open(String link, String caption, int tries) {
+ if (tries <= 0) {
+ throw new RuntimeException(
+ "Tried many times but was not able to click the link...");
+ }
+
+ $(ButtonElement.class).caption(link).first().click();
+ CssLayoutElement content = wrap(CssLayoutElement.class,
+ findElement(By.className("valo-content")));
+ LabelElement captionElem = content.$(LabelElement.class).first();
+ if (!captionElem.getText().equals(caption)) {
+ // IE ... why you fail clicks
+ System.err.println("Extra click needed on '" + link
+ + "' on remote " + getDesiredCapabilities() + " "
+ + getRemoteControlName());
+
+ open(link, caption, tries - 1);
+ }
+ }
+
+ private void scrollTo(int top, int left) {
+ CssLayoutElement testMenu = $(CssLayoutElement.class).id("testMenu");
+
+ testBenchElement(testMenu).scroll(top);
+ testBenchElement(testMenu).scrollLeft(left);
+ }
+
+ @Override
+ protected boolean requireWindowFocusForIE() {
+ return true;
+ }
+
+ @Override
+ protected boolean usePersistentHoverForIE() {
+ return false;
+ }
+
+}