private void ensureAppOrBrowserPathDefinedIn(Properties appiumProperties) { if (!appiumProperties.containsKey("app") && !appiumProperties.containsKey("browserName")) { throw new ThucydidesConfigurationException("The browser under test or path to the app needs to be provided in the appium.app or appium.browserName property."); } }
private void ensureAppPathDefinedIn(Properties appiumProperties) { if (!appiumProperties.containsKey("app")) { throw new ThucydidesConfigurationException("The path to the app needs to be provided in the appium.app property."); } if (!validPath(appiumProperties.getProperty("app"))) { throw new ThucydidesConfigurationException("The path defined in the appium.app property seems wrong: " + appiumProperties.getProperty("app")); } }
public URL getUrl() { String url = environmentVariables.getProperty("appium.hub", DEFAULT_URL); try { return new URL(url); } catch (MalformedURLException e) { throw new ThucydidesConfigurationException("The appium.hub URL needs to be specified"); } }
public URL getUrl() { String url = environmentVariables.getProperty("appium.hub", DEFAULT_URL); try { return new URL(url); } catch (MalformedURLException e) { throw new ThucydidesConfigurationException("The appium.hub URL needs to be specified"); } }
/** * Return the Appium platform defined in the system properties or the context. Must be either ios or android. */ public MobilePlatform getTargetPlatform() { Optional contextPlatform = Stream.of(definedContext()) .filter(platform -> platform.isDefined) .findFirst(); if (contextPlatform.isPresent()) { return (MobilePlatform) contextPlatform.get(); } return Stream.of(definedTargetPlatform()) .filter(platform -> platform.isDefined) .findFirst() .orElseThrow(() -> new ThucydidesConfigurationException("The appium.platformName needs to be specified (either IOS or ANDROID)")); }
/** * Return the Appium platform defined in the system properties, or NONE if no platform is defined. */ public MobilePlatform definedTargetPlatform() { String targetPlatform = environmentVariables.getProperty("appium.platformName","NONE"); try { return MobilePlatform.valueOf(targetPlatform.toUpperCase()); } catch (IllegalArgumentException e) { throw new ThucydidesConfigurationException("Illegal appium.platformName value (needs to be either IOS or ANDROID):" + targetPlatform); } }
public MobilePlatform getTargetPlatform() { String targetPlatform = environmentVariables.getProperty("appium.platformName", "UNDEFINED"); MobilePlatform platform = null; try { platform = MobilePlatform.valueOf(targetPlatform.toUpperCase()); } catch (IllegalArgumentException e) { throw new ThucydidesConfigurationException("The appium.platformName needs to be specified (either IOS or ANDROID)"); } return platform; }
private By getLocatorForPlatform(Actor actor) { if (null != this.androidLocator && null != this.iosLocator) { String platform; try { platform = ((RemoteWebDriver) BrowseTheWeb.as(actor).getDriver()).getCapabilities() .getPlatform().name().toUpperCase(); } catch (ClassCastException e) { throw new ThucydidesConfigurationException(String.format( "The configured driver '%s' does not support Cross Platform Mobile targets", BrowseTheWeb.as(actor).getDriver() ), e); } if (platform.equals("ANDROID")) { return this.androidLocator; } else if (platform.equals("IOS")) { return this.iosLocator; } else { throw new ThucydidesConfigurationException(String.format( "'%s' is not a valid platform for Cross Platform Mobile targets", platform )); } } return this.locator; }