diff --git a/serenity-core/src/main/java/net/serenitybdd/core/webdriver/driverproviders/AppiumDriverProvider.java b/serenity-core/src/main/java/net/serenitybdd/core/webdriver/driverproviders/AppiumDriverProvider.java index 7f93c7dae..9b578b717 100644 --- a/serenity-core/src/main/java/net/serenitybdd/core/webdriver/driverproviders/AppiumDriverProvider.java +++ b/serenity-core/src/main/java/net/serenitybdd/core/webdriver/driverproviders/AppiumDriverProvider.java @@ -3,6 +3,7 @@ import com.google.common.eventbus.Subscribe; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.ios.IOSDriver; +import io.appium.java_client.windows.WindowsDriver; import net.serenitybdd.model.buildinfo.DriverCapabilityRecord; import net.serenitybdd.core.di.SerenityInfrastructure; import net.serenitybdd.core.webdriver.appium.AppiumDevicePool; @@ -27,6 +28,7 @@ import static net.thucydides.model.ThucydidesSystemProperty.MANAGE_APPIUM_SERVERS; import static net.thucydides.core.webdriver.SupportedWebDriver.ANDROID; import static net.thucydides.core.webdriver.SupportedWebDriver.IPHONE; +import static net.thucydides.core.webdriver.SupportedWebDriver.REMOTE; public class AppiumDriverProvider implements DriverProvider { @@ -65,6 +67,10 @@ private WebDriver newDriverUsingExternalServer(String options, EnvironmentVariab IOSDriver iosDriver = new IOSDriver(appiumUrl(environmentVariables), enhancer.enhanced(appiumCapabilities(options,environmentVariables), IPHONE)); driverProperties.registerCapabilities("appium", capabilitiesToProperties(iosDriver.getCapabilities())); return iosDriver; + case WINDOWS: + WindowsDriver windowsDriver = new WindowsDriver(appiumUrl(environmentVariables), enhancer.enhanced(appiumCapabilities(options,environmentVariables), REMOTE)); + driverProperties.registerCapabilities("appium", capabilitiesToProperties(windowsDriver.getCapabilities())); + return windowsDriver; } throw new DriverConfigurationError(appiumTargetPlatform(environmentVariables).name()); } @@ -119,6 +125,18 @@ public WebDriver newDriverUsingManagedAppiumServers(String options, EnvironmentV WebDriverInstanceEvents.bus().register(listenerFor(iosDriver, deviceName)); LOGGER.info(" -> driver created" + iosDriver); return iosDriver; + case WINDOWS: + LOGGER.info(" - Using windows appium server at " + appiumUrl); + enhancedOptions = enhancer.enhanced(appiumCapabilities(options,testEnvironmentVariables), REMOTE); + LOGGER.info(" - Using appium capabilities " + enhancedOptions); + TestContext.forTheCurrentTest().recordBrowserConfiguration(enhancedOptions); + TestContext.forTheCurrentTest().recordCurrentPlatform(); + WindowsDriver windowsDriver = new WindowsDriver(appiumUrl, enhancedOptions); + + driverProperties.registerCapabilities("appium", capabilitiesToProperties(windowsDriver.getCapabilities())); + WebDriverInstanceEvents.bus().register(listenerFor(windowsDriver, deviceName)); + LOGGER.info(" -> driver created" + windowsDriver); + return windowsDriver; } throw new DriverConfigurationError(appiumTargetPlatform(testEnvironmentVariables).name()); diff --git a/serenity-core/src/main/java/net/thucydides/core/webdriver/MobilePlatform.java b/serenity-core/src/main/java/net/thucydides/core/webdriver/MobilePlatform.java index ef20cae30..1e02bc37f 100644 --- a/serenity-core/src/main/java/net/thucydides/core/webdriver/MobilePlatform.java +++ b/serenity-core/src/main/java/net/thucydides/core/webdriver/MobilePlatform.java @@ -4,7 +4,7 @@ * Created by john on 28/10/2014. */ public enum MobilePlatform { - IOS(true), ANDROID(true), NONE(false); + IOS(true), ANDROID(true), WINDOWS(true), NONE(false); public final boolean isDefined;