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.
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) {