Skip to content

Commit eaaa2db

Browse files
committed
fix: Update platform for Android devices
1 parent 1d50ca8 commit eaaa2db

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

utam-core/src/main/java/utam/core/framework/context/MobilePlatformType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static MobilePlatformType fromDriver(WebDriver driver) {
8383
return WEB;
8484
}
8585
Platform platform = ((AppiumDriver) driver).getCapabilities().getPlatformName();
86-
if (platform == Platform.LINUX) {
86+
if (platform == Platform.ANDROID) {
8787
return isTablet(driver) ? ANDROID_TABLET : ANDROID_PHONE;
8888
}
8989
if (platform == Platform.IOS) {

utam-core/src/test/java/utam/core/MockUtilities.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public MockUtilities(Class<? extends WebDriver> driverType) {
8888
utamElement = createInstance(BasePageElement.class, elementAdapter, factory.getDriver());
8989
frameElement = createInstance(FrameElementImpl.class, elementAdapter, factory.getDriver());
9090
if (isMobileMock(driverType)) {
91-
setMobilePlatform(Platform.LINUX);
91+
setMobilePlatform(Platform.ANDROID);
9292
}
9393
TargetLocator targetLocator = mock(TargetLocator.class);
9494
when(webDriverMock.switchTo()).thenReturn(targetLocator);
@@ -120,12 +120,10 @@ ElementAdapter setElementAdapter(Class<? extends WebDriver> driverType) {
120120

121121
DriverAdapter setDriverAdapter(Class<? extends WebDriver> driverType) {
122122
WebDriver driver = getWebDriverMock();
123-
if (driverType.equals(AppiumDriver.class)) {
124-
setMobilePlatform(Platform.LINUX);
123+
if (driverType.equals(AppiumDriver.class) || driverType.equals(AndroidDriver.class)) {
124+
setMobilePlatform(Platform.ANDROID);
125125
} else if (driverType.equals(IOSDriver.class)) {
126126
setMobilePlatform(Platform.IOS);
127-
} else if (driverType.equals(AndroidDriver.class)) {
128-
setMobilePlatform(Platform.ANDROID);
129127
}
130128
return (DriverAdapter) WebDriverFactory.getAdapterMock(driver);
131129
}

utam-core/src/test/java/utam/core/framework/context/MobilePlatformTypeTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void testGetActivePlatform() {
7171
when(driver.getCapabilities()).thenReturn(desiredCaps);
7272
desiredCaps.setCapability(DEVICE_NAME_NAME, DEVICE_NAME_VALUE_IPAD);
7373
assertThat(fromDriver(driver), is(IOS_TABLET));
74-
desiredCaps.setPlatform(Platform.LINUX);
74+
desiredCaps.setPlatform(Platform.ANDROID);
7575
desiredCaps.setCapability(DEVICE_SCREEN_SIZE_NAME, DEVICE_SCREEN_SIZE_VALUE_PHONE);
7676
desiredCaps.setCapability(DEVICE_SCREEN_DENSITY_NAME, DEVICE_SCREEN_DENSITY_VALUE_PHONE);
7777
when(driver.getCapabilities()).thenReturn(desiredCaps);

utam-core/src/test/java/utam/core/selenium/appium/MobileDriverAdapterTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void testSwitchToWebViewTimeout() {
133133
when(contextSwitcher.getContext()).thenReturn(NATIVE_CONTEXT_HANDLE);
134134
when(driver.getTitle()).thenReturn(DEFAULT_WEBVIEW_TITLE);
135135
when(contextSwitcher.context(testWebViewHandle)).thenReturn(driver);
136-
mock.setMobilePlatform(Platform.LINUX);
136+
mock.setMobilePlatform(Platform.ANDROID);
137137
TimeoutException e =
138138
expectThrows(
139139
TimeoutException.class, () -> provider.setPageContextToWebView("Nonexistent Title"));

0 commit comments

Comments
 (0)