package ru.colibri.ui.settings.android.base;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import ru.colibri.ui.core.settings.AppSettings;
import ru.colibri.ui.core.settings.DriversSettings;
import ru.colibri.ui.settings.configurator.AbsDriverConfigurator;

import java.util.concurrent.TimeUnit;

public abstract class BaseAndroidDriverConfigurator extends AbsDriverConfigurator {

    public AppiumDriver createDriver(DriversSettings driversSettings, AppSettings appSettings) {
        DesiredCapabilities capabilities = createCapabilities(driversSettings);
        additionalAndroidCapabilities(appSettings, capabilities);
        AndroidDriver androidDriver = new AndroidDriver(getRemoteAddress(driversSettings.getAppiumRemoteUrl()), capabilities);
        androidDriver.manage().timeouts().implicitlyWait(driversSettings.getImplicitlyWaitInSeconds(), TimeUnit.SECONDS);
        return androidDriver;
    }

    protected abstract void additionalAndroidCapabilities(AppSettings appSettings, DesiredCapabilities capabilities);
}

@@ -712,32 +712,49 @@
 gs, capabilities
+, driversSettings
 );%0A        Andro
@@ -1141,13 +1141,46 @@
 bilities
+, DriversSettings driversSettings
 );%0A%7D%0A

add driversSettings to additionalAndroidCapabilities (#43)