]> source.dussan.org Git - vaadin-framework.git/commitdiff
Retry local driver in the same way as remote driver
authorArtur Signell <artur@vaadin.com>
Sat, 16 Aug 2014 17:31:42 +0000 (20:31 +0300)
committerVaadin Code Review <review@vaadin.com>
Wed, 20 Aug 2014 11:07:22 +0000 (11:07 +0000)
PhantomJS sometimes fails to start properly in validation builds

Change-Id: I768dd4c7fd67d7e05d25311f8e309d3b9764d11b

uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java

index b892fbe4a0f0e133e10146c65c85a9bde7c1442a..8142c3ae6b82f009f55f71d54155191e73483401 100644 (file)
@@ -156,11 +156,25 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
         } else {
             capabilities = getDesiredCapabilities();
 
-            if (localWebDriverIsUsed()) {
-                setupLocalDriver(capabilities);
-            } else {
-                setupRemoteDriver(capabilities);
+            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;
+                    }
+                }
             }
+
         }
 
         int w = SCREENSHOT_WIDTH;
@@ -260,21 +274,9 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
                     usePersistentHoverForIE());
         }
 
-        for (int i = 1; i <= BROWSER_INIT_ATTEMPTS; i++) {
-            try {
-                WebDriver dr = TestBench.createDriver(new RemoteWebDriver(
-                        new URL(getHubURL()), capabilities));
-                setDriver(dr);
-                return;
-            } catch (Exception e) {
-                System.err.println("Browser startup for " + capabilities
-                        + " failed on attempt " + i + ": " + e.getMessage());
-                if (i == BROWSER_INIT_ATTEMPTS) {
-                    throw e;
-                }
-            }
-        }
-
+        WebDriver dr = TestBench.createDriver(new RemoteWebDriver(new URL(
+                getHubURL()), capabilities));
+        setDriver(dr);
     }
 
     /**