use of org.openqa.selenium.remote.DesiredCapabilities in project java-client by appium.
the class BaseSafariTest method beforeClass.
@BeforeClass
public static void beforeClass() {
service = AppiumDriverLocalService.buildDefaultService();
service.start();
if (service == null || !service.isRunning()) {
throw new AppiumServerHasNotBeenStartedLocallyException("An appium server node is not started!");
}
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "Safari");
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.IOS_XCUI_TEST);
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.2");
// sometimes environment has performance problems
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone Simulator");
driver = new IOSDriver<>(service.getUrl(), capabilities);
}
use of org.openqa.selenium.remote.DesiredCapabilities in project java-client by appium.
the class AppiumDriver method substituteMobilePlatform.
/**
* Changes platform name and returns new capabilities.
*
* @param originalCapabilities the given {@link Capabilities}.
* @param newPlatform a {@link MobileCapabilityType#PLATFORM_NAME} value which has
* to be set up
* @return {@link Capabilities} with changed mobile platform value
*/
protected static Capabilities substituteMobilePlatform(Capabilities originalCapabilities, String newPlatform) {
DesiredCapabilities dc = new DesiredCapabilities(originalCapabilities);
dc.setCapability(PLATFORM_NAME, newPlatform);
return dc;
}
use of org.openqa.selenium.remote.DesiredCapabilities in project java-client by appium.
the class StartingAppLocallyTest method startingIOSAppWithCapabilitiesAndServiseTest.
@Test
public void startingIOSAppWithCapabilitiesAndServiseTest() {
File appDir = new File("src/test/java/io/appium/java_client");
File app = new File(appDir, "UICatalog.app.zip");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone Simulator");
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.APPIUM);
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.2");
// sometimes environment has performance problems
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
AppiumServiceBuilder builder = new AppiumServiceBuilder().withArgument(GeneralServerFlag.SESSION_OVERRIDE).withArgument(GeneralServerFlag.STRICT_CAPS);
IOSDriver<?> driver = new IOSDriver<>(builder, capabilities);
try {
Capabilities caps = driver.getCapabilities();
assertEquals(true, caps.getCapability(MobileCapabilityType.PLATFORM_NAME).equals(MobilePlatform.IOS));
assertNotEquals(null, caps.getCapability(MobileCapabilityType.DEVICE_NAME));
} finally {
driver.quit();
}
}
use of org.openqa.selenium.remote.DesiredCapabilities in project java-client by appium.
the class ServerBuilderTest method checkAbilityToStartServiceUsingCapabilitiesAndFlags.
@Test
public void checkAbilityToStartServiceUsingCapabilitiesAndFlags() {
File app = ROOT_TEST_PATH.resolve("ApiDemos-debug.apk").toFile();
File chrome = getChromeDriver();
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(PLATFORM_NAME, "Android");
caps.setCapability(FULL_RESET, true);
caps.setCapability(NEW_COMMAND_TIMEOUT, 60);
caps.setCapability(APP_PACKAGE, "io.appium.android.apis");
caps.setCapability(APP_ACTIVITY, ".view.WebView1");
caps.setCapability(APP, app.getAbsolutePath());
caps.setCapability(CHROMEDRIVER_EXECUTABLE, chrome.getAbsolutePath());
service = new AppiumServiceBuilder().withArgument(CALLBACK_ADDRESS, testIP).withArgument(SESSION_OVERRIDE).withArgument(PRE_LAUNCH).withCapabilities(caps).build();
service.start();
assertTrue(service.isRunning());
}
use of org.openqa.selenium.remote.DesiredCapabilities in project java-client by appium.
the class ServerBuilderTest method checkAbilityToStartServiceUsingCapabilities.
@Test
public void checkAbilityToStartServiceUsingCapabilities() {
File app = ROOT_TEST_PATH.resolve("ApiDemos-debug.apk").toFile();
File chrome = getChromeDriver();
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(PLATFORM_NAME, "Android");
caps.setCapability(FULL_RESET, true);
caps.setCapability(NEW_COMMAND_TIMEOUT, 60);
caps.setCapability(APP_PACKAGE, "io.appium.android.apis");
caps.setCapability(APP_ACTIVITY, ".view.WebView1");
caps.setCapability(APP, app.getAbsolutePath());
caps.setCapability(CHROMEDRIVER_EXECUTABLE, chrome.getAbsolutePath());
service = new AppiumServiceBuilder().withCapabilities(caps).build();
service.start();
assertTrue(service.isRunning());
}
Aggregations