summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2014-05-15 15:22:49 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2014-05-19 10:34:06 +0300
commitf2597f7496241bfb3836fce0c0d3d1aa90a2f6dc (patch)
tree4552acd500802544e53296a34160c97e7b27224e
parentdd7bcd16def9d8f7fb4e6f16f36966640fa271da (diff)
downloadvaadin-framework-f2597f7496241bfb3836fce0c0d3d1aa90a2f6dc.tar.gz
vaadin-framework-f2597f7496241bfb3836fce0c0d3d1aa90a2f6dc.zip
Add build parameters to allow running test on local PhantomJS
Change-Id: I99f37403d58385a814347d36b0f8b1a35c63c282
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java10
-rw-r--r--uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java4
-rw-r--r--uitest/src/com/vaadin/tests/tb3/TB3Runner.java14
3 files changed, 21 insertions, 7 deletions
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index 7be55ff298..3745d60fd8 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -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;
diff --git a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
index 97150f96ab..305caf1cb5 100644
--- a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
+++ b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
@@ -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 "
diff --git a/uitest/src/com/vaadin/tests/tb3/TB3Runner.java b/uitest/src/com/vaadin/tests/tb3/TB3Runner.java
index 053f8e2c30..69880008ff 100644
--- a/uitest/src/com/vaadin/tests/tb3/TB3Runner.java
+++ b/uitest/src/com/vaadin/tests/tb3/TB3Runner.java
@@ -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);