]> source.dussan.org Git - vaadin-framework.git/commitdiff
Use TestBench-4.0.2
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Thu, 12 Feb 2015 12:57:13 +0000 (14:57 +0200)
committerTeemu Suo-Anttila <teemusa@vaadin.com>
Thu, 19 Feb 2015 13:19:46 +0000 (15:19 +0200)
- Based on TB4 Parallel testing.
- Browser setup no longer uses static capabilities.
- Some code cleanup here and there.

Change-Id: I5c419316cd36f4f5041eaa8da8fda3d8b46596c4

116 files changed:
ivysettings.xml
uitest/integration_tests.xml
uitest/ivy.xml
uitest/src/com/vaadin/testbench/elements/GridElement.java
uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java
uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java
uitest/src/com/vaadin/tests/annotations/TestCategory.java [deleted file]
uitest/src/com/vaadin/tests/applicationservlet/NoApplicationClassTest.java
uitest/src/com/vaadin/tests/components/AbstractOrderedLayoutWithCaptionsTest.java
uitest/src/com/vaadin/tests/components/SaneErrorsTest.java
uitest/src/com/vaadin/tests/components/calendar/SetFirstVisibleHourOfDayTest.java
uitest/src/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowedTest.java
uitest/src/com/vaadin/tests/components/combobox/ComboboxPageLengthZeroScrollTest.java
uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java
uitest/src/com/vaadin/tests/components/datefield/LocaleChangeTest.java
uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRangeTest.java
uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResourceTest.java
uitest/src/com/vaadin/tests/components/grid/AbstractGridColumnAutoWidthTest.java
uitest/src/com/vaadin/tests/components/grid/CustomRendererTest.java
uitest/src/com/vaadin/tests/components/grid/GridAddAndRemoveDataOnInitTest.java
uitest/src/com/vaadin/tests/components/grid/GridAddRowTest.java
uitest/src/com/vaadin/tests/components/grid/GridClientRenderers.java
uitest/src/com/vaadin/tests/components/grid/GridColspansTest.java
uitest/src/com/vaadin/tests/components/grid/GridColumnAutoWidthClientTest.java
uitest/src/com/vaadin/tests/components/grid/GridColumnAutoWidthServerTest.java
uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java
uitest/src/com/vaadin/tests/components/grid/GridGeneratedPropertiesTest.java
uitest/src/com/vaadin/tests/components/grid/GridHeaderStyleNamesTest.java
uitest/src/com/vaadin/tests/components/grid/GridInTabSheetTest.java
uitest/src/com/vaadin/tests/components/grid/GridSingleColumnTest.java
uitest/src/com/vaadin/tests/components/grid/GridWithoutRendererTest.java
uitest/src/com/vaadin/tests/components/grid/InitialFrozenColumnsTest.java
uitest/src/com/vaadin/tests/components/grid/WidgetRenderersTest.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/EscalatorBasicClientFeaturesTest.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicClientFeaturesTest.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridClientDataSourcesTest.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridClientHeightByRowOnInitTest.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridDefaultTextRendererTest.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridHeightByRowOnInitTest.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridSortingIndicatorsTest.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridMultiSortingTest.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSortingTest.java
uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutExtraSpacingTest.java
uitest/src/com/vaadin/tests/components/javascriptcomponent/JavaScriptPreloadingTest.java
uitest/src/com/vaadin/tests/components/menubar/MenuBarTooltipsNearEdgeTest.java
uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsAndChromeKeyboardNavigationTest.java
uitest/src/com/vaadin/tests/components/nativeselect/NativeSelectsFocusAndBlurListenerTests.java
uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAriaTest.java
uitest/src/com/vaadin/tests/components/orderedlayout/CaptionLeakTest.java
uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutFocusWithDOMChangesTest.java
uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java
uitest/src/com/vaadin/tests/components/table/AddSelectionToRemovedRangeTest.java
uitest/src/com/vaadin/tests/components/table/ContextMenuSizeTest.java
uitest/src/com/vaadin/tests/components/table/CtrlShiftMultiselectTest.java
uitest/src/com/vaadin/tests/components/table/DisabledSortingTableTest.java
uitest/src/com/vaadin/tests/components/table/MemoryLeakTableTest.java
uitest/src/com/vaadin/tests/components/table/SelectAllRowsTest.java
uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidthIE8Test.java
uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidthTest.java
uitest/src/com/vaadin/tests/components/table/TableNavigationPageDownTest.java
uitest/src/com/vaadin/tests/components/table/TableScrollAfterAddRowTest.java
uitest/src/com/vaadin/tests/components/table/TableWithPollingTest.java
uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZoomingTest.java
uitest/src/com/vaadin/tests/components/tabsheet/TabSheetFocusedTabTest.java
uitest/src/com/vaadin/tests/components/ui/DynamicViewportEmptyTest.java
uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagationModifierKeysTest.java
uitest/src/com/vaadin/tests/components/uitest/UIScrollingTest.java
uitest/src/com/vaadin/tests/components/upload/TestFileUploadTest.java
uitest/src/com/vaadin/tests/components/window/CloseShortcutTest.java
uitest/src/com/vaadin/tests/components/window/SubWindowsTextSelectionTest.java
uitest/src/com/vaadin/tests/components/window/WindowBGColorChameleonIE8Test.java
uitest/src/com/vaadin/tests/components/window/WindowShadowTest.java
uitest/src/com/vaadin/tests/debug/PushVersionInfoTest.java
uitest/src/com/vaadin/tests/extensions/SetThemeAndResponsiveLayoutTest.java
uitest/src/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java
uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java
uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeakTest.java
uitest/src/com/vaadin/tests/push/BarInUIDLTest.java
uitest/src/com/vaadin/tests/push/BasicPushTest.java
uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java
uitest/src/com/vaadin/tests/push/IdlePushChannelTest.java
uitest/src/com/vaadin/tests/push/PushConfigurationTest.java
uitest/src/com/vaadin/tests/push/PushConfigurationWebSocketTest.java
uitest/src/com/vaadin/tests/push/PushErrorHandlingTest.java
uitest/src/com/vaadin/tests/push/PushFromInitTest.java
uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java
uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java
uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java
uitest/src/com/vaadin/tests/push/SendMultibyteCharactersTest.java
uitest/src/com/vaadin/tests/push/TogglePushTest.java
uitest/src/com/vaadin/tests/push/TrackMessageSizeUITest.java
uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
uitest/src/com/vaadin/tests/tb3/AffectedTB3Tests.java
uitest/src/com/vaadin/tests/tb3/AllTB3Tests.java
uitest/src/com/vaadin/tests/tb3/ChangedTB3Tests.java
uitest/src/com/vaadin/tests/tb3/DndActionsTest.java
uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java
uitest/src/com/vaadin/tests/tb3/MultiBrowserTestWithProxy.java
uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java
uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java
uitest/src/com/vaadin/tests/tb3/SingleBrowserTest.java
uitest/src/com/vaadin/tests/tb3/TB3Runner.java
uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java
uitest/src/com/vaadin/tests/tb3/TestNameSuffix.java [deleted file]
uitest/src/com/vaadin/tests/tb3/VaadinBrowserFactory.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/tb3/WebsocketTest.java
uitest/src/com/vaadin/tests/tb3/newelements/CalendarElement.java
uitest/src/com/vaadin/tests/tb3/newelements/FixedNotificationElement.java
uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java
uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java
uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java
uitest/src/com/vaadin/tests/themes/valo/TextFieldBevelTest.java
uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java
uitest/tb3test.xml

index bc60be5e29529b417fe94d06e279ff0f3d871795..f1fc4d1c63861f9be8bbcd45641e924a101d1fdc 100644 (file)
     <modules>
         <module organisation="com.vaadin" name="vaadin-testbench"
             resolver="vaadin-addons" />
+        <module organisation="com.vaadin" name="vaadin-testbench-core"
+            resolver="vaadin-addons" />
+        <module organisation="com.vaadin" name="vaadin-testbench-api"
+            resolver="vaadin-addons" />
         <module organisation="com.vaadin" name="vaadin-buildhelpers"
             resolver="build-temp" />
         <module organisation="com.vaadin" name="vaadin-shared"
index 4469b58c24a80addd551eae92b3634656a0c74ad..26ce4ed70d1711c57ed5ec665b803c0003cc82dd 100644 (file)
@@ -27,6 +27,8 @@
     <!-- Base url where the testable application is deployed -->
     <property name="deployment.url" value="http://${test.integration.server}:8080" />
 
+    <!-- TestBench license parameter -->
+    <property name="vaadin.testbench.developer.license" value="" />
 
     <property name="report.dir" location="${integration_test.dir}/result/reports-integration" />
 
             <jvmarg value="-Dserver-name=${server-name}" />
             <jvmarg value="-Djava.awt.headless=true" />
             <jvmarg value="-Ddemo.war=${demo.war}" />
+            <jvmarg value="-Dvaadin.testbench.developer.license=${vaadin.testbench.developer.license}" />
             <test name="${junit.test.suite}" todir="${server.report.dir}" />
         </junit>
     </target>
index 78171f9a9caadfc7d13c81fb5e0924ebc8cd0d62..9c4db1584b0315d0f55422683d355329bc36098e 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE ivy-module [
-    <!ENTITY jetty.version "8.1.9.v20130131">
+    <!ENTITY jetty.version "8.1.12.v20130726">
 ]>
 <ivy-module version="2.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -28,7 +28,7 @@
         <dependency org="javax.validation" name="validation-api"
             rev="1.0.0.GA" conf="build,ide -> default,sources" />
         <dependency org="org.hibernate" name="hibernate-validator"
-                    rev="4.2.0.Final" conf="build,ide -> default" />
+            rev="4.2.0.Final" conf="build,ide -> default" />
         <!-- Google App Engine -->
         <dependency org="com.google.appengine" name="appengine-api-1.0-sdk"
             rev="1.2.1" conf="build-provided,ide -> default" />
         </dependency>
         <!-- jetty-servlets needed by ProxyTest, but not by jetty-runner -->
         <dependency org="org.eclipse.jetty" name="jetty-servlets"
-            rev="&jetty.version;" conf="ide, build-provided, jetty-run->default" />
+            rev="&jetty.version;" conf="ide, build-provided, jetty-run->default">
+            <exclude org="org.eclipse.jetty.orbit"></exclude>
+        </dependency>
         <dependency org="org.eclipse.jetty" name="jetty-websocket"
-            rev="&jetty.version;" conf="ide, jetty-run->default" />
+            rev="&jetty.version;" conf="ide, jetty-run->default">
+            <exclude org="org.eclipse.jetty.orbit"></exclude>
+        </dependency>
         <dependency org="org.eclipse.jetty" name="jetty-webapp"
-            rev="&jetty.version;" conf="ide, build-provided, jetty-run->default" />
+            rev="&jetty.version;" conf="ide, build-provided, jetty-run->default">
+            <exclude org="org.eclipse.jetty.orbit"></exclude>
+        </dependency>
         <dependency org="org.mortbay.jetty" name="jetty-runner"
             rev="&jetty.version;" conf="ide, jetty-run->default">
             <exclude org="org.eclipse.jetty.orbit"></exclude>
 
         <dependency org="junit" name="junit" rev="4.11"
             conf="build,ide -> default" />
-        <dependency org="org.hamcrest" name="hamcrest-all" rev="1.3"
-            conf="build,ide->default" />
+        <dependency org="org.hamcrest" name="hamcrest-all"
+            rev="1.3" conf="build,ide->default" />
         <dependency org="com.jcraft" name="jsch" rev="0.1.50"
             conf="ide, build->default" />
         <dependency org="commons-codec" name="commons-codec"
             rev="1.5" conf="build,ide->default" />
-        <dependency org="commons-io" name="commons-io" rev="${commons-io.version}"
-            conf="build,ide->default" />
+        <dependency org="commons-io" name="commons-io"
+            rev="${commons-io.version}" conf="build,ide->default" />
         <!-- Mainly for SQLContainer tests -->
         <dependency org="org.hsqldb" name="hsqldb" rev="2.2.6"
             conf="build,ide -> default" />
         <dependency org="com.vaadin" name="vaadin-testbench"
-            rev="4.0.0.alpha1" conf="build-provided,ide -> default" />
+            rev="4.0.2" conf="build-provided,ide -> default" />
         <!-- 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"
+        <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" />
+            rev="${vaadin.version}" conf="compile-theme->build" />
 
-        <dependency org="org.eclipse.jgit" name="org.eclipse.jgit" 
-                   rev="3.5.1.201410131835-r" conf="ide,build->default" />
+        <dependency org="org.eclipse.jgit" name="org.eclipse.jgit"
+            rev="3.5.1.201410131835-r" conf="ide,build->default">
+            <exclude org="org.apache.httpcomponents"></exclude>
+        </dependency>
 
     </dependencies>
 
index 3753696855d77fd14d6e4edca58b39dc33bbff14..68ddfc878ee8c96be2fd3f7b516575df1f263016 100644 (file)
@@ -23,6 +23,8 @@ import org.openqa.selenium.WebElement;
 
 import com.vaadin.testbench.By;
 import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.testbench.elementsbase.AbstractElement;
+import com.vaadin.testbench.elementsbase.ServerClass;
 
 /**
  * TestBench Element API for Grid
index 38c94dda7d536b1d1f7b2c84116992b6761ffb99..5b4f4df78831aae0aedd61b9e1fde86895e01cd9 100644 (file)
@@ -19,28 +19,14 @@ import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.junit.Test;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
+import com.vaadin.testbench.parallel.BrowserUtil;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class VerifyBrowserVersionTest extends MultiBrowserTest {
 
-    private Map<DesiredCapabilities, String> expectedUserAgent = new HashMap<DesiredCapabilities, String>();
-
-    {
-        expectedUserAgent.put(Browser.FIREFOX.getDesiredCapabilities(), "Firefox/");
-        expectedUserAgent.put(Browser.IE8.getDesiredCapabilities(), "MSIE ");
-        expectedUserAgent.put(Browser.IE9.getDesiredCapabilities(), "MSIE ");
-        expectedUserAgent.put(Browser.IE10.getDesiredCapabilities(), "MSIE ");
-        expectedUserAgent.put(Browser.IE11.getDesiredCapabilities(), "Trident/7.0; rv:");
-        expectedUserAgent.put(Browser.CHROME.getDesiredCapabilities(), "Chrome/");
-        expectedUserAgent.put(Browser.PHANTOMJS.getDesiredCapabilities(), "PhantomJS/");
-    }
-
     @Test
     public void verifyUserAgent() {
         openTestURL();
@@ -48,11 +34,31 @@ public class VerifyBrowserVersionTest extends MultiBrowserTest {
         DesiredCapabilities desiredCapabilities = getDesiredCapabilities();
 
         assertThat(vaadinElementById("userAgent").getText(),
-            containsString(expectedUserAgent.get(desiredCapabilities)
-                                         + desiredCapabilities.getVersion()));
+                containsString(getExpectedUserAgentString(desiredCapabilities)
+                        + desiredCapabilities.getVersion()));
 
         assertThat(vaadinElementById("touchDevice").getText(),
-                                                        is("Touch device? No"));
+                is("Touch device? No"));
+    }
+
+    private String getExpectedUserAgentString(DesiredCapabilities dCap) {
+        if (BrowserUtil.isIE(dCap)) {
+            if (!BrowserUtil.isIE(dCap, 11)) {
+                // IE8-10
+                return "MSIE ";
+            } else {
+                // IE11
+                return "Trident/7.0; rv:";
+            }
+        } else if (BrowserUtil.isFirefox(dCap)) {
+            return "Firefox/";
+        } else if (BrowserUtil.isChrome(dCap)) {
+            return "Chrome/";
+        } else if (BrowserUtil.isPhantomJS(dCap)) {
+            return "PhantomJS/";
+        }
+        throw new UnsupportedOperationException(
+                "Test is being run on unknown browser.");
     }
 
 }
index 8dfcf52b7584cb7da88613cd1dc7e7c5c6a4eb91..1231b0036e97decc4643d5e5c1675a12b6c21458 100644 (file)
@@ -7,6 +7,7 @@ import org.junit.Test;
 import org.openqa.selenium.interactions.Actions;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class ActionsOnInvisibleComponentsTest extends MultiBrowserTest {
@@ -15,12 +16,8 @@ public class ActionsOnInvisibleComponentsTest extends MultiBrowserTest {
     // This method should be removed once #12785 is fixed
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        List<DesiredCapabilities> browsers = super.getBrowsersToTest();
-        // Send Keys does not function correctly on these browsers.
-        browsers.remove(Browser.CHROME.getDesiredCapabilities());
-        browsers.remove(Browser.FIREFOX.getDesiredCapabilities());
-        browsers.remove(Browser.IE8.getDesiredCapabilities());
-        return browsers;
+        return getBrowserCapabilities(Browser.IE9, Browser.IE10, Browser.IE11,
+                Browser.PHANTOMJS);
     }
 
     @Test
diff --git a/uitest/src/com/vaadin/tests/annotations/TestCategory.java b/uitest/src/com/vaadin/tests/annotations/TestCategory.java
deleted file mode 100644 (file)
index 5ba6cc3..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.tests.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-@Inherited
-public @interface TestCategory {
-
-    String value();
-
-}
index 5a815fb40c8de020287e802b14f004d52331838e..8020870bdc837b0b1e0ee2b3a4ac2b621474b537 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.vaadin.tests.applicationservlet;
 
-import java.util.Collections;
 import java.util.List;
 
 import org.junit.Assert;
@@ -23,6 +22,7 @@ import org.junit.Test;
 import org.openqa.selenium.By;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class NoApplicationClassTest extends MultiBrowserTest {
@@ -38,8 +38,7 @@ public class NoApplicationClassTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        return Collections.singletonList(Browser.CHROME
-                .getDesiredCapabilities());
+        return getBrowserCapabilities(Browser.CHROME);
     }
 
     @Override
index 4f5c16218eec2ad828a7f44f42b25c214ca3a0ff..69e4aaa06c12f2ce1cdaaa40d238080c66fe35ed 100644 (file)
@@ -25,6 +25,7 @@ import org.junit.Test;
 import org.openqa.selenium.WebElement;
 
 import com.vaadin.testbench.By;
+import com.vaadin.testbench.parallel.BrowserUtil;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
index bf84695c3b541d8bfa0ac9c8b398cdb599c707f8..a43db58fd027006b06e529885394f18c13cc80cb 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.vaadin.tests.components;
 
-import java.util.Collections;
 import java.util.List;
 
 import org.junit.Assert;
@@ -24,6 +23,7 @@ import org.openqa.selenium.By;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class SaneErrorsTest extends MultiBrowserTest {
@@ -35,7 +35,7 @@ public class SaneErrorsTest extends MultiBrowserTest {
      */
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        return Collections.singletonList(DesiredCapabilities.firefox());
+        return getBrowserCapabilities(Browser.FIREFOX);
     }
 
     @Test
