use of org.openqa.selenium.Platform in project zalenium by zalando.
the class ParallelIT method startWebDriverAndGetBaseUrl.
@BeforeMethod(alwaysRun = true)
public void startWebDriverAndGetBaseUrl(Method method, Object[] testArgs) throws MalformedURLException {
String zaleniumUrl = String.format("http://%s:%s/wd/hub", ZALENIUM_HOST, ZALENIUM_PORT);
String browserType = testArgs[0].toString();
Platform platform = (Platform) testArgs[1];
boolean localTesting = false;
if (testArgs.length > 2) {
localTesting = testArgs[2] != null && (boolean) testArgs[2];
}
LOGGER.info("STARTING {} on {} - {}, using {}", method.getName(), browserType, platform.name(), zaleniumUrl);
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(CapabilityType.BROWSER_NAME, browserType);
desiredCapabilities.setCapability(CapabilityType.PLATFORM_NAME, platform);
desiredCapabilities.setCapability("name", method.getName());
if (localTesting) {
desiredCapabilities.setCapability("tunnel", "true");
desiredCapabilities.setCapability("browserstack.local", "true");
desiredCapabilities.setCapability("browserstack.localIdentifier", "zalenium");
desiredCapabilities.setCapability("tunnelIdentifier", "zalenium");
}
try {
webDriver.set(new RemoteWebDriver(new URL(zaleniumUrl), desiredCapabilities));
} catch (Exception e) {
LOGGER.warn("FAILED {} on {} - {}", method.getName(), browserType, platform.name());
throw e;
}
}
use of org.openqa.selenium.Platform in project zalenium by zalando.
the class ParallelIT method quitBrowser.
@AfterMethod(alwaysRun = true)
public void quitBrowser(Method method, Object[] testArgs) {
webDriver.get().quit();
String browserType = testArgs[0].toString();
Platform platform = (Platform) testArgs[1];
LOGGER.info("FINISHING {} on {} - {}", method.getName(), browserType, platform.name());
}
use of org.openqa.selenium.Platform in project zalenium by zalando.
the class CloudProxyHtmlRenderer method getPlatform.
/**
* return the platform for the proxy. It should be the same for all slots of the proxy, so checking that.
* @param proxy remote proxy
* @return Either the platform name, "Unknown", "mixed OS", or "not specified".
*/
private static String getPlatform(RemoteProxy proxy) {
Platform res;
if (proxy.getTestSlots().size() == 0) {
return "Unknown";
}
res = getPlatform(proxy.getTestSlots().get(0));
for (TestSlot slot : proxy.getTestSlots()) {
Platform tmp = getPlatform(slot);
if (!tmp.is(res)) {
return "mixed OS";
}
res = tmp;
}
if (res == null) {
return "not specified";
}
return res.toString();
}
Aggregations