From 342962d2a43e033d1d52ecdaee2f7e3a87fbdea2 Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Mon, 9 Mar 2015 12:35:04 +0200 Subject: [PATCH] Re-enable running tests locally with property Change-Id: I6eed0dc802ca101c929a5bc3cb6f3141060524a3 --- .../tests/tb3/PrivateTB3Configuration.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java index 8f8e446ce3..05ffa99511 100644 --- a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java +++ b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java @@ -25,8 +25,11 @@ import java.net.SocketException; import java.util.Enumeration; import java.util.Properties; +import org.openqa.selenium.remote.DesiredCapabilities; + import com.vaadin.testbench.annotations.BrowserFactory; import com.vaadin.testbench.annotations.RunOnHub; +import com.vaadin.testbench.parallel.Browser; /** * Provides values for parameters which depend on where the test is run. @@ -50,16 +53,38 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { private static final Properties properties = new Properties(); private static final File propertiesFile = new File("work", "eclipse-run-selected-test.properties"); + static { if (propertiesFile.exists()) { try { properties.load(new FileInputStream(propertiesFile)); + if (properties.containsKey(RUN_LOCALLY_PROPERTY)) { + System.setProperty("useLocalWebDriver", "true"); + DesiredCapabilities localBrowser = getRunLocallyCapabilities(); + System.setProperty( + "browsers.include", + localBrowser.getBrowserName() + + localBrowser.getVersion()); + } } catch (IOException e) { throw new RuntimeException(e); } } } + private static DesiredCapabilities getRunLocallyCapabilities() { + Browser localBrowser; + try { + localBrowser = Browser.valueOf(properties.getProperty( + RUN_LOCALLY_PROPERTY).toUpperCase()); + } catch (Exception e) { + System.err.println(e.getMessage()); + System.err.println("Falling back to FireFox"); + localBrowser = Browser.FIREFOX; + } + return localBrowser.getDesiredCapabilities(); + } + protected static String getProperty(String name) { String property = properties.getProperty(name); if (property == null) { -- 2.39.5