summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2013-11-29 11:34:00 +0200
committerJohannes Dahlström <johannesd@vaadin.com>2013-11-29 11:34:01 +0200
commitde1c343ea9079f74276484c7d5f1623b5391eaba (patch)
tree4088497665be64b9b907ddeb4e30de7e807757c2 /uitest
parentdd7e6fee8c4717df59699f04f7e72a6f2e92008f (diff)
parent012e649775e7efbcbbdd9d1c3ef4edd9c9acb71a (diff)
downloadvaadin-framework-de1c343ea9079f74276484c7d5f1623b5391eaba.tar.gz
vaadin-framework-de1c343ea9079f74276484c7d5f1623b5391eaba.zip
Merge changes from origin/7.1
84521fa Use correct type for UIDL value to avoid development mode problems (#12545) 3680505 Ensure generated parser is re-generated during build (#12937) f3fa6af Regenerated parser files (#12937) 011a2a0 Do not generate ParseException as it has been customized (#12937) 9be3b40 Workaround for missing value change event in chrome (#10109) 48034f6 Ensure alternate text is still visible (#11780) cbc9949 Added test case for #12726 07b1a9d Prevents accidental selection of window caption or content. (#12726) e05e10e Added extra asserts to make test more safer to blind refactorings 33e5897 Use localhost when running locally to avoid potential network issues 642818f Allow using @RunLocally to run on a local Firefox/Chrome/Safari 81a1c29 Revert "Fixed lost scrollLeft when row count changed in Table (#12652)." dde6a48 Output test results in XML reports instead of to standard output 012e649 Fix TB3 local testing and occasionally failing SliderDisableTest. Change-Id: I4f4e44e887e7e90dd04e6d7381280a997e9527cc
Diffstat (limited to 'uitest')
-rw-r--r--uitest/build.xml2
-rw-r--r--uitest/integration_tests.xml20
-rw-r--r--uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java13
-rw-r--r--uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java8
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java15
-rw-r--r--uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java105
-rw-r--r--uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java1
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.html110
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.java101
-rw-r--r--uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java97
-rw-r--r--uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java5
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java111
-rw-r--r--uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java35
-rw-r--r--uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java34
-rw-r--r--uitest/src/com/vaadin/tests/tb3/TB3Runner.java8
-rw-r--r--uitest/src/com/vaadin/tests/tb3/WebsocketTest.java6
-rw-r--r--uitest/tb3test.xml10
-rw-r--r--uitest/test.xml15
18 files changed, 397 insertions, 299 deletions
diff --git a/uitest/build.xml b/uitest/build.xml
index 76b75e9203..864d111023 100644
--- a/uitest/build.xml
+++ b/uitest/build.xml
@@ -150,8 +150,6 @@
<echo>Checkstyle is disabled for uitest for now</echo>
</target>
<target name="test" depends="checkstyle">
- <!--<antcall target="common.test.run" /> -->
- <echo>WHAT? No JUnit tests for ${module.name}!</echo>
</target>
<target name="test-testbench" depends="clean-testbench-errors" description="Run all TestBench based tests, including server tests">
diff --git a/uitest/integration_tests.xml b/uitest/integration_tests.xml
index 73aac2405c..9f639b9cb5 100644
--- a/uitest/integration_tests.xml
+++ b/uitest/integration_tests.xml
@@ -27,6 +27,9 @@
<!-- Base url where the testable application is deployed -->
<property name="deployment.url" value="http://${test.integration.server}:8080" />
+
+ <property name="report.dir" location="${integration_test.dir}/result/reports-integration" />
+
<!-- ssh host values -->
<property name="ant.hub" value="${test.integration.antfile}" />
<property name="user" value="${test.integration.user}" />
@@ -56,6 +59,7 @@
<property name="testfiles" value="${testfiles}" />
<property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" />
<property name="retries" value="0" />
+ <property name="report.qualifier" value="integration-tb2/${server-name}" />
<fileset dir="." includes="test.xml" />
</subant>
@@ -69,6 +73,7 @@
<property name="server.start.succeeded" value="1" />
<property name="testfiles" value="${testfiles-theme}" />
<property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" />
+ <property name="report.qualifier" value="integration-theme-tb2/${server-name}" />
<fileset dir="." includes="test.xml" />
</subant>
@@ -87,6 +92,7 @@
<property name="browsers" value="${test_browsers}" />
<property name="testfiles" value="${test-GAE}" />
<property name="test-output-dir" value="../build/integration-test-gae-output" />
+ <property name="report.qualifier" value="integration-gae-tb2/${server-name}" />
<fileset dir="." includes="test.xml" />
</subant>
@@ -105,16 +111,19 @@
<fail unless="server-name" message="Server name must be defined in server-name" />
<fail unless="deployment.url" message="Deplyoment url must be defined in deployment.url" />
<fail unless="com.vaadin.testbench.screenshot.directory" message="Screenshot directory must be defined in com.vaadin.testbench.screenshot.directory" />
-
- <junit printsummary="withOutAndErr" fork="yes">
- <formatter usefile="false" type="plain" />
+ <property name="server.report.dir" location="${report.dir}/integration-test-tb3/${server-name}" />
+ <!-- The junit task does not create the report dir... -->
+ <mkdir dir="${server.report.dir}" />
+
+ <junit showoutput="no" printsummary="no" fork="yes">
+ <formatter type="xml" />
<classpath refid="classpath.tb3" />
<jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
<jvmarg value="-Ddeployment.url=${deployment.url}" />
<jvmarg value="-Dserver-name=${server-name}" />
<jvmarg value="-Djava.awt.headless=true" />
- <test name="${junit.test.suite}" />
+ <test name="${junit.test.suite}" todir="${server.report.dir}" />
</junit>
</target>
@@ -360,6 +369,9 @@
<property name="passphrase" value="${passphrase}" />
<fail unless="sshkey.file" message="You must define an ssh.keyfile parameter" />
<fail unless="com.vaadin.testbench.screenshot.directory" message="You must define a com.vaadin.testbench.screenshot.directory parameter" />
+ <delete dir="${report.dir}" />
+ <mkdir dir="${report.dir}" />
+
<parallel>
<antcontrib:trycatch property="tried">
<try>
diff --git a/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java b/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java
index ae5806af56..bb0b40e2d1 100644
--- a/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java
+++ b/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java
@@ -30,23 +30,22 @@ public class VerifyBrowserVersionTest extends MultiBrowserTest {
{
expectedUserAgent
- .put(BrowserUtil
- .firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION),
+ .put(Browser.FIREFOX.getDesiredCapabilities(),
"Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0");
expectedUserAgent
- .put(BrowserUtil.ie(8),
+ .put(Browser.IE8.getDesiredCapabilities(),
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)");
expectedUserAgent
- .put(BrowserUtil.ie(9),
+ .put(Browser.IE9.getDesiredCapabilities(),
"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)");
expectedUserAgent
- .put(BrowserUtil.ie(10),
+ .put(Browser.IE10.getDesiredCapabilities(),
"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)");
expectedUserAgent
- .put(BrowserUtil.ie(11),
+ .put(Browser.IE11.getDesiredCapabilities(),
"Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko");
expectedUserAgent
- .put(BrowserUtil.chrome(MultiBrowserTest.TESTED_CHROME_VERSION),
+ .put(Browser.CHROME.getDesiredCapabilities(),
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36");
}
diff --git a/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java b/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java
index ca00c998a6..1d08ee5ede 100644
--- a/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java
+++ b/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java
@@ -18,12 +18,12 @@ public class ActionsOnInvisibleComponentsTest extends MultiBrowserTest {
public List<DesiredCapabilities> getBrowsersToTest() {
List<DesiredCapabilities> browsers = super.getBrowsersToTest();
// sendKeys does nothing on these browsers
- browsers.remove(BrowserUtil.firefox(24));
- browsers.remove(BrowserUtil.ie(8));
- browsers.remove(BrowserUtil.opera(12));
+ browsers.remove(Browser.FIREFOX.getDesiredCapabilities());
+ browsers.remove(Browser.IE8.getDesiredCapabilities());
+ browsers.remove(Browser.OPERA.getDesiredCapabilities());
// Causes 'cannot focus element'
- browsers.remove(BrowserUtil.chrome(29));
+ browsers.remove(Browser.CHROME.getDesiredCapabilities());
return browsers;
}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java
index 557201e803..123fd167d0 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldTestTest.java
@@ -35,9 +35,14 @@ public class DateFieldTestTest extends MultiBrowserTest {
menu("Component");
menuSub("State");
menu("Required");
+ assertRequiredIndicatorVisible();
assertNoErrorNotification();
}
+ private void assertRequiredIndicatorVisible() {
+ getDriver().findElement(By.className("v-required-field-indicator"));
+ }
+
private void assertNoErrorNotification() {
try {
getDriver().findElement(
@@ -58,6 +63,8 @@ public class DateFieldTestTest extends MultiBrowserTest {
menuSub("State");
menu("Required");
+ assertRequiredIndicatorVisible();
+
menu("Component");
menuSub("Features");
menuSub("Resolution");
@@ -100,8 +107,8 @@ public class DateFieldTestTest extends MultiBrowserTest {
* @param string
*/
private void menuSub(String string) {
- getDriver().findElement(
- By.xpath("//span[text() = '" + string + "']")).click();
+ getDriver().findElement(By.xpath("//span[text() = '" + string + "']"))
+ .click();
new Actions(getDriver()).moveByOffset(100, 0).build().perform();
}
@@ -110,8 +117,8 @@ public class DateFieldTestTest extends MultiBrowserTest {
* @param string
*/
private void menu(String string) {
- getDriver().findElement(
- By.xpath("//span[text() = '" + string + "']")).click();
+ getDriver().findElement(By.xpath("//span[text() = '" + string + "']"))
+ .click();
}
diff --git a/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java b/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java
new file mode 100644
index 0000000000..e038c451d0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.nativeselect;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class NativeSelectsAndChromeKeyboardNavigationTest extends
+ MultiBrowserTest {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.tb3.MultiBrowserTest#getBrowsersToTest()
+ */
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ return Collections.singletonList(Browser.CHROME
+ .getDesiredCapabilities());
+ }
+
+ @Test
+ public void testValueChangeListenerWithKeyboardNavigation()
+ throws InterruptedException {
+ setDebug(true);
+ openTestURL();
+ Thread.sleep(1000);
+ menu("Component");
+ menuSub("Listeners");
+ menuSub("Value change listener");
+
+ getDriver().findElement(By.tagName("body")).click();
+
+ WebElement select = getDriver().findElement(By.tagName("select"));
+ select.sendKeys(Keys.ARROW_DOWN);
+ select.sendKeys(Keys.ARROW_DOWN);
+ select.sendKeys(Keys.ARROW_DOWN);
+
+ String bodytext = getDriver().findElement(By.tagName("body")).getText();
+
+ Assert.assertTrue(bodytext.contains("new value: 'Item 1'"));
+ Assert.assertTrue(bodytext.contains("new value: 'Item 2'"));
+ Assert.assertTrue(bodytext.contains("new value: 'Item 3'"));
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.tb3.AbstractTB3Test#getUIClass()
+ */
+ @Override
+ protected Class<?> getUIClass() {
+ return NativeSelects.class;
+ }
+
+ /**
+ * @since
+ * @param string
+ */
+ private void menuSub(String string) {
+ getDriver().findElement(By.xpath("//span[text() = '" + string + "']"))
+ .click();
+ new Actions(getDriver()).moveByOffset(100, 0).build().perform();
+ }
+
+ /**
+ * @since
+ * @param string
+ */
+ private void menu(String string) {
+ getDriver().findElement(By.xpath("//span[text() = '" + string + "']"))
+ .click();
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java b/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java
index f6ec3dac3b..53521ee483 100644
--- a/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java
+++ b/uitest/src/com/vaadin/tests/components/slider/SliderDisableTest.java
@@ -29,6 +29,7 @@ public class SliderDisableTest extends MultiBrowserTest {
openTestURL();
WebElement element = vaadinElement("/VVerticalLayout[0]/Slot[0]/VSlider[0]/domChild[2]/domChild[0]");
new Actions(driver).dragAndDropBy(element, 112, 0).perform();
+ testBench().waitForVaadin();
compareScreen("enabled");
vaadinElementById("disableButton").click();
compareScreen("disabled");
diff --git a/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.html b/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.html
deleted file mode 100644
index 6fd54ba0ca..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.html
+++ /dev/null
@@ -1,110 +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>TableHorizontalScrollPositionOnItemSetChange</title>
-</head>
-<body>
- <table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">TableHorizontalScrollPositionOnItemSetChange</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.table.TableHorizontalScrollPositionOnItemSetChange?restartApplication</td>
- <td></td>
- </tr>
- <tr>
- <td>scrollLeft</td>
- <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Shorscrolltable/domChild[1]</td>
- <td>326</td>
- </tr>
- <tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Slessitems/domChild[0]/domChild[0]</td>
- <td></td>
- </tr>
- <tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
- </tr>
- <tr>
- <td>screenCapture</td>
- <td></td>
- <td>left-scroll-position-stays-in-middle-with-fewer-items</td>
- </tr>
- <tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Smoreitems/domChild[0]/domChild[0]</td>
- <td></td>
- </tr>
- <tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
- </tr>
- <tr>
- <td>screenCapture</td>
- <td></td>
- <td>left-scroll-position-stays-in-middle-with-more-items</td>
- </tr>
- <tr>
- <td>scrollLeft</td>
- <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Shorscrolltable/domChild[1]</td>
- <td>653</td>
- </tr>
- <tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Slessitems/domChild[0]/domChild[0]</td>
- <td></td>
- </tr>
- <tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
- </tr>
- <tr>
- <td>screenCapture</td>
- <td></td>
- <td>left-scroll-position-stays-max-with-fewer-items</td>
- </tr>
- <tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Smoreitems/domChild[0]/domChild[0]</td>
- <td></td>
- </tr>
- <tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
- </tr>
- <tr>
- <td>screenCapture</td>
- <td></td>
- <td>left-scroll-position-stays-max-with-more-items</td>
- </tr>
- <tr>
- <td>scrollLeft</td>
- <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Shorscrolltable/domChild[1]</td>
- <td>0</td>
- </tr>
- </tbody>
- </table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.java b/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.java
deleted file mode 100644
index 1f59a84428..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.tests.components.table;
-
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractTestUI;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.VerticalLayout;
-
-public class TableHorizontalScrollPositionOnItemSetChange extends
- AbstractTestUI {
-
- @Override
- protected void setup(VaadinRequest request) {
- VerticalLayout layout = new VerticalLayout();
- layout.setMargin(true);
- layout.setSpacing(true);
- setContent(layout);
-
- final Table table = new Table();
- table.setWidth("640px");
- table.setHeight("243px");
- table.setId("horscrolltable");
- layout.addComponent(table);
-
- for (int i = 0; i < 15; i++) {
- table.addContainerProperty("Column " + i, String.class, null);
- }
-
- for (int i = 0; i < 60; i++) {
- table.addItem();
- }
-
- Button lessItems = new Button("Less items", new Button.ClickListener() {
-
- @Override
- public void buttonClick(Button.ClickEvent event) {
- table.removeAllItems();
- for (int i = 0; i < 5; i++) {
- table.addItem();
- }
- }
- });
- lessItems.setId("lessitems");
-
- Button moreItems = new Button("More items", new Button.ClickListener() {
-
- @Override
- public void buttonClick(Button.ClickEvent event) {
- table.removeAllItems();
- for (int i = 0; i < 50; i++) {
- table.addItem();
- }
- }
- });
- moreItems.setId("moreitems");
-
- Button clearItems = new Button("Clear all", new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- table.removeAllItems();
- }
- });
-
- HorizontalLayout buttonLayout = new HorizontalLayout();
- buttonLayout.setSpacing(true);
- layout.addComponent(buttonLayout);
-
- buttonLayout.addComponent(lessItems);
- buttonLayout.addComponent(moreItems);
- buttonLayout.addComponent(clearItems);
- clearItems.setId("clearitems");
- }
-
- @Override
- protected String getTestDescription() {
- return "Horizontal scrolling position should not be lost if amount of items changes in Table.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 12652;
- }
-
-}
diff --git a/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java b/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java
new file mode 100644
index 0000000000..1df036af58
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.window;
+
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.Point;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Test for issue #12726, IE's make text selection when sub windows are
+ * dragged(moved).
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class SubWindowsTextSelectionTest extends MultiBrowserTest {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.tb3.AbstractTB3Test#getUIClass()
+ */
+ @Override
+ protected Class<?> getUIClass() {
+ return SubWindows.class;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.tb3.MultiBrowserTest#getBrowsersToTest()
+ */
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ ArrayList<DesiredCapabilities> list = new ArrayList<DesiredCapabilities>();
+ list.add(BrowserUtil.ie(9));
+ list.add(BrowserUtil.ie(10));
+ list.add(BrowserUtil.ie(11));
+ return list;
+ }
+
+ @Test
+ public void verifyNoTextSelectionOnMove() throws MalformedURLException {
+
+ openTestURL();
+
+ WebElement element = driver.findElement(By
+ .className("v-window-outerheader"));
+
+ Point location = element.getLocation();
+
+ element.click();
+
+ new Actions(driver).moveToElement(element).perform();
+ sleep(100);
+ // move pointer bit right from the caption text
+ new Actions(driver).moveByOffset(50, 0).clickAndHold()
+ .moveByOffset(10, 2).moveByOffset(10, 0).moveByOffset(10, 0)
+ .moveByOffset(10, 0).release().perform();
+
+ String selection = ((JavascriptExecutor) getDriver()).executeScript(
+ "return document.getSelection().toString();").toString();
+
+ Assert.assertTrue("Text selection was not empty:" + selection,
+ selection.isEmpty());
+
+ // Verify also that window was really moved
+ Point location2 = element.getLocation();
+ Assert.assertEquals(location.getX() + (4 * 10), location2.getX());
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java b/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java
index ddaf84b3e1..cbb3a8b8e4 100644
--- a/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java
+++ b/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java
@@ -22,7 +22,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameters;
import org.openqa.selenium.remote.DesiredCapabilities;
-import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
import com.vaadin.tests.tb3.PrivateTB3Configuration;
/**
@@ -47,8 +47,7 @@ public abstract class AbstractIntegrationTest extends PrivateTB3Configuration {
@Parameters
public static Collection<DesiredCapabilities> getBrowsersForTest() {
- return Collections.singleton(BrowserUtil
- .firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION));
+ return Collections.singleton(Browser.FIREFOX.getDesiredCapabilities());
}
}
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index d4eed99f19..d7b7cd050f 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -16,6 +16,10 @@
package com.vaadin.tests.tb3;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
import java.net.URL;
import java.util.Collections;
import java.util.List;
@@ -39,6 +43,7 @@ import com.vaadin.server.UIProvider;
import com.vaadin.testbench.TestBench;
import com.vaadin.testbench.TestBenchTestCase;
import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
import com.vaadin.ui.UI;
/**
@@ -76,8 +81,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
private boolean push = false;
{
// Default browser to run on unless setDesiredCapabilities is called
- desiredCapabilities = BrowserUtil
- .firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION);
+ desiredCapabilities = Browser.FIREFOX.getDesiredCapabilities();
}
/**
@@ -103,15 +107,19 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
* If something goes wrong
*/
protected void setupDriver() throws Exception {
- if (runLocally()) {
- setupLocalDriver();
- return;
- }
- DesiredCapabilities capabilities = getDesiredCapabilities();
+ DesiredCapabilities capabilities;
- WebDriver dr = TestBench.createDriver(new RemoteWebDriver(new URL(
- getHubURL()), capabilities));
- setDriver(dr);
+ RunLocally runLocally = getClass().getAnnotation(RunLocally.class);
+ if (runLocally != null) {
+ capabilities = runLocally.value().getDesiredCapabilities();
+ setupLocalDriver(capabilities);
+ } else {
+ capabilities = getDesiredCapabilities();
+
+ WebDriver dr = TestBench.createDriver(new RemoteWebDriver(new URL(
+ getHubURL()), capabilities));
+ setDriver(dr);
+ }
int w = SCREENSHOT_WIDTH;
int h = SCREENSHOT_HEIGHT;
@@ -129,14 +137,10 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
}
- /**
- * Override and return true to run the test locally. This method is only to
- * be used for developing tests.
- *
- * @return true to run the test on a local browser, false to use the hub
- */
- public boolean runLocally() {
- return false;
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE)
+ public @interface RunLocally {
+ public Browser value() default Browser.FIREFOX;
}
/**
@@ -144,7 +148,8 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
* for debug purposes. Used only when {@link #runLocally()} is overridden to
* return true;
*/
- protected abstract void setupLocalDriver();
+ protected abstract void setupLocalDriver(
+ DesiredCapabilities desiredCapabilities);
/**
* Opens the given test (defined by {@link #getTestUrl()}, optionally with
@@ -212,9 +217,8 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
* @return The browsers to run the test on
*/
public List<DesiredCapabilities> getBrowsersToTest() {
- return Collections.singletonList(BrowserUtil
- .firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION));
-
+ return Collections.singletonList(Browser.FIREFOX
+ .getDesiredCapabilities());
}
/**
@@ -738,8 +742,53 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
* @return true if the capabilities refer to IE8, false otherwise
*/
public static boolean isIE8(DesiredCapabilities capabilities) {
- return BrowserType.IE.equals(capabilities.getBrowserName())
- && "8".equals(capabilities.getVersion());
+ return isIE(capabilities) && "8".equals(capabilities.getVersion());
+ }
+
+ /**
+ * @param capabilities
+ * The capabilities to check
+ * @return true if the capabilities refer to Internet Explorer, false
+ * otherwise
+ */
+ public static boolean isIE(DesiredCapabilities capabilities) {
+ return BrowserType.IE.equals(capabilities.getBrowserName());
+ }
+
+ /**
+ * @param capabilities
+ * The capabilities to check
+ * @return true if the capabilities refer to Chrome, false otherwise
+ */
+ public static boolean isChrome(DesiredCapabilities capabilities) {
+ return BrowserType.CHROME.equals(capabilities.getBrowserName());
+ }
+
+ /**
+ * @param capabilities
+ * The capabilities to check
+ * @return true if the capabilities refer to Opera, false otherwise
+ */
+ public static boolean isOpera(DesiredCapabilities capabilities) {
+ return BrowserType.OPERA.equals(capabilities.getBrowserName());
+ }
+
+ /**
+ * @param capabilities
+ * The capabilities to check
+ * @return true if the capabilities refer to Safari, false otherwise
+ */
+ public static boolean isSafari(DesiredCapabilities capabilities) {
+ return BrowserType.SAFARI.equals(capabilities.getBrowserName());
+ }
+
+ /**
+ * @param capabilities
+ * The capabilities to check
+ * @return true if the capabilities refer to Firefox, false otherwise
+ */
+ public static boolean isFirefox(DesiredCapabilities capabilities) {
+ return BrowserType.FIREFOX.equals(capabilities.getBrowserName());
}
/**
@@ -751,21 +800,19 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
*/
public static String getBrowserIdentifier(
DesiredCapabilities capabilities) {
- String browserName = capabilities.getBrowserName();
-
- if (BrowserType.IE.equals(browserName)) {
+ if (isIE(capabilities)) {
return "InternetExplorer";
- } else if (BrowserType.FIREFOX.equals(browserName)) {
+ } else if (isFirefox(capabilities)) {
return "Firefox";
- } else if (BrowserType.CHROME.equals(browserName)) {
+ } else if (isChrome(capabilities)) {
return "Chrome";
- } else if (BrowserType.SAFARI.equals(browserName)) {
+ } else if (isSafari(capabilities)) {
return "Safari";
- } else if (BrowserType.OPERA.equals(browserName)) {
+ } else if (isOpera(capabilities)) {
return "Opera";
}
- return browserName;
+ return capabilities.getBrowserName();
}
/**
diff --git a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java
index e8a974343b..e166e421ef 100644
--- a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java
+++ b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java
@@ -40,23 +40,34 @@ import org.openqa.selenium.remote.DesiredCapabilities;
*/
public abstract class MultiBrowserTest extends PrivateTB3Configuration {
- public static final int TESTED_SAFARI_VERSION = 7;
- public static final int TESTED_CHROME_VERSION = 29;
- public static final int TESTED_FIREFOX_VERSION = 24;
+ public enum Browser {
+ FIREFOX(BrowserUtil.firefox(24)), CHROME(BrowserUtil.chrome(29)), SAFARI(
+ BrowserUtil.safari(7)), IE8(BrowserUtil.ie(8)), IE9(BrowserUtil
+ .ie(9)), IE10(BrowserUtil.ie(10)), IE11(BrowserUtil.ie(11)), OPERA(
+ BrowserUtil.opera(17));
+ private DesiredCapabilities desiredCapabilities;
+
+ private Browser(DesiredCapabilities desiredCapabilities) {
+ this.desiredCapabilities = desiredCapabilities;
+ }
+
+ public DesiredCapabilities getDesiredCapabilities() {
+ return desiredCapabilities;
+ }
+ }
static List<DesiredCapabilities> allBrowsers = new ArrayList<DesiredCapabilities>();
static {
- allBrowsers.add(BrowserUtil.ie(8));
- allBrowsers.add(BrowserUtil.ie(9));
- allBrowsers.add(BrowserUtil.ie(10));
- allBrowsers.add(BrowserUtil.ie(11));
- allBrowsers.add(BrowserUtil.firefox(TESTED_FIREFOX_VERSION));
+ allBrowsers.add(Browser.IE8.getDesiredCapabilities());
+ allBrowsers.add(Browser.IE9.getDesiredCapabilities());
+ allBrowsers.add(Browser.IE10.getDesiredCapabilities());
+ allBrowsers.add(Browser.IE11.getDesiredCapabilities());
+ allBrowsers.add(Browser.FIREFOX.getDesiredCapabilities());
// Uncomment once we have the capability to run on Safari 6
- // allBrowsers.add(BrowserUtil.safari(TESTED_SAFARI_VERSION));
- allBrowsers.add(BrowserUtil.chrome(TESTED_CHROME_VERSION));
+ // allBrowsers.add(SAFARI);
+ allBrowsers.add(Browser.CHROME.getDesiredCapabilities());
// Re-enable this when it is possible to run on a modern Opera version
- // (15+)
- // allBrowsers.add(BrowserUtil.opera(15));
+ // allBrowsers.add(Browser.OPERA.getDesiredCapabilities());
}
/**
diff --git a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
index caa35732d6..543484fc14 100644
--- a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
+++ b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
@@ -26,8 +26,11 @@ import java.util.Enumeration;
import java.util.Properties;
import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.safari.SafariDriver;
import com.vaadin.testbench.TestBench;
@@ -80,6 +83,9 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
@Override
protected String getDeploymentHostname() {
+ if (getClass().getAnnotation(RunLocally.class) != null) {
+ return "localhost";
+ }
String hostName = getProperty(HOSTNAME_PROPERTY);
if (hostName == null || "".equals(hostName)) {
@@ -145,17 +151,29 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
* @see com.vaadin.tests.tb3.AbstractTB3Test#setupLocalDriver()
*/
@Override
- protected void setupLocalDriver() {
- String firefoxPath = getProperty("firefox.path");
+ protected void setupLocalDriver(DesiredCapabilities desiredCapabilities) {
WebDriver driver;
- if (firefoxPath != null) {
- driver = new FirefoxDriver(
- new FirefoxBinary(new File(firefoxPath)), null);
+ if (BrowserUtil.isFirefox(desiredCapabilities)) {
+ String firefoxPath = getProperty("firefox.path");
+ if (firefoxPath != null) {
+ driver = new FirefoxDriver(new FirefoxBinary(new File(
+ firefoxPath)), null);
+ } else {
+ driver = new FirefoxDriver();
+ }
+ } else if (BrowserUtil.isChrome(desiredCapabilities)) {
+ System.setProperty("webdriver.chrome.driver",
+ getProperty("chrome.driver.path"));
+ driver = new ChromeDriver();
+ } else if (BrowserUtil.isSafari(desiredCapabilities)) {
+ driver = new SafariDriver();
} else {
- driver = new FirefoxDriver();
+ throw new RuntimeException(
+ "Not implemented support for running locally on "
+ + BrowserUtil
+ .getBrowserIdentifier(desiredCapabilities));
}
setDriver(TestBench.createDriver(driver));
- setDesiredCapabilities(BrowserUtil
- .firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION));
+ setDesiredCapabilities(desiredCapabilities);
}
}
diff --git a/uitest/src/com/vaadin/tests/tb3/TB3Runner.java b/uitest/src/com/vaadin/tests/tb3/TB3Runner.java
index 4e084ab0ed..eaffa80d09 100644
--- a/uitest/src/com/vaadin/tests/tb3/TB3Runner.java
+++ b/uitest/src/com/vaadin/tests/tb3/TB3Runner.java
@@ -33,6 +33,7 @@ import org.junit.runners.model.Statement;
import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.tests.tb3.AbstractTB3Test.BrowserUtil;
+import com.vaadin.tests.tb3.AbstractTB3Test.RunLocally;
/**
* This runner is loosely based on FactoryTestRunner by Ted Young
@@ -76,10 +77,11 @@ public class TB3Runner extends BlockJUnit4ClassRunner {
.getOnlyConstructor().newInstance();
Collection<DesiredCapabilities> desiredCapabilites = testClassInstance
.getBrowsersToTest();
- if (testClassInstance.runLocally()) {
+ if (testClassInstance.getClass().getAnnotation(RunLocally.class) != null) {
desiredCapabilites = new ArrayList<DesiredCapabilities>();
- desiredCapabilites.add(BrowserUtil
- .firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION));
+ desiredCapabilites.add(testClassInstance.getClass()
+ .getAnnotation(RunLocally.class).value()
+ .getDesiredCapabilities());
}
for (DesiredCapabilities capabilities : desiredCapabilites) {
diff --git a/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java b/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java
index 26fef667cd..e9ef11957c 100644
--- a/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java
+++ b/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java
@@ -25,6 +25,8 @@ import java.util.List;
import org.openqa.selenium.remote.DesiredCapabilities;
+import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
+
/**
* A {@link MultiBrowserTest} which restricts the tests to the browsers which
* support websocket
@@ -35,8 +37,8 @@ public abstract class WebsocketTest extends PrivateTB3Configuration {
private static List<DesiredCapabilities> websocketBrowsers = new ArrayList<DesiredCapabilities>();
static {
websocketBrowsers.addAll(MultiBrowserTest.getAllBrowsers());
- websocketBrowsers.remove(BrowserUtil.ie(8));
- websocketBrowsers.remove(BrowserUtil.ie(9));
+ websocketBrowsers.remove(Browser.IE8.getDesiredCapabilities());
+ websocketBrowsers.remove(Browser.IE9.getDesiredCapabilities());
}
/**
diff --git a/uitest/tb3test.xml b/uitest/tb3test.xml
index dd0c12db91..41cce8f0f2 100644
--- a/uitest/tb3test.xml
+++ b/uitest/tb3test.xml
@@ -2,6 +2,7 @@
<project name="tb3test" xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" basedir=".">
<dirname property="tb3test.dir" file="${ant.file.tb3test}" />
+ <property name="report.dir" location="${tb3test.dir}/result/reports-tb3" />
<ivy:resolve file="${tb3test.dir}/ivy.xml" conf="build, build-provided" />
<ivy:cachepath pathid="classpath.tb3.lib" conf="build, build-provided" />
@@ -19,13 +20,16 @@
<target name="run-tb3-suite">
<fail unless="junit.test.suite" message="Define suite to run using junit.test.suite" />
<fail unless="com.vaadin.testbench.screenshot.directory" message="Define screenshot directory using -Dcom.vaadin.testbench.screenshot.directory" />
- <junit printsummary="withOutAndErr" fork="yes">
- <formatter usefile="false" type="plain" />
+ <delete dir="${report.dir}" />
+ <mkdir dir="${report.dir}" />
+
+ <junit showoutput="no" printsummary="no" fork="yes">
+ <formatter type="xml" />
<classpath refid="classpath.tb3" />
<jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
<jvmarg value="-Djava.awt.headless=true" />
- <test name="${junit.test.suite}" />
+ <test name="${junit.test.suite}" todir="${report.dir}" />
</junit>
</target>
diff --git a/uitest/test.xml b/uitest/test.xml
index b0db8d47f4..57f61d67fa 100644
--- a/uitest/test.xml
+++ b/uitest/test.xml
@@ -3,7 +3,6 @@
<include file="../common.xml" />
<dirname property="test.xml.dir" file="${ant.file.Run Vaadin Testbench Tests}" />
-
<!-- ================================================================== -->
<!-- Configuration -->
<!-- ================================================================== -->
@@ -84,6 +83,11 @@
</target>
<target name="run-tb2-tests" depends="check-parameters,compile-tests">
+ <property name="report.qualifier" value="tb2" />
+ <property name="report.dir" location="${test.xml.dir}/result/reports-${report.qualifier}" />
+
+ <delete dir="${report.dir}" />
+ <mkdir dir="${report.dir}" />
<fileset dir="${test-output-dir}" id="tests-fileset">
<include name="**/**.java" />
</fileset>
@@ -103,13 +107,16 @@
<!-- This target runs the generated and compiled junit tests -->
<target name="execute-tests">
- <junit fork="yes" printsummary="withOutAndErr" maxmemory="96m">
+ <!-- Junit does not create the report dir so we need to ensure it
+ exists -->
+ <mkdir dir="${report.dir}" />
+ <junit fork="yes" showoutput="no" printsummary="no" maxmemory="96m">
<classpath>
<path refid="classpath" />
<pathelement path="${class-dir}" />
</classpath>
- <formatter usefile="false" type="plain" />
+ <formatter type="xml" />
<jvmarg value="-Dcom.vaadin.testbench.tester.host=${com.vaadin.testbench.tester.host}" />
<jvmarg value="-Dcom.vaadin.testbench.deployment.url=${com.vaadin.testbench.deployment.url}" />
@@ -129,7 +136,7 @@
<jvmarg value="-Dcom.vaadin.testbench.screenshot.reference.debug=${com.vaadin.testbench.screenshot.reference.debug}" />
<jvmarg value="-Dcom.vaadin.testbench.screenshot.cursor=${com.vaadin.testbench.screenshot.cursor}" />
- <batchtest>
+ <batchtest todir="${report.dir}">
<filelist dir="${test-output-dir}" files="${target}" />
</batchtest>
</junit>