]> source.dussan.org Git - vaadin-framework.git/commitdiff
Re-enable running tests locally with property
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Mon, 9 Mar 2015 10:35:04 +0000 (12:35 +0200)
committerLeif Åstrand <leif@vaadin.com>
Fri, 20 Mar 2015 11:42:45 +0000 (13:42 +0200)
Change-Id: I6eed0dc802ca101c929a5bc3cb6f3141060524a3

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

index 8f8e446ce3552ac1678884df13d1ff8e754e0c28..05ffa995118cfc5b5bab460007737691864afcbd 100644 (file)
@@ -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) {