use of org.getopentest.util.Config in project opentest by mcdcorp.
the class InitAppium method run.
@Override
public void run() {
super.run();
String platform = this.readStringArgument("platform", null);
String configUrl = AppiumHelper.getConfig().getString("appium.appiumServerUrl", null);
String appiumUrl = this.readStringArgument("url", configUrl);
Map<String, Object> capsMap = this.readMapArgument("desiredCapabilities", new HashMap<>());
if (appiumUrl == null) {
throw new RuntimeException("The URL of the Appium server was not specified. You must either " + "provide it the \"url\" argument, or specify it in the actor's " + "configuration file using the \"appium.appiumServerUrl\" parameter.");
}
if (platform == null) {
Config config = AppiumHelper.getConfig();
platform = getCapabilityAsString(capsMap, "platformName", getCapabilityAsString(capsMap, "platform", config.getString("appium.desiredCapabilities.platformName", null)));
}
if (platform != null) {
platform = platform.trim().toLowerCase();
if (platform.equals("android")) {
capsMap.put("platformName", "Android");
} else if (platform.equals("ios")) {
capsMap.put("platformName", "iOS");
}
}
AppiumHelper.discardDriver();
AppiumDriver<MobileElement> driver = AppiumHelper.createDriverWithRetries(appiumUrl, capsMap);
// TODO: Use the AppiumDriverSerializer class so we can avoid the stack overflow when the driver output is serialized to JSON
// this.writeOutput("driver", driver);
}
Aggregations