summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2016-04-28 08:54:26 +0300
committerHenri Sara <hesara@vaadin.com>2016-04-28 08:54:26 +0300
commitae44989b05eed41de6b8ee54dd886ad01e89e78c (patch)
treebbd4fcdd201d9ce19b7569f535dc477ad70af08a /uitest
parent4410535d9accffe4cb3180359010f39d00453039 (diff)
downloadvaadin-framework-ae44989b05eed41de6b8ee54dd886ad01e89e78c.tar.gz
vaadin-framework-ae44989b05eed41de6b8ee54dd886ad01e89e78c.zip
Add a way to override browser factory
Use the parameter browser.factory to select a class implementing TestBenchBrowserFactory. Change-Id: Ibc1f11ad83f8ac1ed85766892cfa0463af9bf440
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/VaadinBrowserFactory.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/VaadinBrowserFactory.java b/uitest/src/test/java/com/vaadin/tests/tb3/VaadinBrowserFactory.java
index 294fe440d0..19ef7a5db1 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/VaadinBrowserFactory.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/VaadinBrowserFactory.java
@@ -15,17 +15,44 @@
*/
package com.vaadin.tests.tb3;
+import java.util.logging.Logger;
+
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;
+import com.vaadin.testbench.parallel.TestBenchBrowserFactory;
public class VaadinBrowserFactory extends DefaultBrowserFactory {
+ TestBenchBrowserFactory delegate = null;
+
@Override
public DesiredCapabilities create(Browser browser) {
+ String browserFactoryClass = System.getProperty("browser.factory");
+ if (browserFactoryClass != null
+ && !browserFactoryClass.trim().isEmpty()) {
+ if (delegate == null) {
+ getLogger()
+ .info("Using browser factory " + browserFactoryClass);
+ try {
+ delegate = (TestBenchBrowserFactory) getClass()
+ .getClassLoader().loadClass(browserFactoryClass)
+ .newInstance();
+ } catch (Exception e) {
+ getLogger().warning("Failed to instantiate browser factory " + browserFactoryClass);
+ throw new RuntimeException(e);
+ }
+ }
+ return delegate.create(browser);
+ }
+
+ return doCreate(browser);
+ }
+
+ public DesiredCapabilities doCreate(Browser browser) {
switch (browser) {
case IE8:
return createIE(browser, "8");
@@ -59,4 +86,8 @@ public class VaadinBrowserFactory extends DefaultBrowserFactory {
capabilities.setVersion(version);
return capabilities;
}
+
+ private static final Logger getLogger() {
+ return Logger.getLogger(VaadinBrowserFactory.class.getName());
+ }
}