]> source.dussan.org Git - vaadin-framework.git/commitdiff
Do not automatically change DesiredCapabilities so equals works the way tests expect
authorArtur Signell <artur@vaadin.com>
Thu, 21 Aug 2014 08:38:22 +0000 (11:38 +0300)
committerVaadin Code Review <review@vaadin.com>
Thu, 21 Aug 2014 09:58:18 +0000 (09:58 +0000)
Change-Id: I573f0a7f8544742396fcd5927bc3292350754c6d

uitest/src/com/vaadin/tests/components/table/CtrlShiftMultiselectTest.java
uitest/src/com/vaadin/tests/components/table/SelectAllRowsTest.java
uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java

index 255a798594e88ea847ea767a998491bbce65ffb6..026d672044275753900fdd4a90b1037df4585877 100644 (file)
@@ -40,11 +40,8 @@ public class CtrlShiftMultiselectTest extends MultiBrowserTest {
     }
 
     @Override
-    protected DesiredCapabilities getDesiredCapabilities() {
-        DesiredCapabilities cap = new DesiredCapabilities(
-                super.getDesiredCapabilities());
-        cap.setCapability("requireWindowFocus", true);
-        return cap;
+    protected boolean requireWindowFocusForIE() {
+        return true;
     }
 
     @Test
index 0fc09adf40a06720f42cd522b2ff5fffd6246698..d4e844175706b4a9de7e0d83d983411937acc83a 100644 (file)
@@ -35,14 +35,9 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
 
 public class SelectAllRowsTest extends MultiBrowserTest {
 
-    private final static String TABLE_ROW = "v-table-row";
-
     @Override
-    protected DesiredCapabilities getDesiredCapabilities() {
-        DesiredCapabilities cap = new DesiredCapabilities(
-                super.getDesiredCapabilities());
-        cap.setCapability("requireWindowFocus", true);
-        return cap;
+    protected boolean requireWindowFocusForIE() {
+        return true;
     }
 
     @Override
index 8142c3ae6b82f009f55f71d54155191e73483401..d2313a0709e3fd3c4fedc951137e2227a7ce044b 100644 (file)
@@ -266,12 +266,15 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
     private void setupRemoteDriver(DesiredCapabilities capabilities)
             throws Exception {
         if (BrowserUtil.isIE(capabilities)) {
-            capabilities.setCapability(
-                    InternetExplorerDriver.REQUIRE_WINDOW_FOCUS,
-                    requireWindowFocusForIE());
-            capabilities.setCapability(
-                    InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING,
-                    usePersistentHoverForIE());
+            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(
@@ -383,7 +386,10 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
      * @param desiredCapabilities
      */
     public void setDesiredCapabilities(DesiredCapabilities desiredCapabilities) {
-        this.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);
     }
 
     /**
@@ -958,10 +964,25 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
          * 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(capabilities) && "8".equals(capabilities.getVersion());
+            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());
         }
 
         /**