]> source.dussan.org Git - vaadin-framework.git/commitdiff
Add build parameters to allow running test on local PhantomJS
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Thu, 15 May 2014 12:22:49 +0000 (15:22 +0300)
committerTeemu Suo-Anttila <teemusa@vaadin.com>
Mon, 19 May 2014 07:34:06 +0000 (10:34 +0300)
Change-Id: I99f37403d58385a814347d36b0f8b1a35c63c282

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

index 7be55ff298bf4102abe18340bd95c422f0f9046a..3745d60fd82991a1a8fab9cbc81b02605919e48e 100644 (file)
@@ -126,9 +126,13 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
         } else {
             capabilities = getDesiredCapabilities();
 
-            WebDriver dr = TestBench.createDriver(new RemoteWebDriver(new URL(
-                    getHubURL()), capabilities));
-            setDriver(dr);
+            if (System.getProperty("useLocalWebDriver") != null) {
+                setupLocalDriver(capabilities);
+            } else {
+                WebDriver dr = TestBench.createDriver(new RemoteWebDriver(
+                        new URL(getHubURL()), capabilities));
+                setDriver(dr);
+            }
         }
 
         int w = SCREENSHOT_WIDTH;
index 97150f96abc4c5294bdedafe2ad2ee8c57d42901..305caf1cb5c415637fb9d9a3d14a76659e12373b 100644 (file)
@@ -25,11 +25,11 @@ import java.net.SocketException;
 import java.util.Enumeration;
 import java.util.Properties;
 
-import org.apache.commons.io.IOUtils;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.chrome.ChromeDriver;
 import org.openqa.selenium.firefox.FirefoxBinary;
 import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.phantomjs.PhantomJSDriver;
 import org.openqa.selenium.remote.DesiredCapabilities;
 import org.openqa.selenium.safari.SafariDriver;
 
@@ -185,6 +185,8 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
             driver = new ChromeDriver();
         } 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 "
index 053f8e2c3061aba848f3cda73c0aec526bee73d6..69880008ffc5ccaa3767d78d4f9ca96f05730c3b 100644 (file)
@@ -52,14 +52,22 @@ public class TB3Runner extends BlockJUnit4ClassRunner {
     /**
      * This is the total limit of actual JUnit test instances run in parallel
      */
-    private static final int MAX_CONCURRENT_TESTS = 50;
+    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 = Executors
-            .newFixedThreadPool(MAX_CONCURRENT_TESTS);
+    private static final ExecutorService service;
+
+    static {
+        if (System.getProperty("useLocalWebDriver") != null) {
+            MAX_CONCURRENT_TESTS = 10;
+        } else {
+            MAX_CONCURRENT_TESTS = 50;
+        }
+        service = Executors.newFixedThreadPool(MAX_CONCURRENT_TESTS);
+    }
 
     public TB3Runner(Class<?> klass) throws InitializationError {
         super(klass);