index e18163227e1ed2f0fc1c1333ddf23158a6e62af1..a41fb8360a3cfdd1df83a29128bfcf4348c29088 100644 (file)
@@ -23,6 +23,7 @@ import org.openqa.selenium.By;
 import org.openqa.selenium.StaleElementReferenceException;
 import org.openqa.selenium.WebElement;
 
+import com.vaadin.testbench.parallel.BrowserUtil;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
index 7951187fa7389066c72126b1c5fe7796e90615dd..ce8e614e10b5e222ce72a831f4864cd25f804411 100644 (file)
@@ -25,6 +25,7 @@ import org.openqa.selenium.interactions.Actions;
 import com.vaadin.testbench.By;
 import com.vaadin.testbench.commands.TestBenchElementCommands;
 import com.vaadin.testbench.elements.ComboBoxElement;
+import com.vaadin.testbench.parallel.BrowserUtil;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
index 948acc5fe6141807abbbf2b181c6baab2826932e..e88dd2eb850641c23399eec365d791795bff4346 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.vaadin.tests.components.combobox;
 
-import java.util.Collections;
 import java.util.List;
 
 import org.junit.Assert;
@@ -26,6 +25,7 @@ import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
@@ -67,6 +67,6 @@ public class ComboboxPageLengthZeroScrollTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        return Collections.singletonList(Browser.IE8.getDesiredCapabilities());
+        return getBrowserCapabilities(Browser.IE8);
     }
 }
index a57017746ab81f9136eae183f93f95b256414943..4775441af2bb2fad958a4207922d3b137dd3cab7 100644 (file)
@@ -16,7 +16,6 @@
 package com.vaadin.tests.components.datefield;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 
 import org.junit.Assert;
@@ -33,13 +32,7 @@ public class DisabledDateFieldPopupTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>();
-        for (DesiredCapabilities browser : super.getBrowsersToTest()) {
-            if (BrowserUtil.isIE(browser)) {
-                browsers.add(browser);
-            }
-        }
-        return browsers;
+        return getIEBrowsersOnly();
     }
 
     @Test
index c80a74599d23b2ec506e5b87b2f0a902da125e23..38e4b7e0b828fdd8e0dd1bfd0c703d4538cc3a1d 100644 (file)
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals;
 import org.junit.Test;
 import org.openqa.selenium.By;
 
