Skip to content

Commit

Permalink
Add Appium Windows platform (#3494)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicerloop authored Oct 14, 2024
1 parent 73c3f6f commit be0e775
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {

Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit be0e775

Please sign in to comment.