Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Appium Windows platform #3494

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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