-
Notifications
You must be signed in to change notification settings - Fork 34
Description
When I write appium tests, it looks like I can only declare driver as either an EnhancedAndroidDriver type, or an EnhancedIOSDriver type. I want to run a simple test in a single file that will run on both platforms, but it seems I must choose either android or ios for that file to run on. How do I avoid duplicating all my test files? I am using react native and my app is basically identical on both platforms. I have done something similar with the regular AppiumDriver.
Any suggestions to programmatically switch which 'EnhancedIOS/AndroidDriver' the variable driver refers to in Java??
With the regular AppiumDriver, I can do this:
private static AppiumDriver<MobileElement> driver;
public AppiumDriver<MobileElement> getDriver() throws IOException {
if (PLATFORM_NAME.equals("Android")) {
driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
} else if (PLATFORM_NAME.equals("iOS")) {
driver = new IOSDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
return driver;
}
But it seems impossible to take this approach with the Enhanced drivers because they don't share a common type. Please advise!