+import com.vaadin.testbench.parallel.BrowserUtil;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class LocaleChangeTest extends MultiBrowserTest {
index 6d22048d329d3ff2d7b798d0f4c597c796547815..a4c7248d69e162344c497724a335e62420fe7f4a 100644 (file)
@@ -31,6 +31,7 @@ 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.testbench.parallel.BrowserUtil;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
@@ -405,9 +406,8 @@ public class PopupDateFieldExtendedRangeTest extends MultiBrowserTest {
         new Actions(driver).keyUp(Keys.SHIFT).perform();
 
         // TODO: remove this once #14406 has been fixed
-        if (!getBrowsersExcludingIE().contains(getDesiredCapabilities())
-                && !Browser.IE8.getDesiredCapabilities().equals(
-                        getDesiredCapabilities())) {
+        if (BrowserUtil.isIE(getDesiredCapabilities())
+                && !BrowserUtil.isIE8(getDesiredCapabilities())) {
             popup.findElement(
                     By.className("v-datefield-calendarpanel-prevmonth"))
                     .findElement(By.tagName("button")).click();
@@ -435,9 +435,8 @@ public class PopupDateFieldExtendedRangeTest extends MultiBrowserTest {
                         .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())) {
+        if (!BrowserUtil.isIE(getDesiredCapabilities())
+                || BrowserUtil.isIE8(getDesiredCapabilities())) {
             assertEquals(
                     "unexpected focus",
                     "16",
index f3dca71cada377fc8c592e5597faa31cbd73bef5..dc4dd341f424371a4f94e2d0fdc6e98cb81b11c9 100644 (file)
@@ -20,7 +20,7 @@ import static org.hamcrest.Matchers.is;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 import org.junit.Before;
@@ -33,9 +33,10 @@ import org.openqa.selenium.support.ui.ExpectedCondition;
 import com.vaadin.testbench.elements.ButtonElement;
 import com.vaadin.testbench.elements.EmbeddedElement;
 import com.vaadin.testbench.elements.ImageElement;
-import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.SingleBrowserTest;
 import com.vaadin.ui.Embedded;
+import com.vaadin.ui.Image;
 
 /**
  * Tests that {@link Embedded} uses correct theme when the theme is set with
@@ -50,7 +51,7 @@ public class EmbeddedThemeResourceTest extends SingleBrowserTest {
     public List<DesiredCapabilities> getBrowsersToTest() {
         // Seems like stylesheet onload is not fired on PhantomJS
         // https://github.com/ariya/phantomjs/issues/12332
-        return Arrays.asList(MultiBrowserTest.Browser.FIREFOX
+        return Collections.singletonList(Browser.FIREFOX
                 .getDesiredCapabilities());
     }
 
index cc5be455cddedf3381b0a87c3079333556d05567..a9e0b03932f7301bbdcb21a755103887d56b0176 100644 (file)
@@ -24,7 +24,8 @@ import org.junit.Test;
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebElement;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.BrowserUtil;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @SuppressWarnings("boxing")
index 1c00574f9c59a4a8f2939c90cbd70e339933244f..b17416df2aeb07b00dec27de2a83aad4464491a1 100644 (file)
@@ -23,7 +23,7 @@ import org.junit.Test;
 
 import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.elements.LabelElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("grid")
index ceaceb661df73854ca5ebba9648cb8d6ab5ab498..42327ebd8091688207a7852e53290fe6aa5ab43d 100644 (file)
@@ -20,7 +20,7 @@ import org.junit.Test;
 
 import com.vaadin.testbench.By;
 import com.vaadin.testbench.elements.GridElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("grid")
index 46f085686d30e19e5cf1256a5956a77cab7708ac..8c601db9aa81a9bd66a75974d30fc8143f8bcf50 100644 (file)
@@ -20,7 +20,7 @@ import org.junit.Test;
 
 import com.vaadin.testbench.elements.ButtonElement;
 import com.vaadin.testbench.elements.GridElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("grid")
index 953e2a24c76490b50f762e68e27ea59fd0e61e05..2ef1600f915839bce85af7e04b3c104635d1f8b1 100644 (file)
@@ -33,8 +33,9 @@ import com.vaadin.testbench.elements.GridElement.GridCellElement;
 import com.vaadin.testbench.elements.LabelElement;
 import com.vaadin.testbench.elements.NativeButtonElement;
 import com.vaadin.testbench.elements.NativeSelectElement;
-import com.vaadin.testbench.elements.ServerClass;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.elementsbase.ServerClass;
+import com.vaadin.testbench.parallel.BrowserUtil;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 import com.vaadin.tests.widgetset.client.grid.GridClientColumnRendererConnector.Renderers;
 import com.vaadin.tests.widgetset.server.grid.GridClientColumnRenderers;
index 6b50b6473226c203f050db3b36d6b85729fa4e59..d99272d506b93f62effc9647a434505fa7d8d80a 100644 (file)
@@ -25,7 +25,7 @@ import org.openqa.selenium.By;
 import com.vaadin.testbench.elements.ButtonElement;
 import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.elements.GridElement.GridCellElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("grid")
index dcc14a967ddf644fe0263dadcd11add655cd31fe..999f72682e75b2fa0d01455d70d7fa1386406451 100644 (file)
@@ -15,7 +15,7 @@
  */
 package com.vaadin.tests.components.grid;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 
 @TestCategory("grid")
 public class GridColumnAutoWidthClientTest extends
index 2f42b89eb176b8d9452ed2986e5f3d90a73a1e47..3a4e2bfc72e77777e0b22315c90d0c2a23a3d782 100644 (file)
@@ -15,7 +15,7 @@
  */
 package com.vaadin.tests.components.grid;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 
 @TestCategory("grid")
 public class GridColumnAutoWidthServerTest extends
index 6c386eec038bf4f81cebb80e7023e6107bc3ddc4..47dc90e33a3ac821138fffd9c386bc26ef0ef931 100644 (file)
@@ -26,7 +26,7 @@ import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.elements.GridElement.GridCellElement;
 import com.vaadin.testbench.elements.NotificationElement;
 import com.vaadin.testbench.elements.PasswordFieldElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("grid")
index ffcd4c448fd63b176a18bc6b5990275796be2d61..d50879e65e5536f734d6bbf728b5a76343ab3945 100644 (file)
@@ -24,7 +24,7 @@ import org.junit.Test;
 import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.elements.GridElement.GridCellElement;
 import com.vaadin.testbench.elements.NotificationElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("grid")
index 0f70d66ad4df65e6497cf0b52283e00481d20fc7..8b3a81e660113ba195d46655f9ba75eb5d5e1b8f 100644 (file)
@@ -23,7 +23,7 @@ import org.openqa.selenium.WebElement;
 import com.vaadin.testbench.elements.ButtonElement;
 import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.elements.GridElement.GridCellElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.SingleBrowserTest;
 
 @TestCategory("grid")
index 168496e9dfb8f96b97117fd20ac5b068b6da0eae..f9f8d1309b395dc84c1dd3b2007c6ff6da5f6a88 100644 (file)
@@ -24,7 +24,7 @@ import com.vaadin.testbench.elements.ButtonElement;
 import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.elements.NotificationElement;
 import com.vaadin.testbench.elements.TabSheetElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("grid")
index 42eb2197bf00ad5896e85408c0ff0afa6233a32a..a3fbb00cf251ac1af4bc9c80f5113a15757bacda 100644 (file)
@@ -21,7 +21,7 @@ import org.junit.Test;
 import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.elements.GridElement.GridCellElement;
 import com.vaadin.testbench.elements.NotificationElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("grid")
index 5d6ffbd8a79b7dedc48c3e8cb15e8a5c4dd9dc5d..fc93e99188ea93125416331a994ac261c0437f5a 100644 (file)
@@ -22,7 +22,7 @@ import org.junit.Test;
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebElement;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.SingleBrowserTest;
 
 @TestCategory("grid")
index 7a6d37d08906144f793206ce042a5d9375e83e3b..b4414a3f38a31cea60aa414bfae10d219cb2b258 100644 (file)
@@ -23,7 +23,7 @@ import org.openqa.selenium.WebElement;
 
 import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.elements.NotificationElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("grid")
index 854d7fe3f27fcf180de1203d13aaa263d19901aa..063d05b7359ed9b2057266a9577a6bb3b5c92445 100644 (file)
  */
 package com.vaadin.tests.components.grid;
 
-import com.vaadin.testbench.By;
-import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.testbench.elements.GridElement;
-import com.vaadin.testbench.elements.GridElement.GridCellElement;
-import com.vaadin.testbench.elements.NotificationElement;
-import com.vaadin.tests.annotations.TestCategory;
-import com.vaadin.tests.tb3.MultiBrowserTest;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
 import org.junit.Test;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 import org.openqa.selenium.support.ui.ExpectedCondition;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.elements.GridElement.GridCellElement;
+import com.vaadin.testbench.elements.NotificationElement;
+import com.vaadin.testbench.parallel.TestCategory;
+import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
  * TB tests for the various builtin widget-based renderers.
@@ -97,7 +98,8 @@ public class WidgetRenderersTest extends MultiBrowserTest {
         waitUntilmageSrcEndsWith(image, "window/img/maximize.png");
     }
 
-    private void waitUntilmageSrcEndsWith(final WebElement image, final String expectedText) {
+    private void waitUntilmageSrcEndsWith(final WebElement image,
+            final String expectedText) {
         waitUntil(new ExpectedCondition<Boolean>() {
 
             @Override
@@ -108,8 +110,9 @@ public class WidgetRenderersTest extends MultiBrowserTest {
             @Override
             public String toString() {
                 // Timed out after 10 seconds waiting for ...
-                return String.format("image source to update. Supposed to end with '%s' (was: '%s').",
-                        expectedText, image.getAttribute("src"));
+                return String
+                        .format("image source to update. Supposed to end with '%s' (was: '%s').",
+                                expectedText, image.getAttribute("src"));
             }
         });
     }
index 92c7f3e6a6ab83a1c74eece8344ef55940c00923..3f0c9dc70bd65f57b95c5097d377bbde95c01370 100644 (file)
@@ -26,7 +26,7 @@ import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 
 import com.vaadin.testbench.TestBenchElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("escalator")
index d0e076fd3bdc413c3cc663fb3475878e67db5c74..ad3e1fe5ebc8ee17cbd4890c19b89b5d8381c726 100644 (file)
@@ -24,7 +24,7 @@ import com.vaadin.testbench.TestBenchElement;
 import com.vaadin.testbench.elements.GridElement;
 
 /**
- * Variant of GridBasicFeaturesTest to be used with GridBasicClientFeatures.
+ * GridBasicClientFeatures.
  * 
  * @since
  * @author Vaadin Ltd
@@ -83,8 +83,7 @@ public abstract class GridBasicClientFeaturesTest extends GridBasicFeaturesTest
         if (composite) {
             // Composite requires the basic client features widget for subparts
             return ((TestBenchElement) findElement(By
-                    .vaadin("//TestWidgetComponent")))
-                    .wrap(GridElement.class);
+                    .vaadin("//TestWidgetComponent"))).wrap(GridElement.class);
         } else {
             return super.getGridElement();
         }
index 0e339ec0ae06bc3200747cb43c971d4f17099d9a..e22fcc422b0d72bfac54e11e856283728e164c37 100644 (file)
@@ -23,23 +23,18 @@ import org.openqa.selenium.JavascriptExecutor;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
-import org.openqa.selenium.remote.DesiredCapabilities;
 
 import com.vaadin.testbench.TestBenchElement;
 import com.vaadin.testbench.elements.GridElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("grid")
 public abstract class GridBasicFeaturesTest extends MultiBrowserTest {
 
     @Override
-    protected DesiredCapabilities getDesiredCapabilities() {
-        DesiredCapabilities dCap = super.getDesiredCapabilities();
-        if (BrowserUtil.isIE(dCap)) {
-            dCap.setCapability("requireWindowFocus", true);
-        }
-        return super.getDesiredCapabilities();
+    protected boolean requireWindowFocusForIE() {
+        return true;
     }
 
     @Override
index 30d65413444f4bf591c9272520cdcbddf9d13e3a..fb12178c9bf82bb6759da145ee695ddf35eb75d7 100644 (file)
@@ -27,7 +27,7 @@ import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("grid")
index dadaff0eaa51cc9c97a4adb63bfff0921a3e4f5f..86686225d0cde4cb257ae64e7a6212f7970c8be0 100644 (file)
@@ -3,7 +3,7 @@ package com.vaadin.tests.components.grid.basicfeatures;
 import org.junit.Test;
 import org.openqa.selenium.By;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @SuppressWarnings("all")
index 79eadd03d8cc9ea3eeebe805dba8c5572b3a396d..ae9a8fe381bc789d5b18adf571043e360d6093fe 100644 (file)
@@ -25,8 +25,8 @@ import org.junit.Test;
 import com.vaadin.testbench.By;
 import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.elements.NotificationElement;
-import com.vaadin.testbench.elements.ServerClass;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.elementsbase.ServerClass;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("grid")
index 15a1cd6c85f03ceb17e57e2436350cecf8abd3c9..651cd3a7634427dabd13cce526470d5d559f2d7e 100644 (file)
@@ -3,7 +3,7 @@ package com.vaadin.tests.components.grid.basicfeatures;
 import org.junit.Test;
 
 import com.vaadin.testbench.elements.GridElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @SuppressWarnings("all")
index 6a5360f1522190953e0ced1d2de03db088099a69..66c937aa812f5695d0f9c336958b3d920c45664f 100644 (file)
@@ -20,10 +20,8 @@ import java.io.IOException;
 import org.junit.Test;
 
 import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.tests.annotations.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
-@TestCategory("grid")
 public class GridSortingIndicatorsTest extends MultiBrowserTest {
 
     @Test
@@ -35,5 +33,4 @@ public class GridSortingIndicatorsTest extends MultiBrowserTest {
 
         compareScreen("reversedSort");
     }
-
 }
index a61ed33029ebd60486a4005849d280c0e4be2fb7..1c0af8921b6c8f1e1f8b9f417fa03a75b5bfab38 100644 (file)
@@ -32,11 +32,7 @@ public class GridMultiSortingTest extends GridBasicFeaturesTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        List<DesiredCapabilities> browsersToTest = super.getBrowsersToTest();
-        /* FireFox and PhantomJS don't know how to press Shift key... */
-        browsersToTest.remove(Browser.FIREFOX.getDesiredCapabilities());
-        browsersToTest.remove(Browser.PHANTOMJS.getDesiredCapabilities());
-        return browsersToTest;
+        return super.getBrowsersSupportingShiftClick();
     }
 
     @Test
index 7e805595c6647a6fa9e6a19c7179a001e4e55294..2d6f7acffde20bcefe58da82d9dfdca27d38fbaf 100644 (file)
@@ -33,11 +33,9 @@ import com.vaadin.shared.data.sort.SortDirection;
 import com.vaadin.testbench.By;
 import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.elements.GridElement.GridCellElement;
-import com.vaadin.tests.annotations.TestCategory;
 import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeatures;
 import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
 
-@TestCategory("grid")
 public class GridSortingTest extends GridBasicFeaturesTest {
 
     private static class SortInfo {
index 64b9997dcca2b677208f5f3f25666960474a5f3f..22c9c0d4e346754ba19e89a993c425ce6dc92490 100644 (file)
@@ -25,6 +25,7 @@ import org.openqa.selenium.WebElement;
 import com.vaadin.testbench.elements.CheckBoxElement;
 import com.vaadin.testbench.elements.CssLayoutElement;
 import com.vaadin.testbench.elements.GridLayoutElement;
+import com.vaadin.testbench.parallel.BrowserUtil;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class GridLayoutExtraSpacingTest extends MultiBrowserTest {
index a9e7a1bca7673b0d09e52b0c74c5981644d2895f..400936581438ef6cbd33190ad6f2147a8da47ab8 100644 (file)
@@ -29,23 +29,11 @@ import org.openqa.selenium.support.ui.WebDriverWait;
 
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
-/**
- * 
- * @since
- * @author Vaadin Ltd
- */
 public class JavaScriptPreloadingTest extends MultiBrowserTest {
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.tests.tb3.MultiBrowserTest#getBrowsersToTest()
-     */
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        List<DesiredCapabilities> browsers = super.getBrowsersToTest();
-        browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities());
-        return browsers;
+        return getBrowsersExcludingPhantomJS();
     }
 
     @Test
index 3cfe30a991b53c75da0b84ba0f3cb85a6135cfd0..a460290ee0d9e7e7936952383b04a0021d999dfb 100644 (file)
@@ -41,11 +41,8 @@ public class MenuBarTooltipsNearEdgeTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        // Tooltip tests work unreliably on IE due to an issue with the
-        // WebDriver (see #13854)
-        List<DesiredCapabilities> browsers = super.getBrowsersToTest();
-        browsers.remove(Browser.IE8.getDesiredCapabilities());
-        return browsers;
+        // Tooltip test is unreliable on IE8
+        return getBrowsersExcludingIE8();
     };
 
     @Test
@@ -59,6 +56,5 @@ public class MenuBarTooltipsNearEdgeTest extends MultiBrowserTest {
         WebElement tooltip = getTooltipElement();
         assertThat(tooltip.getLocation().x, is(lessThan(menuLocation.onPage().x
                 - tooltip.getSize().getWidth())));
-
     }
 }
index eb838c135eb24a7072c73a02dd6534320bc01c35..4e23db8eb76b29722f1c216acbe5a6247ac01a7b 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.vaadin.tests.components.nativeselect;
 
-import java.util.Collections;
 import java.util.List;
 
 import org.junit.Assert;
@@ -26,25 +25,15 @@ import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
+import com.vaadin.testbench.parallel.Browser;
 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());
+        return getBrowserCapabilities(Browser.CHROME);
     }
 
     @Test
@@ -72,30 +61,17 @@ public class NativeSelectsAndChromeKeyboardNavigationTest extends
 
     }
 
-    /*
-     * (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();
index bf81ca439036eb14ccda69911c211e939cb95784..194b1bb64b329ae3e98f159728e6d1598a6a3881 100644 (file)
@@ -21,6 +21,7 @@ import org.openqa.selenium.By;
 import org.openqa.selenium.interactions.Actions;
 
 import com.vaadin.testbench.elements.NativeSelectElement;
+import com.vaadin.testbench.parallel.BrowserUtil;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class NativeSelectsFocusAndBlurListenerTests extends MultiBrowserTest {
index 252efe282491fc996340a1f73926adcb9b8c450e..33ba8d1df05fe00e70bb4058a1c3e02088a7ca5d 100644 (file)
@@ -31,7 +31,7 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
 /**
  * Unit test class for Notification ARIA (Accessible Rich Internet Applications)
  * roles.
- *
+ * 
  * @since 7.2
  * @author Vaadin Ltd
  */
@@ -39,7 +39,7 @@ public class NotificationsWaiAriaTest extends MultiBrowserTest {
 
     /**
      * Checks if the ARIA roles are correctly applied to Notification.
-     *
+     * 
      * @since 7.2
      * @throws Exception
      */
@@ -80,10 +80,7 @@ public class NotificationsWaiAriaTest extends MultiBrowserTest {
         Assert.assertTrue("Expected '- press ESC to close', found " + text,
                 text.equals("- press ESC to close"));
 
-        try {
-            notification.closeNotification();
-        } catch (Exception e) {
-        }
+        notification.close();
 
         type.selectByText(StringToEnumConverter.enumToString(
                 NotificationRole.STATUS, null));
@@ -97,10 +94,7 @@ public class NotificationsWaiAriaTest extends MultiBrowserTest {
         Assert.assertTrue("Expected attribute 'role' to equal 'status', found "
                 + text, text.equals("status"));
 
-        try {
-            notification.closeNotification();
-        } catch (Exception e) {
-        }
+        notification.close();
 
         prefix.clear();
         postfix.clear();
index a95ceca22b1e7845b993e249717383a85541320b..9bb53d8742f550052aef20b56cd1c74f7b7453b8 100644 (file)
@@ -19,6 +19,7 @@ import org.junit.Test;
 import org.openqa.selenium.By;
 
 import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.parallel.BrowserUtil;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class CaptionLeakTest extends MultiBrowserTest {
index 1afcabec1dc5ec64efd77a10bfe77fc2d7350efa..0890414fea0ea26e1c30dc22f4c98d58ca563827 100644 (file)
@@ -24,6 +24,7 @@ import org.openqa.selenium.interactions.Actions;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
 import com.vaadin.testbench.By;
+import com.vaadin.testbench.parallel.BrowserUtil;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class VerticalLayoutFocusWithDOMChangesTest extends MultiBrowserTest {
@@ -54,8 +55,8 @@ public class VerticalLayoutFocusWithDOMChangesTest extends MultiBrowserTest {
         Assert.assertEquals("Just a button", activeElement.getText());
 
         DesiredCapabilities capabilities = getDesiredCapabilities();
-        if (capabilities.equals(BrowserUtil.ie(8))
-                || capabilities.equals(BrowserUtil.ie(9))) {
+        if (BrowserUtil.isIE8(capabilities)
+                || BrowserUtil.isIE(capabilities, 9)) {
             // IE8 and IE9 insert cursor in the start of input instead of end.
             Assert.assertEquals(incrementalText + initialText,
                     tf1.getAttribute("value"));
@@ -86,8 +87,8 @@ public class VerticalLayoutFocusWithDOMChangesTest extends MultiBrowserTest {
 
         new Actions(getDriver()).sendKeys(secondText).build().perform();
         DesiredCapabilities capabilities = getDesiredCapabilities();
-        if (capabilities.equals(BrowserUtil.ie(8))
-                || capabilities.equals(BrowserUtil.ie(9))) {
+        if (BrowserUtil.isIE8(capabilities)
+                || BrowserUtil.isIE(capabilities, 9)) {
             // IE8 and IE9 insert cursor in the start of input instead of end.
             Assert.assertEquals(secondText + firstText,
                     tf2.getAttribute("value"));
@@ -96,5 +97,4 @@ public class VerticalLayoutFocusWithDOMChangesTest extends MultiBrowserTest {
                     tf2.getAttribute("value"));
         }
     }
-
 }
index ce528df37304d1033e8a8ad9d96f40239a8a359c..aafd310b70f0a64e742649658fe48736a5b8aeca 100644 (file)
@@ -20,7 +20,6 @@ import static org.hamcrest.Matchers.greaterThan;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.lessThan;
 
-import java.util.Collections;
 import java.util.List;
 
 import org.junit.Test;
@@ -32,6 +31,7 @@ import org.openqa.selenium.remote.DesiredCapabilities;
 import com.vaadin.testbench.elements.ButtonElement;
 import com.vaadin.testbench.elements.PopupViewElement;
 import com.vaadin.testbench.elements.VerticalLayoutElement;
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
@@ -75,6 +75,6 @@ public class PopupViewResizeWhileOpenTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        return Collections.singletonList(Browser.IE8.getDesiredCapabilities());
+        return getBrowserCapabilities(Browser.IE8);
     }
 }
index 897511e41acfd60d6e5980bd50fcbc7ae87c5aad..68b374847252cc9d0368478fd9a803854a36d022 100644 (file)
@@ -16,8 +16,6 @@
 package com.vaadin.tests.components.table;
 
 import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 
 import org.junit.Assert;
@@ -29,22 +27,19 @@ import org.openqa.selenium.interactions.Actions;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
 import com.vaadin.testbench.By;
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class AddSelectionToRemovedRangeTest extends MultiBrowserTest {
 
     @Override
-    public List<DesiredCapabilities> getBrowsersToTest() {
-        return Collections.unmodifiableList(Arrays.asList(Browser.CHROME
-                .getDesiredCapabilities()));
+    protected boolean requireWindowFocusForIE() {
+        return true;
     }
 
     @Override
-    protected DesiredCapabilities getDesiredCapabilities() {
-        DesiredCapabilities cap = new DesiredCapabilities(
-                super.getDesiredCapabilities());
-        cap.setCapability("requireWindowFocus", true);
-        return cap;
+    public List<DesiredCapabilities> getBrowsersToTest() {
+        return getBrowserCapabilities(Browser.CHROME);
     }
 
     @Test
index ac4c4cb558a76899bd84e73e17da3400767753c5..e6b3ca2af49c844765ca5855cf405726f90975a0 100644 (file)
@@ -19,7 +19,6 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.lessThan;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import org.junit.Test;
@@ -28,25 +27,22 @@ import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
  * Test for context menu position and size.
- *
+ * 
  * @author Vaadin Ltd
  */
 public class ContextMenuSizeTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(
-                getAllBrowsers());
-
         // context menu doesn't work in phantom JS and works weirdly with IE8
         // and selenium.
-        browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities());
-        browsers.remove(Browser.IE8.getDesiredCapabilities());
-        return browsers;
+        return getBrowserCapabilities(Browser.IE9, Browser.IE10, Browser.IE11,
+                Browser.FIREFOX, Browser.CHROME);
     }
 
     @Override
index 026d672044275753900fdd4a90b1037df4585877..add7db93f2a31f98bfa58060a1b6b2a897901357 100644 (file)
@@ -31,12 +31,7 @@ public class CtrlShiftMultiselectTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        List<DesiredCapabilities> browsers = super.getBrowsersToTest();
-        // Shift + click doesn't select all rows correctly on these browsers
-        browsers.remove(Browser.FIREFOX.getDesiredCapabilities());
-        browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities());
-
-        return browsers;
+        return getBrowsersSupportingShiftClick();
     }
 
     @Override
index ed0cc631b110c1304e21f0055fcc214bbc182026..bb15301eee1852504211cc1a18d2585870d2b860 100644 (file)
@@ -14,14 +14,17 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class DisabledSortingTableTest extends MultiBrowserTest {
 
+    Class<?> uiClass;
+
     @Override
-    protected void closeApplication() {
-        // need to close manually to use the correct ui class.
-    }
+    protected java.lang.Class<?> getUIClass() {
+        return uiClass;
+    };
 
     @Test
     public void sortingByEmptyArrayShouldClearSortingIndicator() {
-        openTestURL(DisabledSortingTable.class);
+        uiClass = DisabledSortingTable.class;
+        openTestURL();
 
         assertThatFirstCellHasText("0");
 
@@ -32,13 +35,12 @@ public class DisabledSortingTableTest extends MultiBrowserTest {
 
         sortByEmptyArray();
         assertThatFirstCellHasText("4");
-
-        openTestURL(DisabledSortingTable.class, "closeApplication");
     }
 
     @Test
     public void emptySortingClearsIndicatorAndResetsSortingWithSQLContainer() {
-        openTestURL(DisabledSortingTableSqlContainer.class);
+        uiClass = DisabledSortingTableSqlContainer.class;
+        openTestURL();
 
         assertThatFirstCellHasText("1");
 
@@ -49,8 +51,6 @@ public class DisabledSortingTableTest extends MultiBrowserTest {
         sortByEmptyArray();
 
         assertThatFirstCellHasText("1");
-
-        openTestURL(DisabledSortingTableSqlContainer.class, "closeApplication");
     }
 
     private void sortFirstColumnAscending() {
@@ -91,8 +91,8 @@ public class DisabledSortingTableTest extends MultiBrowserTest {
             @Override
             public String toString() {
                 // Timed out after 10 seconds waiting for ...
-                return String.format("header to get class name '%s'",
-                        className);
+                return String
+                        .format("header to get class name '%s'", className);
             }
         });
     }
index b4b8d93fbe945f39cbc2dcd142ee1edd188febce..b254d27b5801b319e751727750eb697593700f33 100644 (file)
@@ -26,21 +26,18 @@ import org.openqa.selenium.WebElement;
 
 import com.vaadin.testbench.elements.ButtonElement;
 import com.vaadin.testbench.elements.TableElement;
-import com.vaadin.tests.tb3.AbstractTB3Test.RunLocally;
 import com.vaadin.tests.tb3.MultiBrowserTest;
-import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
 
 /**
  * Test case creating and deleting table component in a loop, testing memory
  * lead in Table component. This test should not be used in auto testing.
- *
+ * 
  * To test memory consuption. Run test in debug mode. Take memory snapshot in
  * Profiler in browser before and after the loop. Compare memory consuption.
- *
+ * 
  * @since
  * @author Vaadin Ltd
  */
-@RunLocally(Browser.CHROME)
 public class MemoryLeakTableTest extends MultiBrowserTest {
 
     /**
index f6c6ca3ddce09b636d418ceb960301187ee830a2..175cbac9d52cd81b91fd29dedc202124e96ba179 100644 (file)
@@ -18,7 +18,6 @@ package com.vaadin.tests.components.table;
 import static com.vaadin.tests.components.table.SelectAllRows.TOTAL_NUMBER_OF_ROWS;
 import static org.junit.Assert.assertEquals;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import org.junit.Test;
@@ -51,12 +50,7 @@ public class SelectAllRowsTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        // Pressing Shift modifier key does not work with Firefox and PhantomJS
-        ArrayList<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(
-                super.getBrowsersToTest());
-        browsers.remove(Browser.FIREFOX.getDesiredCapabilities());
-        browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities());
-        return browsers;
+        return getBrowsersSupportingShiftClick();
     }
 
     @Test
index 8bace7e23accec697b05a83703051a286eec939a..3de2ceb200917b776443dcc286c956b3729cc60c 100644 (file)
@@ -1,26 +1,23 @@
 package com.vaadin.tests.components.table;
 
-import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.testbench.elements.TableElement;
-import com.vaadin.tests.tb3.MultiBrowserTest;
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
 import org.junit.Test;
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.testbench.parallel.Browser;
+import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class TableColumnResizeContentsWidthIE8Test extends MultiBrowserTest {
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        List<DesiredCapabilities> browsersToTest = new ArrayList<DesiredCapabilities>();
-
-        browsersToTest.add(Browser.IE8.getDesiredCapabilities());
-
-        return browsersToTest;
+        return getBrowserCapabilities(Browser.IE8);
     }
 
     @Override
index 5faee3cc590d358c4c6e41b4c5f804e04e152d2c..9072d13263b86be0a5c6fc279373a9c5572cda05 100644 (file)
  */
 package com.vaadin.tests.components.table;
 
-import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.testbench.elements.TableElement;
-import com.vaadin.tests.tb3.MultiBrowserTest;
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
 import org.junit.Test;
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebDriver;
@@ -26,9 +27,9 @@ import org.openqa.selenium.interactions.Actions;
 import org.openqa.selenium.remote.DesiredCapabilities;
 import org.openqa.selenium.support.ui.ExpectedCondition;
 
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
  * Tests that components within table cells get resized when their column gets
@@ -40,13 +41,7 @@ public class TableColumnResizeContentsWidthTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        List<DesiredCapabilities> browsersToTest = super.getBrowsersToTest();
-
-        // Can't get IE8 to hit the resizer, extracted IE8 to it's own test
-        // class.
-        browsersToTest.remove(Browser.IE8.getDesiredCapabilities());
-
-        return browsersToTest;
+        return getBrowsersExcludingIE8();
     }
 
     @Test
index fc3fd2610c21644eb9508b16b8ae813b45277e5c..4ab42a5f94fefcaa0937da90663f0a17037a9bd3 100644 (file)
@@ -18,7 +18,6 @@ package com.vaadin.tests.components.table;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import org.junit.Test;
@@ -31,6 +30,7 @@ import org.openqa.selenium.remote.DesiredCapabilities;
 import org.openqa.selenium.support.ui.ExpectedCondition;
 
 import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
@@ -47,15 +47,11 @@ public class TableNavigationPageDownTest extends MultiBrowserTest {
 
     private WebElement wrapper;
 
-
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
         // Sending PageDown has no effect on PhantomJS. On IE focus
         // in Table is often lost, so default scrolling happens on PageDown.
-        List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(
-                getBrowsersExcludingIE());
-        browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities());
-        return browsers;
+        return getBrowserCapabilities(Browser.FIREFOX, Browser.CHROME);
     }
 
     @Override
@@ -73,7 +69,7 @@ public class TableNavigationPageDownTest extends MultiBrowserTest {
     }
 
     private void sendKeyUntilEndIsReached(Keys key) {
-        while(true) {
+        while (true) {
             int lastVisibleRowNumber = getLastVisibleRowNumber();
             sendKey(key);
 
@@ -116,7 +112,8 @@ public class TableNavigationPageDownTest extends MultiBrowserTest {
 
     @Test
     public void navigatePageDown() {
-        // Scroll to a point where you can reach the bottom with a couple of page downs.
+        // Scroll to a point where you can reach the bottom with a couple of
+        // page downs.
         // Can't use v-table-body height because lower rows haven't been
         // fetched yet.
         testBenchElement(wrapper).scroll(
@@ -132,7 +129,8 @@ public class TableNavigationPageDownTest extends MultiBrowserTest {
 
     @Test
     public void navigatePageUp() {
-        // Scroll to a point where you can reach the top with a couple of page ups.
+        // Scroll to a point where you can reach the top with a couple of page
+        // ups.
         testBenchElement(wrapper).scroll((int) (2.8 * pageHeight));
         waitForScrollToFinish();
 
index 9242bae3d8c3fbea90f02038e37f04aa9c2df48f..d390b57823e9ad7dd803e85760331536d9a9528f 100644 (file)
@@ -31,10 +31,6 @@ import com.vaadin.testbench.screenshot.ImageComparison;
 import com.vaadin.testbench.screenshot.ReferenceNameGenerator;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
-/**
- * 
- * @author Vaadin Ltd
- */
 public class TableScrollAfterAddRowTest extends MultiBrowserTest {
 
     @Before
@@ -45,6 +41,7 @@ public class TableScrollAfterAddRowTest extends MultiBrowserTest {
     @Test
     public void testJumpToFirstRow() throws InterruptedException {
         jumpToFifteenthRow();
+        sleep(300);
         jumpToFirstRow();
         assertEquals("0", getCurrentPageFirstItemIndex());
     }
index 3e12333a6d258396a35a11264205d5e8efd6eff4..14994f8b02214e237c3a09bc0e07e14bab66eade 100644 (file)
@@ -88,8 +88,6 @@ public class TableWithPollingTest extends MultiBrowserTest {
         // Selenium has issues with drag-and-drop on IE8 making it impossible to
         // drag a target as small as the table resizer. So we'll just have to
         // ignore IE8 completely.
-        List<DesiredCapabilities> browsers = super.getBrowsersToTest();
-        browsers.remove(Browser.IE8.getDesiredCapabilities());
-        return browsers;
+        return getBrowsersExcludingIE8();
     }
 }
index df01800180f53025985e2dcab17e774d4f7701aa..f0325ed77bf46a473657f77deb623caf965253ab 100644 (file)
@@ -34,6 +34,7 @@ import org.openqa.selenium.support.ui.WebDriverWait;
 
 import com.vaadin.testbench.By;
 import com.vaadin.testbench.commands.TestBenchCommandExecutor;
+import com.vaadin.testbench.parallel.BrowserUtil;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class UnnecessaryScrollbarWhenZoomingTest extends MultiBrowserTest {
index 12ae03080b8e4ef895e2827a0a2621036c2a280d..52003bbac9c0e41da0624a06f23b42b318ea07b1 100644 (file)
@@ -33,11 +33,9 @@ public class TabSheetFocusedTabTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        List<DesiredCapabilities> browsers = super.getBrowsersToTest();
         // PhantomJS doesn't send Focus / Blur events when clicking or
         // navigating with keyboard
-        browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities());
-        return browsers;
+        return getBrowsersExcludingPhantomJS();
     }
 
     @Override
index 40ec937c1c1d757c28424abb447c5cf8cdceb9a1..55466130ad31dd1277af3ecad67edb0bca8530c6 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.vaadin.tests.components.ui;
 
-import java.util.Arrays;
 import java.util.List;
 
 import org.junit.Assert;
@@ -24,6 +23,7 @@ import org.openqa.selenium.By;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class DynamicViewportEmptyTest extends MultiBrowserTest {
@@ -35,7 +35,7 @@ public class DynamicViewportEmptyTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        return Arrays.asList(Browser.CHROME.getDesiredCapabilities());
+        return getBrowserCapabilities(Browser.CHROME);
     }
 
     @Test
index fca312ba7e679a6e56d51d3167f2c00537612a64..43422feb58a9df221b274cc1ac8c98d27d1bf7fc 100644 (file)
@@ -25,6 +25,7 @@ import org.openqa.selenium.interactions.Actions;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
 import com.vaadin.testbench.elements.TextAreaElement;
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class TextAreaEventPropagationModifierKeysTest extends MultiBrowserTest {
@@ -67,17 +68,9 @@ public class TextAreaEventPropagationModifierKeysTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        List<DesiredCapabilities> browsers = super.getBrowsersToTest();
-        // Can't handle ctrl
-        browsers.remove(Browser.IE8.getDesiredCapabilities());
-        browsers.remove(Browser.FIREFOX.getDesiredCapabilities());
-
-        // Can't handle shift or ctrl
-        browsers.remove(Browser.IE9.getDesiredCapabilities());
-        browsers.remove(Browser.IE10.getDesiredCapabilities());
-        browsers.remove(Browser.IE11.getDesiredCapabilities());
-        return browsers;
-
+        // IE8 and Firefox can't handle ctrl.
+        // IE9-11 has issues with shift and ctrl
+        return getBrowserCapabilities(Browser.CHROME, Browser.PHANTOMJS);
     }
 
     @Override
index 46d79a2ce5639756e9db12d3d8ca541c81c0ebbb..cf6a6ac821875afc2b0da7477c6d1c5e0a4027dd 100644 (file)
@@ -22,7 +22,6 @@ import java.util.List;
 
 import org.junit.Test;
 import org.openqa.selenium.By;
-import org.openqa.selenium.StaleElementReferenceException;
 import org.openqa.selenium.WebElement;
 
 import com.vaadin.testbench.elements.ButtonElement;
@@ -58,10 +57,7 @@ public class UIScrollingTest extends MultiBrowserTest {
                 notification.findElement(By.tagName("h1")).getText());
 
         // attempt to close the notification
-        try {
-            notification.closeNotification();
-        } catch (StaleElementReferenceException e) {
-        }
+        notification.close();
 
         WebElement ui = findElement(By.className("v-ui"));
         testBenchElement(ui).scroll(1020);
@@ -74,9 +70,7 @@ public class UIScrollingTest extends MultiBrowserTest {
         assertEquals("Scrolled to 1020 px",
                 notification.findElement(By.tagName("h1")).getText());
 
-        try {
-            notification.closeNotification();
-        } catch (StaleElementReferenceException e) {
-        }
+        notification.close();
+
     }
 }
index ae966a5b0764d0616131225b7db997a02f6bfcad..f1d5432344573c95c05021ecb1d06ba62657cb82 100644 (file)
@@ -41,9 +41,7 @@ public class TestFileUploadTest extends MultiBrowserTest {
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
         // PhantomJS fails to upload files for unknown reasons
-        List<DesiredCapabilities> b = super.getBrowsersToTest();
-        b.remove(Browser.PHANTOMJS.getDesiredCapabilities());
-        return b;
+        return getBrowsersExcludingPhantomJS();
     }
 
     @Test
index 7cca2ce4d03c66e3b0d6393264c045b0e86e7ee8..df7b7cad0cc217252ba6ee5513a000edb11d91b1 100644 (file)
@@ -24,11 +24,13 @@ import org.openqa.selenium.By;
 import org.openqa.selenium.Keys;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.remote.DesiredCapabilities;
 import org.openqa.selenium.support.ui.ExpectedCondition;
 
 import com.vaadin.testbench.elements.CheckBoxElement;
 import com.vaadin.testbench.elements.TextFieldElement;
 import com.vaadin.testbench.elements.WindowElement;
+import com.vaadin.testbench.parallel.BrowserUtil;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
@@ -101,12 +103,9 @@ public class CloseShortcutTest extends MultiBrowserTest {
     public void testOtherWithAll() {
         attemptOtherShortcut();
         // TODO: remove this check once #14902 has been fixed
-        if (!Browser.IE8.getDesiredCapabilities().equals(
-                getDesiredCapabilities())
-                && !Browser.FIREFOX.getDesiredCapabilities().equals(
-                        getDesiredCapabilities())
-                && !Browser.CHROME.getDesiredCapabilities().equals(
-                        getDesiredCapabilities())) {
+        DesiredCapabilities cap = getDesiredCapabilities();
+        if ((BrowserUtil.isIE(cap) && !BrowserUtil.isIE8(cap))
+                || BrowserUtil.isPhantomJS(cap)) {
             ensureWindowClosed();
         }
     }
@@ -123,8 +122,7 @@ public class CloseShortcutTest extends MultiBrowserTest {
     public void testCtrlWithAll() {
         attemptCtrlShortcut();
         // TODO: remove this check once #14902 has been fixed
-        if (Browser.PHANTOMJS.getDesiredCapabilities().equals(
-                getDesiredCapabilities())) {
+        if (BrowserUtil.isPhantomJS(getDesiredCapabilities())) {
             ensureWindowClosed();
         }
     }
@@ -141,9 +139,8 @@ public class CloseShortcutTest extends MultiBrowserTest {
     public void testShiftWithAll() {
         attemptShiftShortcut();
         // TODO: remove this check once #14902 has been fixed
-        if (getBrowsersExcludingIE().contains(getDesiredCapabilities())
-                || Browser.IE8.getDesiredCapabilities().equals(
-                        getDesiredCapabilities())) {
+        DesiredCapabilities capabilities = getDesiredCapabilities();
+        if (!BrowserUtil.isIE(capabilities) || BrowserUtil.isIE8(capabilities)) {
             ensureWindowClosed();
         }
     }
index 335590437d00c683fcd12610ff0964591c2ca9f1..e0cc240d6d7c6bcce4715df536dfb296c0f879ff 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.vaadin.tests.components.window;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import org.junit.Assert;
@@ -27,6 +26,7 @@ import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
@@ -48,18 +48,9 @@ public class SubWindowsTextSelectionTest extends MultiBrowserTest {
         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;
+        return getBrowserCapabilities(Browser.IE9, Browser.IE10, Browser.IE11);
     }
 
     @Test
index 18cb012cb23f4db78e998d82f8f426adb67fb9da..4e9bffe3e82ed9448a851ff5285f92f5763b803e 100644 (file)
@@ -7,7 +7,7 @@ import java.util.List;
 import org.junit.Test;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
-import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.SingleBrowserTest;
 
 public class WindowBGColorChameleonIE8Test extends SingleBrowserTest {
@@ -19,9 +19,7 @@ public class WindowBGColorChameleonIE8Test extends SingleBrowserTest {
      */
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-
-        return Arrays.asList(MultiBrowserTest.Browser.IE8
-                .getDesiredCapabilities());
+        return Arrays.asList(Browser.IE8.getDesiredCapabilities());
     }
 
     @Test
index 0bd6c9fa44f5c4dc22ee87fb14cc7cb55dd57a37..3cc310eeb466101fa9330e19339b35586ae5857a 100644 (file)
@@ -17,7 +17,6 @@ package com.vaadin.tests.components.window;
 
 import java.awt.AWTException;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 
 import org.junit.Test;
@@ -61,9 +60,6 @@ public class WindowShadowTest extends MultiBrowserTest {
     // ignore this browser in testing
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(
-                getAllBrowsers());
-        browsers.remove(Browser.IE8.getDesiredCapabilities());
-        return browsers;
+        return getBrowsersExcludingIE8();
     }
 }
\ No newline at end of file
index 90ea645ab8aa0dce42e4d65084ced5e855879690..d0eee990096a0f1d92c80ea7798c238f4e6a47a2 100644 (file)
@@ -24,7 +24,7 @@ import org.openqa.selenium.Keys;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
index 8a1fbde24530af9c1db66b635dd8cd3a596a4cb4..0d0b38854148153277651a9d57823a983cc15800 100644 (file)
@@ -43,7 +43,7 @@ public class SetThemeAndResponsiveLayoutTest extends MultiBrowserTest {
     public List<DesiredCapabilities> getBrowsersToTest() {
         // Seems like stylesheet onload is not fired on PhantomJS
         // https://github.com/ariya/phantomjs/issues/12332
-        return super.getBrowsersExcludingPhantomJS();
+        return getBrowsersExcludingPhantomJS();
     }
 
     @Test
index bdf8603c48a9a7d0cb34d45021038532e66b8051..7b1805305235da89470cc31732814dc870f1f193 100644 (file)
@@ -27,7 +27,7 @@ import com.vaadin.testbench.elements.DateFieldElement;
 import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.elements.GridElement.GridCellElement;
 import com.vaadin.testbench.elements.GridElement.GridEditorElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("grid")
index 073975a50952e4cbc0a8b22fc8700dba0d7b25ef..5dd59a824588d0e81468761cccbf4214eeb9dfc6 100644 (file)
@@ -15,8 +15,8 @@
  */
 package com.vaadin.tests.integration;
 
+import com.vaadin.testbench.parallel.TestNameSuffix;
 import com.vaadin.tests.tb3.PrivateTB3Configuration;
-import com.vaadin.tests.tb3.TestNameSuffix;
 
 /**
  * Base class for integration tests. Integration tests use the
index bfe38b8865def952518f66fd0f81d9a415c2309b..33adb622c006fa24d32156f6b2f87dc3ffebaf35 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.vaadin.tests.layouts;
 
-import java.util.Collections;
 import java.util.List;
 
 import org.junit.Assert;
@@ -23,6 +22,7 @@ import org.junit.Test;
 import org.openqa.selenium.JavascriptExecutor;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
+import com.vaadin.testbench.parallel.Browser;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class IE8MeasuredSizeMemoryLeakTest extends MultiBrowserTest {
@@ -49,6 +49,6 @@ public class IE8MeasuredSizeMemoryLeakTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        return Collections.singletonList(Browser.IE8.getDesiredCapabilities());
+        return getBrowserCapabilities(Browser.IE8);
     }
 }
index 4013494c494799f8cbf5861fd0d72f9e3018cabd..7bd1de58032d192c14e84e8f6ddfe77d5954e1a7 100644 (file)
@@ -19,7 +19,7 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.openqa.selenium.WebElement;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("push")
index fd34a1f1920b2ba63ad31676d41f49b96e8f1c01..5bac54f0f7cafa0e8e68ee8d7a6792354590cf75 100644 (file)
@@ -20,7 +20,7 @@ import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.support.ui.ExpectedCondition;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.AbstractTB3Test;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
index 03b34655a1bf3479c16a3ff06672414e649ce193..654108f8f90a48d236bf7d3cb98f215f440b7600 100644 (file)
@@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals;
 import org.junit.Test;
 import org.openqa.selenium.WebElement;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("push")
index 4b142500f77d0492b66216ec0d814de327f7a5e2..344f551f004fb251d3b3477e3a1bd82bfcf88706 100644 (file)
@@ -18,7 +18,7 @@ package com.vaadin.tests.push;
 import org.junit.Assert;
 import org.junit.Test;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("push")
index 396160cc7dab2bae503373343714bf499e44f86f..d42352161e04dffee545faf2ecc29b9a9ec86b0b 100644 (file)
@@ -22,7 +22,7 @@ import org.openqa.selenium.WebElement;
 import org.openqa.selenium.support.ui.ExpectedCondition;
 
 import com.vaadin.testbench.elements.NativeSelectElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("push")
index 475fa2165f5a73a1ef7e3007aa7791879def9c93..501d946fcc00c7905e7277c16fb9bda890cefcaa 100644 (file)
@@ -28,13 +28,7 @@ public class PushConfigurationWebSocketTest extends PushConfigurationTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-
-        List<DesiredCapabilities> browsers = super.getBrowsersToTest();
-        browsers.remove(Browser.IE8.getDesiredCapabilities());
-        browsers.remove(Browser.IE9.getDesiredCapabilities());
-        browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities());
-
-        return browsers;
+        return getBrowsersSupportingWebSocket();
     }
 
     @Test
index 1f6e181c89a0a81a31526f7faf191327b1a8ac52..2683868db523d6aeb3b3d45a6f3c4d028ac57f4b 100644 (file)
@@ -21,7 +21,8 @@ import org.openqa.selenium.By;
 import org.openqa.selenium.WebElement;
 
 import com.vaadin.testbench.elements.LabelElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.BrowserUtil;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("push")
index a285d91e9262337b1f94c1719b7dc160efa2db73..fe7ebebef1fa2101a526567be246b0281f2c2571 100644 (file)
@@ -19,7 +19,7 @@ import org.junit.Test;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.support.ui.ExpectedCondition;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("push")
index e37bd32832d6b29a6d96d833637e77333b630597..23255aadea8b42c7a0ba817711fd2ff3d7e6f74c 100644 (file)
@@ -19,7 +19,7 @@ import org.junit.Test;
 import org.openqa.selenium.By;
 import org.openqa.selenium.support.ui.ExpectedConditions;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("push")
index 058ac6cc92e33b90ec6c1536b389ac5512d9f315..0c00cf116f7860650f05c6f2c43c332344df08fd 100644 (file)
@@ -19,7 +19,7 @@ import org.junit.Test;
 import org.openqa.selenium.By;
 import org.openqa.selenium.support.ui.ExpectedConditions;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("push")
index 42babb00d057091b94a4b9c5cc08a27c69f4fb10..47773b87b614251906c861764e152560d7b296ba 100644 (file)
@@ -17,13 +17,12 @@ package com.vaadin.tests.push;
 
 import java.util.List;
 
-import com.vaadin.tests.annotations.TestCategory;
 import org.junit.Assert;
 import org.junit.Test;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
-import com.vaadin.tests.tb3.WebsocketTest;
 
 @TestCategory("push")
 public class RefreshCloseConnectionTest extends MultiBrowserTest {
index a639f7dbe36b91b480202a9befaa1bc435e3e050..69e5de960a2ca3e84cb0f95c4c069abe77ec774c 100644 (file)
@@ -1,10 +1,11 @@
 package com.vaadin.tests.push;
 
+import org.junit.Test;
+
 import com.vaadin.testbench.By;
 import com.vaadin.testbench.elements.TextAreaElement;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
-import org.junit.Test;
 
 @TestCategory("push")
 public abstract class SendMultibyteCharactersTest extends MultiBrowserTest {
index 3ca12fdd84a8531caa418d84701c92081028e763..d93802125c794720d6635bd77f326eeef2cc42b7 100644 (file)
@@ -19,7 +19,7 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.openqa.selenium.WebElement;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("push")
index b4af11b864645372d9bc9a62e4a44bbcaaae7d80..35d0f0ad5fa8ee158c6065144193c3b1444af24b 100644 (file)
@@ -18,7 +18,7 @@ package com.vaadin.tests.push;
 import org.junit.Assert;
 import org.junit.Test;
 
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 @TestCategory("push")
index 3cec3a7bd5f3a72612de378f63128877492af6f1..99ae88805a48a1788bf31c281765426a7c58193b 100644 (file)
 
 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.ArrayList;
@@ -38,22 +32,17 @@ 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.junit.After;
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.runner.RunWith;
 import org.openqa.selenium.By;
 import org.openqa.selenium.JavascriptExecutor;
-import org.openqa.selenium.Platform;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
-import org.openqa.selenium.ie.InternetExplorerDriver;
 import org.openqa.selenium.interactions.HasInputDevices;
 import org.openqa.selenium.interactions.Keyboard;
 import org.openqa.selenium.interactions.Mouse;
 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;
@@ -65,17 +54,17 @@ import com.google.gwt.thirdparty.guava.common.base.Joiner;
 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.testbench.elements.AbstractElement;
+import com.vaadin.testbench.annotations.BrowserConfiguration;
 import com.vaadin.testbench.elements.CheckBoxElement;
 import com.vaadin.testbench.elements.LabelElement;
 import com.vaadin.testbench.elements.TableElement;
 import com.vaadin.testbench.elements.VerticalLayoutElement;
+import com.vaadin.testbench.parallel.Browser;
+import com.vaadin.testbench.parallel.BrowserUtil;
+import com.vaadin.testbench.parallel.ParallelTest;
 import com.vaadin.tests.components.AbstractTestUIWithLog;
-import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
 import com.vaadin.ui.UI;
 
 import elemental.json.JsonObject;
@@ -97,8 +86,8 @@ import elemental.json.impl.JsonUtil;
  * 
  * @author Vaadin Ltd
  */
-@RunWith(value = TB3Runner.class)
-public abstract class AbstractTB3Test extends TestBenchTestCase {
+@RunWith(TB3Runner.class)
+public abstract class AbstractTB3Test extends ParallelTest {
 
     @Rule
     public RetryOnFail retry = new RetryOnFail();
@@ -118,17 +107,9 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
      */
     private static final int BROWSER_TIMEOUT_IN_MS = 30 * 1000;
 
-    private static final int BROWSER_INIT_ATTEMPTS = 5;
-
-    private DesiredCapabilities desiredCapabilities;
-
     private boolean debug = false;
 
     private boolean push = false;
-    {
-        // Default browser to run on unless setDesiredCapabilities is called
-        desiredCapabilities = Browser.FIREFOX.getDesiredCapabilities();
-    }
 
     static {
         com.vaadin.testbench.Parameters
@@ -141,61 +122,14 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
      * 
      * @throws Exception
      */
-    @Before
+    @Override
     public void setup() throws Exception {
-        setupDriver();
-    }
-
-    /**
-     * Creates and configure the web driver to be used for the test. By default
-     * creates a remote web driver which connects to {@link #getHubURL()} and
-     * selects a browser based on {@link #getDesiredCapabilities()}.
-     * 
-     * This method MUST call {@link #setDriver(WebDriver)} with the newly
-     * generated driver.
-     * 
-     * @throws Exception
-     *             If something goes wrong
-     */
-    protected void setupDriver() throws Exception {
-        DesiredCapabilities capabilities;
-
-        Browser runLocallyBrowser = getRunLocallyBrowser();
-        if (runLocallyBrowser != null) {
-            if (System.getenv().containsKey("TEAMCITY_VERSION")) {
-                throw new RuntimeException(
-                        "@RunLocally is not supported for tests run on the build server");
-            }
-            capabilities = runLocallyBrowser.getDesiredCapabilities();
-            setupLocalDriver(capabilities);
-        } else {
-            capabilities = getDesiredCapabilities();
-
-            for (int i = 1; i <= BROWSER_INIT_ATTEMPTS; i++) {
-                try {
-                    if (localWebDriverIsUsed()) {
-                        setupLocalDriver(capabilities);
-                    } else {
-                        setupRemoteDriver(capabilities);
-                    }
-                    break;
-                } catch (Exception e) {
-                    System.err
-                            .println("Browser startup for " + capabilities
-                                    + " failed on attempt " + i + ": "
-                                    + e.getMessage());
-                    if (i == BROWSER_INIT_ATTEMPTS) {
-                        throw e;
-                    }
-                }
-            }
-
-        }
+        super.setup();
 
         int w = SCREENSHOT_WIDTH;
         int h = SCREENSHOT_HEIGHT;
 
-        if (BrowserUtil.isIE8(capabilities)) {
+        if (BrowserUtil.isIE8(super.getDesiredCapabilities())) {
             // IE8 gets size wrong, who would have guessed...
             w += 4;
             h += 4;
@@ -208,12 +142,16 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
 
     }
 
-    protected Browser getRunLocallyBrowser() {
-        RunLocally runLocally = getClass().getAnnotation(RunLocally.class);
-        if (runLocally != null) {
-            return runLocally.value();
-        } else {
-            return null;
+    /**
+     * Method for closing the tested application.
+     */
+    protected void closeApplication() {
+        if (driver != null) {
+            try {
+                openTestURL("closeApplication");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
         }
     }
 
@@ -276,47 +214,6 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
         waitUntilRowIsVisible(table, rowToWait);
     }
 
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target(ElementType.TYPE)
-    public @interface RunLocally {
-        public Browser value() default Browser.FIREFOX;
-    }
-
-    /**
-     * Creates a {@link WebDriver} instance used for running the test locally
-     * for debug purposes. Used only when {@link #runLocally()} is overridden to
-     * return true;
-     */
-    protected abstract void setupLocalDriver(
-            DesiredCapabilities desiredCapabilities);
-
-    /**
-     * Creates a {@link WebDriver} instance used for running the test remotely.
-     * 
-     * @since
-     * @param capabilities
-     *            the type of browser needed
-     * @throws Exception
-     */
-    private void setupRemoteDriver(DesiredCapabilities capabilities)
-            throws Exception {
-        if (BrowserUtil.isIE(capabilities)) {
-            if (requireWindowFocusForIE()) {
-                capabilities.setCapability(
-                        InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, true);
-            }
-            if (!usePersistentHoverForIE()) {
-                capabilities.setCapability(
-                        InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING,
-                        false);
-            }
-        }
-
-        WebDriver dr = TestBench.createDriver(new RemoteWebDriver(new URL(
-                getHubURL()), capabilities));
-        setDriver(dr);
-    }
-
     /**
      * Opens the given test (defined by {@link #getTestUrl()}, optionally with
      * debug window and/or push (depending on {@link #isDebug()} and
@@ -334,7 +231,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
     protected void openTestURL(Class<?> uiClass, String... parameters) {
         String url = getTestURL(uiClass);
 
-        if(parameters.length > 0) {
+        if (parameters.length > 0) {
             url += "?" + Joiner.on("&").join(parameters);
         }
 
@@ -352,28 +249,14 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
 
     /**
      * Returns the full URL to be used for the test for the provided UI class.
-     *
+     * 
      * @return the full URL for the test
      */
     protected String getTestURL(Class<?> uiClass) {
-        return StringUtils.strip(getBaseURL(), "/") + getDeploymentPath(uiClass);
+        return StringUtils.strip(getBaseURL(), "/")
+                + getDeploymentPath(uiClass);
     }
 
-    /**
-     * 
-     * @return the location (URL) of the TB hub
-     */
-    protected String getHubURL() {
-        return "http://" + getHubHostname() + ":4444/wd/hub";
-    }
-
-    /**
-     * Used for building the hub URL to use for the test
-     * 
-     * @return the host name of the TestBench hub
-     */
-    protected abstract String getHubHostname();
-
     /**
      * Used to determine what URL to initially open for the test
      * 
@@ -401,58 +284,12 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
      * 
      * @return The browsers to run the test on
      */
+    @BrowserConfiguration
     public List<DesiredCapabilities> getBrowsersToTest() {
         return Collections.singletonList(Browser.FIREFOX
                 .getDesiredCapabilities());
     }
 
-    /**
-     * Used to determine which capabilities should be used when setting up a
-     * {@link WebDriver} for this test. Typically set by a test runner or left
-     * at its default (Firefox 24). If you want to run a test on a single
-     * browser other than Firefox 24 you can override this method.
-     * 
-     * @return the requested browser capabilities
-     */
-    protected DesiredCapabilities getDesiredCapabilities() {
-        return desiredCapabilities;
-    }
-
-    /**
-     * Sets the requested browser capabilities (typically browser name and
-     * version)
-     * 
-     * @param desiredCapabilities
-     */
-    public void setDesiredCapabilities(DesiredCapabilities desiredCapabilities) {
-        // Make a copy as the desired capabilities can come from a shared,
-        // static resource. This will cause all kinds of problems if some test
-        // modifies the capabilities
-        this.desiredCapabilities = new DesiredCapabilities(desiredCapabilities);
-    }
-
-    /**
-     * Shuts down the driver after the test has been completed
-     * 
-     * @throws Exception
-     */
-    @After
-    public void tearDown() throws Exception {
-        if (driver != null) {
-            try {
-                closeApplication();
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            driver.quit();
-        }
-        driver = null;
-    }
-
-    protected void closeApplication() {
-        openTestURL("closeApplication");
-    }
-
     /**
      * Finds an element based on the part of a TB2 style locator following the
      * :: (e.g. vaadin=runLabelModes::PID_Scheckboxaction-Enabled/domChild[0] ->
@@ -912,264 +749,6 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
         }
     }
 
-    /**
-     * Provides helper method for selecting the browser to run on
-     * 
-     * @author Vaadin Ltd
-     */
-    public static class BrowserUtil {
-        /**
-         * Gets the capabilities for Safari of the given version
-         * 
-         * @param version
-         *            the major version
-         * @return an object describing the capabilities required for running a
-         *         test on the given Safari version
-         */
-        public static DesiredCapabilities safari(int version) {
-            DesiredCapabilities c = DesiredCapabilities.safari();
-            c.setPlatform(Platform.MAC);
-            c.setVersion("" + version);
-            return c;
-        }
-
-        /**
-         * Gets the capabilities for Chrome of the given version
-         * 
-         * @param version
-         *            the major version
-         * @return an object describing the capabilities required for running a
-         *         test on the given Chrome version
-         */
-        public static DesiredCapabilities chrome(int version) {
-            DesiredCapabilities c = DesiredCapabilities.chrome();
-            c.setVersion("" + version);
-            c.setPlatform(Platform.VISTA);
-            return c;
-        }
-
-        /**
-         * Gets the capabilities for Opera of the given version
-         * 
-         * @param version
-         *            the major version
-         * @return an object describing the capabilities required for running a
-         *         test on the given Opera version
-         */
-        public static DesiredCapabilities opera(int version) {
-            DesiredCapabilities c = DesiredCapabilities.opera();
-            c.setVersion("" + version);
-            c.setPlatform(Platform.XP);
-            return c;
-        }
-
-        /**
-         * Gets the capabilities for Firefox of the given version
-         * 
-         * @param version
-         *            the major version
-         * @return an object describing the capabilities required for running a
-         *         test on the given Firefox version
-         */
-        public static DesiredCapabilities firefox(int version) {
-            DesiredCapabilities c = DesiredCapabilities.firefox();
-            c.setVersion("" + version);
-            c.setPlatform(Platform.XP);
-            return c;
-        }
-
-        /**
-         * Gets the capabilities for Internet Explorer of the given version
-         * 
-         * @param version
-         *            the major version
-         * @return an object describing the capabilities required for running a
-         *         test on the given Internet Explorer version
-         */
-        public static DesiredCapabilities ie(int version) {
-            DesiredCapabilities c = DesiredCapabilities.internetExplorer();
-            c.setVersion("" + version);
-            c.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION,
-                    true);
-            return c;
-        }
-
-        /**
-         * Gets the capabilities for PhantomJS of the given version
-         * 
-         * @param version
-         *            the major version
-         * @return an object describing the capabilities required for running a
-         *         test on the given PhantomJS version
-         */
-        public static DesiredCapabilities phantomJS(int version) {
-            DesiredCapabilities c = DesiredCapabilities.phantomjs();
-            c.setPlatform(Platform.LINUX);
-            c.setVersion("" + version);
-            return c;
-        }
-
-        /**
-         * Checks if the given capabilities refer to Internet Explorer 8
-         * 
-         * @param capabilities
-         * @param version
-         * @return true if the capabilities refer to IE8, false otherwise
-         */
-        public static boolean isIE8(DesiredCapabilities capabilities) {
-            return isIE(8, capabilities);
-        }
-
-        /**
-         * Checks if the given capabilities refer to Internet Explorer of the
-         * given version
-         * 
-         * @param capabilities
-         * @param version
-         * @return true if the capabilities refer to IE of the given version,
-         *         false otherwise
-         */
-        public static boolean isIE(int version, DesiredCapabilities capabilities) {
-            return isIE(capabilities)
-                    && ("" + version).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());
-        }
-
-        /**
-         * @param capabilities
-         *            The capabilities to check
-         * @return true if the capabilities refer to PhantomJS, false otherwise
-         */
-        public static boolean isPhantomJS(DesiredCapabilities capabilities) {
-            return BrowserType.PHANTOMJS.equals(capabilities.getBrowserName());
-        }
-
-        /**
-         * Returns a human readable identifier of the given browser. Used for
-         * test naming and screenshots
-         * 
-         * @param capabilities
-         * @return a human readable string describing the capabilities
-         */
-        public static String getBrowserIdentifier(
-                DesiredCapabilities capabilities) {
-            if (isIE(capabilities)) {
-                return "InternetExplorer";
-            } else if (isFirefox(capabilities)) {
-                return "Firefox";
-            } else if (isChrome(capabilities)) {
-                return "Chrome";
-            } else if (isSafari(capabilities)) {
-                return "Safari";
-            } else if (isOpera(capabilities)) {
-                return "Opera";
-            } else if (isPhantomJS(capabilities)) {
-                return "PhantomJS";
-            }
-
-            return capabilities.getBrowserName();
-        }
-
-        /**
-         * Returns a human readable identifier of the platform described by the
-         * given capabilities. Used mainly for screenshots
-         * 
-         * @param capabilities
-         * @return a human readable string describing the platform
-         */
-        public static String getPlatform(DesiredCapabilities capabilities) {
-            if (capabilities.getPlatform() == Platform.WIN8
-                    || capabilities.getPlatform() == Platform.WINDOWS
-                    || capabilities.getPlatform() == Platform.VISTA
-                    || capabilities.getPlatform() == Platform.XP) {
-                return "Windows";
-            } else if (capabilities.getPlatform() == Platform.MAC) {
-                return "Mac";
-            }
-            return capabilities.getPlatform().toString();
-        }
-
-        /**
-         * Returns a string which uniquely (enough) identifies this browser.
-         * Used mainly in screenshot names.
-         * 
-         * @param capabilities
-         * 
-         * @return a unique string for each browser
-         */
-        public static String getUniqueIdentifier(
-                DesiredCapabilities capabilities) {
-            return getUniqueIdentifier(getPlatform(capabilities),
-                    getBrowserIdentifier(capabilities),
-                    capabilities.getVersion());
-        }
-
-        /**
-         * Returns a string which uniquely (enough) identifies this browser.
-         * Used mainly in screenshot names.
-         * 
-         * @param capabilities
-         * 
-         * @return a unique string for each browser
-         */
-        public static String getUniqueIdentifier(
-                DesiredCapabilities capabilities, String versionOverride) {
-            return getUniqueIdentifier(getPlatform(capabilities),
-                    getBrowserIdentifier(capabilities), versionOverride);
-        }
-
-        private static String getUniqueIdentifier(String platform,
-                String browser, String version) {
-            return platform + "_" + browser + "_" + version;
-        }
-
-    }
-
     /**
      * Called by the test runner whenever there is an exception in the test that
      * will cause termination of the test
@@ -1342,17 +921,4 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
     protected void click(CheckBoxElement checkbox) {
         checkbox.findElement(By.xpath("input")).click();
     }
-
-    @Override
-    public boolean isElementPresent(Class<? extends AbstractElement> clazz) {
-        // This is a bug in TB4 as isElementPresent(..) should just return true
-        // or false but can also throw exceptions. The problem is possibly if
-        // this is run when the Vaadin app is not initialized yet
-        try {
-            return super.isElementPresent(clazz);
-        } catch (NoSuchElementException e) {
-            return false;
-        }
-    }
-
 }
index 6736bc399028fcda653a29372e9eff977861d2ec..128214de1e1938275dd8f73129c47c593e767a31 100644 (file)
@@ -1,5 +1,7 @@
 package com.vaadin.tests.tb3;
 
+import java.io.IOException;
+
 import org.junit.runner.RunWith;
 import org.junit.runners.model.InitializationError;
 
@@ -18,7 +20,8 @@ public class AffectedTB3Tests {
 
     public static class AffectedTB3TestSuite extends TB3TestSuite {
 
-        public AffectedTB3TestSuite(Class<?> klass) throws InitializationError {
+        public AffectedTB3TestSuite(Class<?> klass) throws InitializationError,
+                IOException {
             super(klass, AbstractTB3Test.class, "com.vaadin.tests",
                     new String[] { "com.vaadin.tests.integration" },
                     new AffectedTB3TestLocator());
index b7cc8284d1462de1e977cc8cf7da7bcf6d417e38..338855ba1c7ce8e3feb48ba9bd8a7d29d4e1071c 100644 (file)
@@ -16,6 +16,8 @@
 
 package com.vaadin.tests.tb3;
 
+import java.io.IOException;
+
 import org.junit.runner.RunWith;
 import org.junit.runners.model.InitializationError;
 
@@ -32,7 +34,8 @@ public class AllTB3Tests {
 
     public static class AllTB3TestsSuite extends TB3TestSuite {
 
-        public AllTB3TestsSuite(Class<?> klass) throws InitializationError {
+        public AllTB3TestsSuite(Class<?> klass) throws InitializationError,
+                IOException {
             super(klass, AbstractTB3Test.class, "com.vaadin.tests",
                     new String[] { "com.vaadin.tests.integration" });
         }
index 2200566b840c319653ea3dfd945cde0f3e8aa709..3c7030b1e9b8a08b45db855322c8590d4dd9b2fc 100644 (file)
@@ -15,6 +15,8 @@
  */
 package com.vaadin.tests.tb3;
 
+import java.io.IOException;
+
 import org.junit.runner.RunWith;
 import org.junit.runners.model.InitializationError;
 
@@ -31,7 +33,8 @@ import com.vaadin.tests.tb3.ChangedTB3Tests.ChangedTB3TestsSuite;
 @RunWith(ChangedTB3TestsSuite.class)
 public class ChangedTB3Tests {
     public static class ChangedTB3TestsSuite extends TB3TestSuite {
-        public ChangedTB3TestsSuite(Class<?> klass) throws InitializationError {
+        public ChangedTB3TestsSuite(Class<?> klass) throws InitializationError,
+                IOException {
             super(klass, AbstractTB3Test.class, "com.vaadin.tests",
                     new String[] { "com.vaadin.tests.integration" },
                     new ChangedTB3TestLocator());
index 96a22803232cb1aa96bf3c07017ef7c2cdeda26b..71d6b6fab40c2279ff5b7b9e801293bbeb1aed7c 100644 (file)
@@ -19,6 +19,8 @@ import org.junit.Ignore;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 
+import com.vaadin.testbench.parallel.BrowserUtil;
+
 /**
  * Base class for TestBench 3+ tests that use DnD. This class contains utility
  * methods for DnD operations.
index 19f62d69ee73e7b19112fe853f0155d688d06700..acf9d7a815c8f00465a6974f0ef3c034a5163611 100644 (file)
 package com.vaadin.tests.tb3;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
+import org.openqa.selenium.ie.InternetExplorerDriver;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
+import com.vaadin.testbench.parallel.Browser;
+import com.vaadin.testbench.parallel.BrowserUtil;
+
 /**
  * Base class for tests which should be run on all supported browsers. The test
  * is automatically launched for multiple browsers in parallel by the test
@@ -41,100 +44,67 @@ import org.openqa.selenium.remote.DesiredCapabilities;
 public abstract class MultiBrowserTest extends PrivateTB3Configuration {
 
     protected List<DesiredCapabilities> getBrowsersSupportingWebSocket() {
-        List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(
-                getAllBrowsers());
-
-        browsers.remove(Browser.IE8.getDesiredCapabilities());
-        browsers.remove(Browser.IE9.getDesiredCapabilities());
-        browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities());
-
-        return browsers;
+        // No WebSocket support in IE8-9 and PhantomJS
+        return getBrowserCapabilities(Browser.IE10, Browser.IE11,
+                Browser.FIREFOX, Browser.CHROME);
     }
 
     protected List<DesiredCapabilities> getBrowsersExcludingPhantomJS() {
-        List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(
-                getAllBrowsers());
-
-        browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities());
-
-        return browsers;
+        return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10,
+                Browser.IE11, Browser.CHROME, Browser.FIREFOX);
     }
 
     protected List<DesiredCapabilities> getBrowsersExcludingIE() {
-        List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(
-                getAllBrowsers());
-        browsers.remove(Browser.IE8.getDesiredCapabilities());
-        browsers.remove(Browser.IE9.getDesiredCapabilities());
-        browsers.remove(Browser.IE10.getDesiredCapabilities());
-        browsers.remove(Browser.IE11.getDesiredCapabilities());
+        return getBrowserCapabilities(Browser.FIREFOX, Browser.CHROME,
+                Browser.PHANTOMJS);
+    }
 
-        return browsers;
+    protected List<DesiredCapabilities> getBrowsersExcludingIE8() {
+        return getBrowserCapabilities(Browser.IE9, Browser.IE10, Browser.IE11,
+                Browser.FIREFOX, Browser.CHROME, Browser.PHANTOMJS);
     }
 
     protected List<DesiredCapabilities> getBrowsersSupportingShiftClick() {
-        List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(
-                getAllBrowsers());
-
-        // IE supports shift click only when require window focus is true
-        browsers.remove(Browser.FIREFOX.getDesiredCapabilities());
-        browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities());
-
-        return browsers;
+        return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10,
+                Browser.IE11, Browser.CHROME);
     }
 
     protected List<DesiredCapabilities> getIEBrowsersOnly() {
-        List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>();
-        browsers.add(Browser.IE8.getDesiredCapabilities());
-        browsers.add(Browser.IE9.getDesiredCapabilities());
-        browsers.add(Browser.IE10.getDesiredCapabilities());
-        browsers.add(Browser.IE11.getDesiredCapabilities());
-
-        return browsers;
+        return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10,
+                Browser.IE11);
     }
 
-    public enum Browser {
-        FIREFOX(BrowserUtil.firefox(24)), CHROME(BrowserUtil.chrome(40)), SAFARI(
-                BrowserUtil.safari(7)), IE8(BrowserUtil.ie(8)), IE9(BrowserUtil
-                .ie(9)), IE10(BrowserUtil.ie(10)), IE11(BrowserUtil.ie(11)), OPERA(
-                BrowserUtil.opera(17)), PHANTOMJS(BrowserUtil.phantomJS(1));
-        private DesiredCapabilities desiredCapabilities;
-
-        private Browser(DesiredCapabilities desiredCapabilities) {
-            this.desiredCapabilities = desiredCapabilities;
-        }
-
-        public DesiredCapabilities getDesiredCapabilities() {
-            return desiredCapabilities;
+    @Override
+    public void setDesiredCapabilities(DesiredCapabilities desiredCapabilities) {
+        if (BrowserUtil.isIE(desiredCapabilities)) {
+            if (requireWindowFocusForIE()) {
+                desiredCapabilities.setCapability(
+                        InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, true);
+            }
+            if (!usePersistentHoverForIE()) {
+                desiredCapabilities.setCapability(
+                        InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING,
+                        false);
+            }
         }
-    }
 
-    static List<DesiredCapabilities> allBrowsers = new ArrayList<DesiredCapabilities>();
-    static {
-        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(SAFARI);
-        allBrowsers.add(Browser.CHROME.getDesiredCapabilities());
-        allBrowsers.add(Browser.PHANTOMJS.getDesiredCapabilities());
-        // Re-enable this when it is possible to run on a modern Opera version
-        // allBrowsers.add(Browser.OPERA.getDesiredCapabilities());
-    }
-
-    /**
-     * @return all supported browsers which are actively tested
-     */
-    public static List<DesiredCapabilities> getAllBrowsers() {
-        return Collections.unmodifiableList(allBrowsers);
+        super.setDesiredCapabilities(desiredCapabilities);
     }
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        // Return a copy so sub classes can do
-        // super.getBrowseresToTest().remove(something)
-        return new ArrayList<DesiredCapabilities>(getAllBrowsers());
+        // Uncomment Safari and Opera if those become tested browsers again.
+        return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10,
+                Browser.IE11, Browser.FIREFOX, Browser.CHROME,
+                Browser.PHANTOMJS /* , Browser.SAFARI, Browser.OPERA */);
     }
 
+    protected List<DesiredCapabilities> getBrowserCapabilities(
+            Browser... browsers) {
+        List<DesiredCapabilities> capabilities = new ArrayList<DesiredCapabilities>();
+        for (Browser browser : browsers) {
+            capabilities.add(browser.getDesiredCapabilities());
+        }
+        return capabilities;
+    }
 }
index 921fa080cddcf5233d405cd41f98df7832d79ac8..f8b01fb11b23d32938bd799becbae570ad34c867 100755 (executable)
@@ -23,7 +23,7 @@ import org.junit.After;
 import com.jcraft.jsch.JSch;
 import com.jcraft.jsch.JSchException;
 import com.jcraft.jsch.Session;
-import com.vaadin.tests.annotations.TestCategory;
+import com.vaadin.testbench.parallel.TestCategory;
 
 @TestCategory("push")
 public abstract class MultiBrowserTestWithProxy extends MultiBrowserTest {
index a4645262a5ca0b1b17faf04568b5b4d44e10ddf4..8f8e446ce3552ac1678884df13d1ff8e754e0c28 100644 (file)
@@ -22,21 +22,11 @@ import java.io.IOException;
 import java.net.InetAddress;
 import java.net.NetworkInterface;
 import java.net.SocketException;
-import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.Properties;
 
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.chrome.ChromeDriver;
-import org.openqa.selenium.chrome.ChromeOptions;
-import org.openqa.selenium.firefox.FirefoxBinary;
-import org.openqa.selenium.firefox.FirefoxDriver;
-import org.openqa.selenium.phantomjs.PhantomJSDriver;
-import org.openqa.selenium.remote.DesiredCapabilities;
-import org.openqa.selenium.safari.SafariDriver;
-
-import com.vaadin.testbench.TestBench;
-import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
+import com.vaadin.testbench.annotations.BrowserFactory;
+import com.vaadin.testbench.annotations.RunOnHub;
 
 /**
  * Provides values for parameters which depend on where the test is run.
@@ -45,6 +35,8 @@ import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
  * 
  * @author Vaadin Ltd
  */
+@RunOnHub("tb3-hub.intra.itmill.com")
+@BrowserFactory(VaadinBrowserFactory.class)
 public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
     /**
      * 
@@ -101,18 +93,13 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
     @Override
     protected String getHubURL() {
         String hubUrl = getProperty(HUB_URL);
-        if(hubUrl == null || hubUrl.trim().isEmpty()) {
+        if (hubUrl == null || hubUrl.trim().isEmpty()) {
             return super.getHubURL();
         }
 
         return hubUrl;
     }
 
-    @Override
-    protected String getHubHostname() {
-        return "tb3-hub.intra.itmill.com";
-    }
-
     @Override
     protected String getBaseURL() {
         String url = getProperty(DEPLOYMENT_PROPERTY);
@@ -203,81 +190,4 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
         throw new RuntimeException(
                 "No compatible (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) ip address found.");
     }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.tests.tb3.AbstractTB3Test#setupLocalDriver()
-     */
-    @Override
-    protected void setupLocalDriver(DesiredCapabilities desiredCapabilities) {
-        WebDriver driver;
-        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)) {
-            String propertyName = "chrome.driver.path";
-            String chromeDriverPath = getProperty(propertyName);
-            if (chromeDriverPath == null) {
-                throw new RuntimeException(
-                        "You need to install ChromeDriver to use @"
-                                + RunLocally.class.getSimpleName()
-                                + " with Chrome."
-                                + "\nFirst install it from https://code.google.com/p/selenium/wiki/ChromeDriver."
-                                + "\nThen update "
-                                + propertiesFile.getAbsolutePath()
-                                + " to define a property named "
-                                + propertyName
-                                + " containing the path of your local ChromeDriver installation.");
-            }
-            System.setProperty("webdriver.chrome.driver", chromeDriverPath);
-
-            // Tells chrome not to show warning
-            // "You are using an unsupported command-line flag: --ignore-certifcate-errors".
-            // #14319
-            ChromeOptions options = new ChromeOptions();
-            options.addArguments("--test-type ");
-            driver = new ChromeDriver(options);
-        } else if (BrowserUtil.isSafari(desiredCapabilities)) {
-            driver = new SafariDriver();
-        } else if (BrowserUtil.isPhantomJS(desiredCapabilities)) {
-            driver = new PhantomJSDriver();
-        } else {
-            throw new RuntimeException(
-                    "Not implemented support for running locally on "
-                            + BrowserUtil
-                                    .getBrowserIdentifier(desiredCapabilities));
-        }
-        setDriver(TestBench.createDriver(driver));
-        setDesiredCapabilities(desiredCapabilities);
-    }
-
-    @Override
-    protected Browser getRunLocallyBrowser() {
-        Browser runLocallyBrowser = super.getRunLocallyBrowser();
-        if (runLocallyBrowser != null) {
-            // Always use annotation value if present
-            return runLocallyBrowser;
-        }
-
-        String runLocallyValue = getProperty(RUN_LOCALLY_PROPERTY);
-        if (runLocallyValue == null || runLocallyValue.trim().isEmpty()) {
-            return null;
-        }
-
-        String browserName = runLocallyValue.trim().toUpperCase();
-        try {
-            return Browser.valueOf(browserName);
-        } catch (IllegalArgumentException e) {
-            throw new RuntimeException("Invalid " + RUN_LOCALLY_PROPERTY
-                    + " property from " + getSource(RUN_LOCALLY_PROPERTY)
-                    + ": " + runLocallyValue + ". Expected one of "
-                    + Arrays.toString(Browser.values()));
-        }
-    }
 }
index 4a4354d67c1f328ffe5e067f45d9da0cc832d828..f401e0613b2bf18f1621adfa2522923f6ecce3bf 100644 (file)
 
 package com.vaadin.tests.tb3;
 
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileFilter;
-import java.io.FileInputStream;
 import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.imageio.ImageIO;
-
 import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.rules.TestRule;
 import org.junit.rules.TestWatcher;
-import org.openqa.selenium.OutputType;
-import org.openqa.selenium.TakesScreenshot;
+import org.junit.runner.Description;
 import org.openqa.selenium.remote.DesiredCapabilities;
 
 import com.vaadin.testbench.Parameters;
-import com.vaadin.testbench.commands.TestBenchCommands;
+import com.vaadin.testbench.ScreenshotOnFailureRule;
+import com.vaadin.testbench.parallel.BrowserUtil;
+import com.vaadin.testbench.screenshot.ImageFileUtil;
 
 /**
  * Base class which provides functionality for tests which use the automatic
@@ -51,6 +45,29 @@ import com.vaadin.testbench.commands.TestBenchCommands;
  */
 public abstract class ScreenshotTB3Test extends AbstractTB3Test {
 
+    @Rule
+    public ScreenshotOnFailureRule screenshotOnFailure = new ScreenshotOnFailureRule(
+            this, true) {
+
+        @Override
+        protected void failed(Throwable throwable, Description description) {
+            super.failed(throwable, description);
+            closeApplication();
+        }
+
+        @Override
+        protected void succeeded(Description description) {
+            super.succeeded(description);
+            closeApplication();
+        }
+
+        @Override
+        protected File getErrorScreenshotFile(Description description) {
+            return ImageFileUtil
+                    .getErrorScreenshotFile(getScreenshotFailureName());
+        };
+    };
+
     private String screenshotBaseName;
 
     @Rule
@@ -331,48 +348,15 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
 
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * com.vaadin.tests.tb3.AbstractTB3Test#onUncaughtException(java.lang.Throwable
-     * )
-     */
-    @Override
-    public void onUncaughtException(Throwable cause) {
-        super.onUncaughtException(cause);
-        // Grab a "failure" screenshot and store in the errors folder for later
-        // analysis
-        try {
-            TestBenchCommands testBench = testBench();
-            if (testBench != null) {
-                testBench.disableWaitForVaadin();
-            }
-        } catch (Throwable t) {
-            t.printStackTrace();
-        }
-        try {
-            if (driver != null) {
-                BufferedImage screenshotImage = ImageIO
-                        .read(new ByteArrayInputStream(
-                                ((TakesScreenshot) driver)
-                                        .getScreenshotAs(OutputType.BYTES)));
-                ImageIO.write(screenshotImage, "png", new File(
-                        getScreenshotFailureName()));
-            }
-        } catch (Throwable t) {
-            t.printStackTrace();
-        }
-
-    }
-
     /**
      * @return the name of a "failure" image which is stored in the folder
      *         defined by {@link #getScreenshotErrorDirectory()} when the test
      *         fails
      */
     private String getScreenshotFailureName() {
-        return getScreenshotErrorBaseName() + "-failure.png";
+        return getScreenshotBaseName() + "_"
+                + getUniqueIdentifier(getDesiredCapabilities())
+                + "-failure.png";
     }
 
     /**
@@ -409,10 +393,9 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
             Integer versionOverride) {
         String uniqueBrowserIdentifier;
         if (versionOverride == null) {
-            uniqueBrowserIdentifier = BrowserUtil
-                    .getUniqueIdentifier(getDesiredCapabilities());
+            uniqueBrowserIdentifier = getUniqueIdentifier(getDesiredCapabilities());
         } else {
-            uniqueBrowserIdentifier = BrowserUtil.getUniqueIdentifier(
+            uniqueBrowserIdentifier = getUniqueIdentifier(
                     getDesiredCapabilities(), "" + versionOverride);
         }
 
@@ -422,6 +405,40 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
                 + identifier + ".png";
     }
 
+    /**
+     * Returns a string which uniquely (enough) identifies this browser. Used
+     * mainly in screenshot names.
+     * 
+     * @param capabilities
+     * @param versionOverride
+     * 
+     * @return a unique string for each browser
+     */
+    private String getUniqueIdentifier(DesiredCapabilities capabilities,
+            String versionOverride) {
+        return getUniqueIdentifier(BrowserUtil.getPlatform(capabilities),
+                BrowserUtil.getBrowserIdentifier(capabilities), versionOverride);
+    }
+
+    /**
+     * Returns a string which uniquely (enough) identifies this browser. Used
+     * mainly in screenshot names.
+     * 
+     * @param capabilities
+     * 
+     * @return a unique string for each browser
+     */
+    private String getUniqueIdentifier(DesiredCapabilities capabilities) {
+        return getUniqueIdentifier(BrowserUtil.getPlatform(capabilities),
+                BrowserUtil.getBrowserIdentifier(capabilities),
+                capabilities.getVersion());
+    }
+
+    private String getUniqueIdentifier(String platform, String browser,
+            String version) {
+        return platform + "_" + browser + "_" + version;
+    }
+
     /**
      * Returns the base name of the screenshot in the error directory. This is a
      * name so that all files matching {@link #getScreenshotErrorBaseName()}*
index 294d012be5467cb7f73979e42776252564c6f08b..77c56762158dc06c8181bc88c48ad76af9b65cb4 100644 (file)
@@ -16,6 +16,8 @@
 
 package com.vaadin.tests.tb3;
 
+import java.io.IOException;
+
 import org.junit.runner.RunWith;
 import org.junit.runners.model.InitializationError;
 
@@ -27,7 +29,7 @@ public class ServletIntegrationTests {
 
     public static class ServletIntegrationTestSuite extends TB3TestSuite {
         public ServletIntegrationTestSuite(Class<?> klass)
-                throws InitializationError {
+                throws InitializationError, IOException {
             super(klass, AbstractServletIntegrationTest.class,
                     "com.vaadin.tests.integration", new String[] {});
         }
index f5dc3371380ccc87de35d4f08671ff73f7958fc5..960d6b8777fb2cc184ff638b819ae275de1e2ae6 100644 (file)
@@ -20,12 +20,12 @@ import java.util.List;
 
 import org.openqa.selenium.remote.DesiredCapabilities;
 
+import com.vaadin.testbench.parallel.Browser;
+
 public abstract class SingleBrowserTest extends PrivateTB3Configuration {
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        return Collections.unmodifiableList(Collections
-                .singletonList(MultiBrowserTest.Browser.PHANTOMJS
-                        .getDesiredCapabilities()));
+        return Collections.singletonList(Browser.PHANTOMJS
+                .getDesiredCapabilities());
     }
-
 }
index 0d540644bfb4804ed287377be25134098f2724a2..acdef54492cdfb3f69ad89f052d9c2beecdff652 100644 (file)
 
 package com.vaadin.tests.tb3;
 
-import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
-import org.apache.http.params.HttpConnectionParams;
-import org.apache.http.params.HttpParams;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runners.BlockJUnit4ClassRunner;
+import org.apache.http.client.HttpClient;
 import org.junit.runners.Parameterized;
-import org.junit.runners.model.FrameworkMethod;
 import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.Statement;
-import org.openqa.selenium.remote.DesiredCapabilities;
 import org.openqa.selenium.remote.HttpCommandExecutor;
 import org.openqa.selenium.remote.internal.HttpClientFactory;
 
-import com.vaadin.tests.annotations.TestCategory;
-import com.vaadin.tests.tb3.AbstractTB3Test.BrowserUtil;
-import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
+import com.vaadin.testbench.parallel.ParallelRunner;
 
 /**
  * This runner is loosely based on FactoryTestRunner by Ted Young
@@ -53,7 +35,7 @@ import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
  * 
  * @since 7.1
  */
-public class TB3Runner extends BlockJUnit4ClassRunner {
+public class TB3Runner extends ParallelRunner {
 
     /**
      * Socket timeout for HTTP connections to the grid hub. The connection is
@@ -62,24 +44,7 @@ public class TB3Runner extends BlockJUnit4ClassRunner {
      */
     private static final int SOCKET_TIMEOUT = 30 * 60 * 1000;
 
-    /**
-     * This is the total limit of actual JUnit test instances run in parallel
-     */
-    private static final int MAX_CONCURRENT_TESTS;
-
-    /**
-     * This is static so it is shared by all tests running concurrently on the
-     * same machine and thus can limit the number of threads in use.
-     */
-    private static final ExecutorService service;
-
     static {
-        if (localWebDriverIsUsed()) {
-            MAX_CONCURRENT_TESTS = 10;
-        } else {
-            MAX_CONCURRENT_TESTS = 50;
-        }
-        service = Executors.newFixedThreadPool(MAX_CONCURRENT_TESTS);
 
         // reduce socket timeout to avoid tests hanging for three hours
         try {
@@ -89,11 +54,16 @@ public class TB3Runner extends BlockJUnit4ClassRunner {
             field.setAccessible(true);
             field.set(null, new HttpClientFactory() {
                 @Override
-                public HttpParams getHttpParams() {
-                    HttpParams params = super.getHttpParams();
-                    // fifteen minute timeout
-                    HttpConnectionParams.setSoTimeout(params, SOCKET_TIMEOUT);
-                    return params;
+                public HttpClient getGridHttpClient(int connection_timeout,
+                        int socket_timeout) {
+
+                    if (socket_timeout == 0 || socket_timeout > SOCKET_TIMEOUT) {
+                        return super.getGridHttpClient(connection_timeout,
+                                SOCKET_TIMEOUT);
+                    }
+
+                    return super.getGridHttpClient(connection_timeout,
+                            socket_timeout);
                 }
             });
         } catch (Exception e) {
@@ -103,311 +73,8 @@ public class TB3Runner extends BlockJUnit4ClassRunner {
         }
     }
 
-    protected static boolean localWebDriverIsUsed() {
-        String useLocalWebDriver = System.getProperty("useLocalWebDriver");
-
-        return useLocalWebDriver != null
-                && useLocalWebDriver.toLowerCase().equals("true");
-    }
-
     public TB3Runner(Class<?> klass) throws InitializationError {
         super(klass);
-        setScheduler(new ParallelScheduler(service));
-    }
-
-    @Override
-    protected List<FrameworkMethod> computeTestMethods() {
-        List<FrameworkMethod> tests = new LinkedList<FrameworkMethod>();
-
-        if (!AbstractTB3Test.class.isAssignableFrom(getTestClass()
-                .getJavaClass())) {
-            throw new RuntimeException(getClass().getName() + " only supports "
-                    + AbstractTB3Test.class.getName());
-        }
-
-        try {
-            AbstractTB3Test testClassInstance = getTestClassInstance();
-            Collection<DesiredCapabilities> desiredCapabilities = getDesiredCapabilities(testClassInstance);
-
-            TestNameSuffix testNameSuffixProperty = findAnnotation(
-                    testClassInstance.getClass(), TestNameSuffix.class);
-
-            for (FrameworkMethod m : getTestMethods()) {
-                // No browsers available for this test, so we need to
-                // wrap the test method inside IgnoredTestMethod.
-                // This will add @Ignore annotation to it.
-                if (desiredCapabilities.size() <= 0
-                        || categoryIsExcludedOrNotExcplicitlyIncluded()) {
-                    tests.add(new IgnoredTestMethod(m.getMethod()));
-                } else {
-                    for (DesiredCapabilities capabilities : desiredCapabilities) {
-                        TB3Method method = new TB3Method(m.getMethod(),
-                                capabilities);
-                        if (testNameSuffixProperty != null) {
-                            method.setTestNameSuffix("-"
-                                    + System.getProperty(testNameSuffixProperty
-                                            .property()));
-                        }
-                        tests.add(method);
-                    }
-                }
-            }
-        } catch (Exception e) {
-            throw new RuntimeException("Error retrieving browsers to run on", e);
-        }
-
-        return tests;
-    }
-
-    private boolean categoryIsExcludedOrNotExcplicitlyIncluded() {
-        Class<?> c = getTestClass().getJavaClass();
-
-        if (categoryIsExcluded(c)) {
-            return true;
-        }
-
-        if (explicitInclusionIsUsed()) {
-            return !categoryIsIncluded(c);
-        }
-
-        return false;
-    }
-
-    private boolean categoryIsIncluded(Class<?> c) {
-        String include = System.getProperty("categories.include");
-        if (include != null && include.trim().length() > 0) {
-            return hasCategoryFor(c, include.toLowerCase().trim());
-        }
-
-        return false;
-    }
-
-    private static boolean explicitInclusionIsUsed() {
-        String include = System.getProperty("categories.include");
-
-        return include != null && include.trim().length() > 0;
-    }
-
-    private static boolean categoryIsExcluded(Class<?> c) {
-        String exclude = System.getProperty("categories.exclude");
-        if (exclude != null && exclude.trim().length() > 0) {
-            return hasCategoryFor(c, exclude.toLowerCase().trim());
-        }
-
-        return false;
-    }
-
-    private static boolean hasCategoryFor(Class<?> c, String searchString) {
-        if (hasCategory(c)) {
-            return searchString.contains(getCategory(c).toLowerCase());
-        }
-
-        return false;
-    }
-
-    private static boolean hasCategory(Class<?> c) {
-        return c.getAnnotation(TestCategory.class) != null;
-    }
-
-    private static String getCategory(Class<?> c) {
-        return c.getAnnotation(TestCategory.class).value();
-    }
-
-    private List<FrameworkMethod> getTestMethods() {
-        return getTestClass().getAnnotatedMethods(Test.class);
-    }
-
-    /*
-     * Returns a list of desired browser capabilities according to browsers
-     * defined in the test class, filtered by possible filter parameters. Use
-     * {@code @RunLocally} annotation or com.vaadin.testbench.runLocally
-     * property to override all capabilities.
-     */
-    private Collection<DesiredCapabilities> getDesiredCapabilities(
-            AbstractTB3Test testClassInstance) {
-        Collection<DesiredCapabilities> desiredCapabilites = getFilteredCapabilities(testClassInstance);
-
-        Browser runLocallyBrowser = testClassInstance.getRunLocallyBrowser();
-        if (runLocallyBrowser != null) {
-            desiredCapabilites = new ArrayList<DesiredCapabilities>();
-            desiredCapabilites.add(runLocallyBrowser.getDesiredCapabilities());
-        }
-
-        return desiredCapabilites;
-    }
-
-    /*
-     * Takes the desired browser capabilities defined in the test class and
-     * returns a list of browser capabilities filtered browsers.include and
-     * browsers.exclude system properties. (if present)
-     */
-    private Collection<DesiredCapabilities> getFilteredCapabilities(
-            AbstractTB3Test testClassInstance) {
-        Collection<DesiredCapabilities> desiredCapabilites = testClassInstance
-                .getBrowsersToTest();
-
-        ArrayList<DesiredCapabilities> filteredCapabilities = new ArrayList<DesiredCapabilities>();
-
-        String include = System.getProperty("browsers.include");
-        String exclude = System.getProperty("browsers.exclude");
-
-        for (DesiredCapabilities d : desiredCapabilites) {
-            String browserName = (d.getBrowserName() + d.getVersion())
-                    .toLowerCase();
-            if (include != null && include.trim().length() > 0) {
-                if (include.trim().toLowerCase().contains(browserName)) {
-                    filteredCapabilities.add(d);
-                }
-            } else {
-                filteredCapabilities.add(d);
-            }
-
-            if (exclude != null && exclude.trim().length() > 0) {
-                if (exclude.trim().toLowerCase().contains(browserName)) {
-                    filteredCapabilities.remove(d);
-                }
-            }
-
-        }
-        return filteredCapabilities;
-    }
-
-    private AbstractTB3Test getTestClassInstance()
-            throws InstantiationException, IllegalAccessException,
-            InvocationTargetException {
-        AbstractTB3Test testClassInstance = (AbstractTB3Test) getTestClass()
-                .getOnlyConstructor().newInstance();
-        return testClassInstance;
-    }
-
-    // This is a FrameworkMethod class that will always
-    // return @Ignore and @Test annotations for the wrapped method.
-    private class IgnoredTestMethod extends FrameworkMethod {
-
-        private class IgnoreTestAnnotations {
-
-            // We use this method to easily get our hands on
-            // the Annotation instances for @Ignore and @Test
-            @Ignore
-            @Test
-            public void ignoredTest() {
-            }
-        }
-
-        public IgnoredTestMethod(Method method) {
-            super(method);
-        }
-
-        @Override
-        public Annotation[] getAnnotations() {
-            return getIgnoredTestMethod().getAnnotations();
-        }
-
-        private Method getIgnoredTestMethod() {
-            try {
-                return IgnoreTestAnnotations.class.getMethod("ignoredTest",
-                        null);
-            } catch (Exception e) {
-                return null;
-            }
-
-        }
-
-        @Override
-        public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
-            return getIgnoredTestMethod().getAnnotation(annotationType);
-        }
-    }
-
-    /**
-     * Finds the given annotation in the given class or one of its super
-     * classes. Return the first found annotation
-     * 
-     * @param searchClass
-     * @param annotationClass
-     * @return
-     */
-    private <T extends Annotation> T findAnnotation(Class<?> searchClass,
-            Class<T> annotationClass) {
-        if (searchClass == Object.class) {
-            return null;
-        }
-
-        if (searchClass.getAnnotation(annotationClass) != null) {
-            return searchClass.getAnnotation(annotationClass);
-        }
-
-        return findAnnotation(searchClass.getSuperclass(), annotationClass);
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.junit.runners.BlockJUnit4ClassRunner#withBefores(org.junit.runners
-     * .model.FrameworkMethod, java.lang.Object,
-     * org.junit.runners.model.Statement)
-     */
-    @Override
-    protected Statement withBefores(final FrameworkMethod method,
-            final Object target, Statement statement) {
-        if (!(method instanceof TB3Method)) {
-            throw new RuntimeException("Unexpected method type "
-                    + method.getClass().getName() + ", expected TB3Method");
-        }
-        final TB3Method tb3method = (TB3Method) method;
-
-        // setDesiredCapabilities before running the real @Befores (which use
-        // capabilities)
-
-        final Statement realBefores = super.withBefores(method, target,
-                statement);
-        return new Statement() {
-
-            @Override
-            public void evaluate() throws Throwable {
-                ((AbstractTB3Test) target)
-                        .setDesiredCapabilities(tb3method.capabilities);
-                try {
-                    realBefores.evaluate();
-                } catch (Throwable t) {
-                    // Give the test a chance to e.g. produce an error
-                    // screenshot before failing the test by re-throwing the
-                    // exception
-                    ((AbstractTB3Test) target).onUncaughtException(t);
-                    throw t;
-                }
-            }
-        };
-    }
-
-    private static class TB3Method extends FrameworkMethod {
-        private DesiredCapabilities capabilities;
-        private String testNameSuffix = "";
-
-        public TB3Method(Method method, DesiredCapabilities capabilities) {
-            super(method);
-            this.capabilities = capabilities;
-        }
-
-        public void setTestNameSuffix(String testNameSuffix) {
-            this.testNameSuffix = testNameSuffix;
-        }
-
-        @Override
-        public Object invokeExplosively(final Object target, Object... params)
-                throws Throwable {
-            // Executes the test method with the supplied parameters
-            return super.invokeExplosively(target);
-        }
-
-        @Override
-        public String getName() {
-            return String.format("%s[%s]", getMethod().getName()
-                    + testNameSuffix,
-                    BrowserUtil.getUniqueIdentifier(capabilities));
-        }
-
     }
 
 }
index b0554ce0f6f9e6ef32ab6bbce7c72976dd64a3d1..c68d59a4eb2bdcefbcd10ed9bb176577ed632161 100644 (file)
 
 package com.vaadin.tests.tb3;
 
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
+import java.io.IOException;
 
-import org.junit.runners.Suite;
 import org.junit.runners.model.InitializationError;
 
+import com.vaadin.testbench.parallel.ParallelTestSuite;
+
 /**
  * Test suite which consists of all the TB3 tests passed in the constructor.
  * Runs the tests in parallel using a {@link ParallelScheduler}
  * 
  * @author Vaadin Ltd
  */
-public class TB3TestSuite extends Suite {
-
-    /**
-     * This only restricts the number of test suites running concurrently. The
-     * number of tests to run concurrently are configured in {@link TB3Runner}.
-     */
-    private static final int MAX_CONCURRENT_TEST_SUITES = 20;
-
-    /**
-     * This is static so it is shared by all test suites running concurrently on
-     * the same machine and thus can limit the number of threads in use.
-     */
-    private final ExecutorService service = Executors
-            .newFixedThreadPool(MAX_CONCURRENT_TEST_SUITES);
+public class TB3TestSuite extends ParallelTestSuite {
 
     public TB3TestSuite(Class<?> klass,
             Class<? extends AbstractTB3Test> baseClass, String basePackage,
-            String[] ignorePackages) throws InitializationError {
+            String[] ignorePackages) throws InitializationError, IOException {
         this(klass, baseClass, basePackage, ignorePackages,
                 new TB3TestLocator());
     }
 
     public TB3TestSuite(Class<?> klass,
             Class<? extends AbstractTB3Test> baseClass, String basePackage,
-            String[] ignorePackages, TB3TestLocator testLocator)
-            throws InitializationError {
-        super(klass, testLocator.findTests(baseClass, basePackage,
-                ignorePackages));
-        setScheduler(new ParallelScheduler(service));
+            String[] ignorePackages, TB3TestLocator locator)
+            throws InitializationError, IOException {
+        super(klass, locator
+                .findClasses(baseClass, basePackage, ignorePackages).toArray(
+                        new Class<?>[] {}));
     }
 }
diff --git a/uitest/src/com/vaadin/tests/tb3/TestNameSuffix.java b/uitest/src/com/vaadin/tests/tb3/TestNameSuffix.java
deleted file mode 100644 (file)
index 615cd8d..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.tests.tb3;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Defines a system property to be used as part of the test name
- */
-@Retention(RetentionPolicy.RUNTIME)
-public @interface TestNameSuffix {
-
-    String property();
-
-}
diff --git a/uitest/src/com/vaadin/tests/tb3/VaadinBrowserFactory.java b/uitest/src/com/vaadin/tests/tb3/VaadinBrowserFactory.java
new file mode 100644 (file)
index 0000000..f55b434
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.tb3;
+
+import org.openqa.selenium.Platform;
+import org.openqa.selenium.ie.InternetExplorerDriver;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.testbench.parallel.Browser;
+import com.vaadin.testbench.parallel.DefaultBrowserFactory;
+
+public class VaadinBrowserFactory extends DefaultBrowserFactory {
+
+    @Override
+    public DesiredCapabilities create(Browser browser) {
+        switch (browser) {
+        case IE8:
+            return createIE(browser, "8");
+        case IE9:
+            return createIE(browser, "9");
+        case IE10:
+            return createIE(browser, "10");
+        case IE11:
+            return createIE(browser, "11");
+        case PHANTOMJS:
+            return create(browser, "1", Platform.LINUX);
+        case CHROME:
+            return create(browser, "40", Platform.VISTA);
+        case FIREFOX:
+        default:
+            return create(browser, "24", Platform.XP);
+        }
+    }
+
+    private DesiredCapabilities createIE(Browser browser, String version) {
+        DesiredCapabilities capabilities = create(browser, version,
+                Platform.WINDOWS);
+        capabilities.setCapability(
+                InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
+        return capabilities;
+    }
+
+    @Override
+    public DesiredCapabilities create(Browser browser, String version) {
+        return create(browser);
+    }
+}
index 7f65357a656844a126d766ee12c8d7e246005cb9..ee8cab22fd21b169eec558c4a870eca7ec595fd3 100644 (file)
  */
 package com.vaadin.tests.tb3;
 
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
 import org.openqa.selenium.remote.DesiredCapabilities;
 
-import com.vaadin.tests.annotations.TestCategory;
-import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
+import com.vaadin.testbench.parallel.TestCategory;
 
 /**
  * A {@link MultiBrowserTest} which restricts the tests to the browsers which
@@ -39,7 +36,6 @@ public abstract class WebsocketTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        return new ArrayList<DesiredCapabilities>(
-                getBrowsersSupportingWebSocket());
+        return getBrowsersSupportingWebSocket();
     }
 }
index e5213b21b585d9fb791cb691e1b41e7ef19117e2..40475afd3c2f4ba321e9efa36a5a958685dbc87e 100644 (file)
@@ -5,7 +5,7 @@ import java.util.List;
 import org.openqa.selenium.WebElement;
 
 import com.vaadin.testbench.By;
-import com.vaadin.testbench.elements.ServerClass;
+import com.vaadin.testbench.elementsbase.ServerClass;
 
 @ServerClass("com.vaadin.ui.Calendar")
 public class CalendarElement extends
index ff7715e281bc924278a02aa4543cdf5579f52bed..a3eb952ea7fec40dbbecab8947aa48943e0cd48f 100644 (file)
@@ -6,16 +6,18 @@ import org.openqa.selenium.support.ui.WebDriverWait;
 
 import com.vaadin.testbench.By;
 import com.vaadin.testbench.elements.NotificationElement;
-import com.vaadin.testbench.elements.ServerClass;
+import com.vaadin.testbench.elementsbase.ServerClass;
 
 @ServerClass("com.vaadin.ui.Notification")
 public class FixedNotificationElement extends NotificationElement {
+    @Override
     public String getCaption() {
         WebElement popup = findElement(By.className("popupContent"));
         WebElement caption = popup.findElement(By.tagName("h1"));
         return caption.getText();
     }
 
+    @Override
     public void close() {
         click();
         WebDriverWait wait = new WebDriverWait(getDriver(), 10);
index 9e3433f1af1d8cbf84b078039e07b308d3776aff..34344324d03ab0ac05bf0a901c1d11650d7bdc6e 100644 (file)
@@ -4,7 +4,7 @@ import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 
 import com.vaadin.testbench.By;
-import com.vaadin.testbench.elements.ServerClass;
+import com.vaadin.testbench.elementsbase.ServerClass;
 
 /*
  Suggestions for new elemental api for Window
@@ -59,6 +59,7 @@ public class WindowElement extends com.vaadin.testbench.elements.WindowElement {
     /**
      * @return the caption of the window
      */
+    @Override
     public String getCaption() {
         return findElement(By.className("v-window-header")).getText();
     }
index a5657c4eec39d53b049971c0a0303e89e480127e..79da9f902db450d5e0df8dcc9df1097d37d62b61 100644 (file)
  */
 package com.vaadin.tests.themes;
 
-import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.tests.tb3.MultiBrowserTest;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.io.IOException;
+import java.util.List;
+
 import org.junit.Test;
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebDriver;
@@ -24,11 +28,8 @@ import org.openqa.selenium.WebElement;
 import org.openqa.selenium.remote.DesiredCapabilities;
 import org.openqa.selenium.support.ui.ExpectedCondition;
 
-import java.io.IOException;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.MatcherAssert.assertThat;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class ThemeChangeOnTheFlyTest extends MultiBrowserTest {
 
@@ -36,9 +37,7 @@ public class ThemeChangeOnTheFlyTest extends MultiBrowserTest {
     public List<DesiredCapabilities> getBrowsersToTest() {
         // Seems like stylesheet onload is not fired on PhantomJS
         // https://github.com/ariya/phantomjs/issues/12332
-        List<DesiredCapabilities> l = super.getBrowsersToTest();
-        l.remove(Browser.PHANTOMJS.getDesiredCapabilities());
-        return l;
+        return getBrowsersExcludingPhantomJS();
     }
 
     @Test
index 87827b1358999c0979c58ebb41afb17942dd0b18..137b845e52664134906eaf77f8e0325f1181bf21 100644 (file)
@@ -19,12 +19,10 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
 
 import java.io.IOException;
-import java.util.List;
 
 import org.junit.Test;
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebElement;
-import org.openqa.selenium.remote.DesiredCapabilities;
 
 import com.vaadin.testbench.elements.UploadElement;
 import com.vaadin.tests.tb3.MultiBrowserTest;
@@ -36,11 +34,6 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
  */
 public class ImmediateUploadTest extends MultiBrowserTest {
 
-    @Override
-    public List<DesiredCapabilities> getBrowsersToTest() {
-        return getAllBrowsers();
-    }
-
     @Override
     public void setup() throws Exception {
         super.setup();
index 9159b71961595768ef0e41eca08a3694d37a816c..efe194d28af25e4610c8c5e22dc1301a01f27c15 100644 (file)
@@ -36,12 +36,7 @@ public class TextFieldBevelTest extends MultiBrowserTest {
 
     @Override
     public List<DesiredCapabilities> getBrowsersToTest() {
-        List<DesiredCapabilities> browsers = super.getBrowsersToTest();
-
-        // IE8 doesn't support box-shadow.
-        browsers.remove(Browser.IE8.getDesiredCapabilities());
-
-        return browsers;
+        return getBrowsersExcludingIE8();
     }
 
     @Test
index 13b0c7144c25899d7747649492fc675d7e46fb0c..3ab224f105f66a8c3550c25ae419dc120653530e 100644 (file)
@@ -24,6 +24,7 @@ import com.vaadin.testbench.elements.CheckBoxElement;
 import com.vaadin.testbench.elements.CssLayoutElement;
 import com.vaadin.testbench.elements.LabelElement;
 import com.vaadin.testbench.elements.TreeElement;
+import com.vaadin.testbench.parallel.BrowserUtil;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class ValoThemeUITest extends MultiBrowserTest {
index 8ae016f1e296e250043602ca45fb5be4d014f0d3..d3458a412b6a8367420d9e51391ac191e5599f5a 100644 (file)
@@ -10,6 +10,7 @@
     <property name="useLocalWebDriver" value="false" />
     <property name="com.vaadin.testbench.max.retries" value="0" />
     <property name="com.vaadin.testbench.hub.url" value="" />
+    <property name="vaadin.testbench.developer.license" value="" />
     <property name="junit.test.suite" value="com.vaadin.tests.tb3.AllTB3Tests" />
 
     <ivy:resolve file="${tb3test.dir}/ivy.xml" conf="build, build-provided" />
@@ -19,7 +20,8 @@
         <path location="${tb3test.dir}/result/classes" />
     </path>
 
-    <target name="run-all-tb3-tests" unless="tests.tb3.skip" description="Run all the TB3 tests (except server tests) in the project">
+    <target name="run-all-tb3-tests" unless="tests.tb3.skip"
+        description="Run all the TB3 tests (except server tests) in the project">
         <antcall target="run-tb3-suite" />
     </target>
 
@@ -41,6 +43,7 @@
             <jvmarg value="-DuseLocalWebDriver=${useLocalWebDriver}" />
             <jvmarg value="-Dcom.vaadin.testbench.max.retries=${com.vaadin.testbench.max.retries}" />
             <jvmarg value="-Dcom.vaadin.testbench.hub.url=${com.vaadin.testbench.hub.url}" />
+            <jvmarg value="-Dvaadin.testbench.developer.license=${vaadin.testbench.developer.license}" />
             <test name="${junit.test.suite}" todir="${report.dir}" />
         </junit>