Search in sources :

Example 1 with AppiumServerHasNotBeenStartedLocallyException

use of io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException in project java-client by appium.

the class AndroidTest method beforeClass.

/**
 * initialization.
 */
@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!");
    }
    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.PLATFORM_NAME, MobilePlatform.ANDROID);
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
    capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
    driver = new AppiumDriver<>(service.getUrl(), capabilities);
}
Also used : AppiumServerHasNotBeenStartedLocallyException(io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 2 with AppiumServerHasNotBeenStartedLocallyException

use of io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException in project java-client by appium.

the class AppXCUITTest method beforeClass.

/**
 * initialization.
 */
@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!");
    }
    File appDir = new File("src/test/java/io/appium/java_client");
    File app = new File(appDir, "TestApp.app.zip");
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "");
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.1");
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 6");
    capabilities.setCapability(IOSMobileCapabilityType.ALLOW_TOUCHID_ENROLL, "true");
    // sometimes environment has performance problems
    capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.IOS_XCUI_TEST);
    capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
    driver = new IOSDriver<>(service.getUrl(), capabilities);
}
Also used : AppiumServerHasNotBeenStartedLocallyException(io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 3 with AppiumServerHasNotBeenStartedLocallyException

use of io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException in project java-client by appium.

the class UIAutomator2Test method beforeClass.

/**
 * initialization.
 */
@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!");
    }
    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(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);
    driver = new AndroidDriver<>(service.getUrl(), capabilities);
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
Also used : AppiumServerHasNotBeenStartedLocallyException(io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 4 with AppiumServerHasNotBeenStartedLocallyException

use of io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException in project java-client by appium.

the class IOSTest method beforeClass.

/**
 * initialization.
 */
@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!");
    }
    File appDir = new File("src/test/java/io/appium/java_client");
    File app = new File(appDir, "TestApp.app.zip");
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "");
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.IOS);
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.2");
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone Simulator");
    // sometimes environment has performance problems
    capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
    capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
    driver = new AppiumDriver<>(service.getUrl(), capabilities);
}
Also used : AppiumServerHasNotBeenStartedLocallyException(io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 5 with AppiumServerHasNotBeenStartedLocallyException

use of io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException in project java-client by appium.

the class UICatalogIOSTest 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!");
    }
    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.BROWSER_NAME, "");
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.2");
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone Simulator");
    // sometimes environment has performance problems
    capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
    capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
    driver = new IOSDriver<>(service.getUrl(), capabilities);
}
Also used : AppiumServerHasNotBeenStartedLocallyException(io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Aggregations

AppiumServerHasNotBeenStartedLocallyException (io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException)6 BeforeClass (org.junit.BeforeClass)6 File (java.io.File)5 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)5 EspressoOptions (io.appium.java_client.android.options.EspressoOptions)1