use of io.appium.java_client.service.local.AppiumServiceBuilder 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 io.appium.java_client.service.local.AppiumServiceBuilder in project java-client by appium.
the class SelendroidModeTest method beforeClass.
/**
* initialization.
*/
@BeforeClass
public static void beforeClass() {
AppiumServiceBuilder builder = new AppiumServiceBuilder();
service = builder.build();
service.start();
File appDir = new File("src/test/java/io/appium/java_client");
File app = new File(appDir, "ApiDemos-debug.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
capabilities.setCapability(AndroidMobileCapabilityType.SELENDROID_PORT, SELENDROID_PORT);
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.SELENDROID);
driver = new AndroidDriver<>(service.getUrl(), capabilities);
driver.context("NATIVE_APP");
}
use of io.appium.java_client.service.local.AppiumServiceBuilder in project java-client by appium.
the class StartingAppLocallyTest method startingAndroidAppWithCapabilitiesAndServiceTest.
@Test
public void startingAndroidAppWithCapabilitiesAndServiceTest() {
File appDir = new File("src/test/java/io/appium/java_client");
File app = new File(appDir, "ApiDemos-debug.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
AppiumServiceBuilder builder = new AppiumServiceBuilder().withArgument(GeneralServerFlag.SESSION_OVERRIDE).withArgument(GeneralServerFlag.STRICT_CAPS);
AndroidDriver<?> driver = new AndroidDriver<>(builder, capabilities);
try {
Capabilities caps = driver.getCapabilities();
assertEquals(true, caps.getCapability(MobileCapabilityType.PLATFORM_NAME).equals(MobilePlatform.ANDROID));
assertNotEquals(null, caps.getCapability(MobileCapabilityType.DEVICE_NAME));
} finally {
driver.quit();
}
}
use of io.appium.java_client.service.local.AppiumServiceBuilder in project java-client by appium.
the class StartingAppLocallyTest method startingIOSAppWithCapabilitiesAndFlagsOnServerSideTest.
@Test
public void startingIOSAppWithCapabilitiesAndFlagsOnServerSideTest() {
DesiredCapabilities serverCapabilities = new DesiredCapabilities();
serverCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone Simulator");
serverCapabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, // some environment is too slow
500000);
serverCapabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.2");
File appDir = new File("src/test/java/io/appium/java_client");
File app = new File(appDir, "UICatalog.app.zip");
DesiredCapabilities clientCapabilities = new DesiredCapabilities();
clientCapabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
AppiumServiceBuilder builder = new AppiumServiceBuilder().withArgument(GeneralServerFlag.SESSION_OVERRIDE).withArgument(GeneralServerFlag.STRICT_CAPS).withCapabilities(serverCapabilities);
IOSDriver<?> driver = new IOSDriver<>(builder, clientCapabilities);
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 io.appium.java_client.service.local.AppiumServiceBuilder in project java-client by appium.
the class StartingAppLocallyTest method startingAndroidAppWithCapabilitiesAndFlagsOnServerSideTest.
@Test
public void startingAndroidAppWithCapabilitiesAndFlagsOnServerSideTest() {
File appDir = new File("src/test/java/io/appium/java_client");
File app = new File(appDir, "ApiDemos-debug.apk");
File chrome = getChromeDriver();
DesiredCapabilities serverCapabilities = new DesiredCapabilities();
serverCapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
serverCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
serverCapabilities.setCapability(MobileCapabilityType.FULL_RESET, true);
serverCapabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 60);
serverCapabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
serverCapabilities.setCapability(AndroidMobileCapabilityType.CHROMEDRIVER_EXECUTABLE, chrome.getAbsolutePath());
AppiumServiceBuilder builder = new AppiumServiceBuilder().withArgument(GeneralServerFlag.SESSION_OVERRIDE).withArgument(GeneralServerFlag.STRICT_CAPS).withCapabilities(serverCapabilities);
DesiredCapabilities clientCapabilities = new DesiredCapabilities();
clientCapabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "io.appium.android.apis");
clientCapabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, ".view.WebView1");
AndroidDriver<?> driver = new AndroidDriver<>(builder, clientCapabilities);
try {
Capabilities caps = driver.getCapabilities();
assertEquals(true, caps.getCapability(MobileCapabilityType.PLATFORM_NAME).equals(MobilePlatform.ANDROID));
assertNotEquals(null, caps.getCapability(MobileCapabilityType.DEVICE_NAME));
} finally {
driver.quit();
}
}
Aggregations