Search in sources :

Example 1 with AppiumVideoRecorder

use of ru.sbtqa.tag.pagefactory.mobile.utils.AppiumVideoRecorder in project page-factory-2 by sbtqa.

the class MobileDriverService method mountDriver.

@Override
public void mountDriver() {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, PROPERTIES.getAppiumPlatformName());
    capabilities.setCapability(MobileCapabilityType.APP, PROPERTIES.getAppiumApp());
    capabilities.setCapability(MobileCapabilityType.APPIUM_VERSION, PROPERTIES.getAppiumVersion());
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, PROPERTIES.getAppiumDeviceName());
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, PROPERTIES.getAppiumPlatformVersion());
    capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, PROPERTIES.getAppiumBrowserName());
    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, PROPERTIES.getAppiumAutomationName());
    capabilities.setCapability(MobileCapabilityType.UDID, PROPERTIES.getAppiumUdid());
    capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, PROPERTIES.getNewCommandTimeout());
    capabilities.setCapability(MobileCapabilityType.FULL_RESET, PROPERTIES.getAppiumFullReset());
    capabilities.setCapability(MobileCapabilityType.NO_RESET, PROPERTIES.getAppiumNoReset());
    capabilities.setCapability(IOSMobileCapabilityType.AUTO_ACCEPT_ALERTS, PROPERTIES.getAppiumAlertsAutoAccept());
    capabilities.setCapability("bundleId", PROPERTIES.getAppiumBundleId());
    capabilities.setCapability("appPackage", PROPERTIES.getAppiumAppPackage());
    capabilities.setCapability("appActivity", PROPERTIES.getAppiumAppActivity());
    capabilities.setCapability("permissions", PROPERTIES.getAppiumPermissions());
    capabilities.setCapability("autoGrantPermissions", PROPERTIES.getAppiumAutoGrantPermissions());
    capabilities.setCapability("unicodeKeyboard", PROPERTIES.getAppiumKeyboardUnicode());
    capabilities.setCapability("resetKeyboard", PROPERTIES.getAppiumKeyboardReset());
    capabilities.setCapability("connectHardwareKeyboard", false);
    capabilities.setCapability("xcodeOrgId", PROPERTIES.getAppiumXcodeOrgId());
    capabilities.setCapability("xcodeSigningId", PROPERTIES.getAppiumXcodeSigningId());
    capabilities.setCapability("showIOSLog", PROPERTIES.getAppiumShowIOSLog());
    capabilities.setCapability("appium:disableWindowAnimation", PROPERTIES.getDisableWindowAnimation());
    capabilities.setCapability("appium:useJSONSource", PROPERTIES.getAppiumUseJSONSource());
    capabilities.setCapability("appium:simpleIsVisibleCheck", PROPERTIES.getAppiumSimpleIsVisibleCheck());
    capabilities.setCapability("appium:useNewWDA", PROPERTIES.getAppiumUseNewWDA());
    capabilities.setCapability("appium:usePrebuiltWDA", PROPERTIES.getAppiumUsePrebuiltWDA());
    capabilities.setCapability("appium:derivedDataPath", PROPERTIES.getAppiumDerivedDataPath());
    if (PROPERTIES.getAppiumPlatformName() == ANDROID) {
        capabilities.merge(new SelenoidCapabilitiesParser().parse());
    }
    LOG.info(String.valueOf(capabilities));
    URL url;
    try {
        url = new URL(PROPERTIES.getAppiumUrl());
    } catch (MalformedURLException e) {
        throw new FactoryRuntimeException("Could not parse appium url. Check 'appium.url' property", e);
    }
    mobileDriver = PROPERTIES.getAppiumPlatformName() == IOS ? new IOSDriver(url, capabilities) : new AndroidDriver(url, capabilities);
    if (PROPERTIES.getAppiumPlatformName() == ANDROID) {
        ((AndroidDriver) mobileDriver).setSetting(Setting.WAIT_FOR_IDLE_TIMEOUT, PROPERTIES.getWaitForIdleTimeout());
    }
    if (PROPERTIES.getAppiumVideoEnabled()) {
        appiumVideoRecorder = new AppiumVideoRecorder(Environment.getScenario());
        appiumVideoRecorder.startRecord();
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) IOSDriver(io.appium.java_client.ios.IOSDriver) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) SelenoidCapabilitiesParser(ru.sbtqa.tag.pagefactory.capabilities.SelenoidCapabilitiesParser) AndroidDriver(io.appium.java_client.android.AndroidDriver) FactoryRuntimeException(ru.sbtqa.tag.pagefactory.exceptions.FactoryRuntimeException) AppiumVideoRecorder(ru.sbtqa.tag.pagefactory.mobile.utils.AppiumVideoRecorder) URL(java.net.URL)

Aggregations

AndroidDriver (io.appium.java_client.android.AndroidDriver)1 IOSDriver (io.appium.java_client.ios.IOSDriver)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)1 SelenoidCapabilitiesParser (ru.sbtqa.tag.pagefactory.capabilities.SelenoidCapabilitiesParser)1 FactoryRuntimeException (ru.sbtqa.tag.pagefactory.exceptions.FactoryRuntimeException)1 AppiumVideoRecorder (ru.sbtqa.tag.pagefactory.mobile.utils.AppiumVideoRecorder)1