Skip to content
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 @@ -83,7 +83,7 @@ public static MobilePlatformType fromDriver(WebDriver driver) {
return WEB;
}
Platform platform = ((AppiumDriver) driver).getCapabilities().getPlatformName();
if (platform == Platform.LINUX) {
if (platform == Platform.ANDROID) {
return isTablet(driver) ? ANDROID_TABLET : ANDROID_PHONE;
}
if (platform == Platform.IOS) {
Expand Down
8 changes: 3 additions & 5 deletions utam-core/src/test/java/utam/core/MockUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public MockUtilities(Class<? extends WebDriver> driverType) {
utamElement = createInstance(BasePageElement.class, elementAdapter, factory.getDriver());
frameElement = createInstance(FrameElementImpl.class, elementAdapter, factory.getDriver());
if (isMobileMock(driverType)) {
setMobilePlatform(Platform.LINUX);
setMobilePlatform(Platform.ANDROID);
}
TargetLocator targetLocator = mock(TargetLocator.class);
when(webDriverMock.switchTo()).thenReturn(targetLocator);
Expand Down Expand Up @@ -120,12 +120,10 @@ ElementAdapter setElementAdapter(Class<? extends WebDriver> driverType) {

DriverAdapter setDriverAdapter(Class<? extends WebDriver> driverType) {
WebDriver driver = getWebDriverMock();
if (driverType.equals(AppiumDriver.class)) {
setMobilePlatform(Platform.LINUX);
if (driverType.equals(AppiumDriver.class) || driverType.equals(AndroidDriver.class)) {
setMobilePlatform(Platform.ANDROID);
} else if (driverType.equals(IOSDriver.class)) {
setMobilePlatform(Platform.IOS);
} else if (driverType.equals(AndroidDriver.class)) {
setMobilePlatform(Platform.ANDROID);
}
return (DriverAdapter) WebDriverFactory.getAdapterMock(driver);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void testGetActivePlatform() {
when(driver.getCapabilities()).thenReturn(desiredCaps);
desiredCaps.setCapability(DEVICE_NAME_NAME, DEVICE_NAME_VALUE_IPAD);
assertThat(fromDriver(driver), is(IOS_TABLET));
desiredCaps.setPlatform(Platform.LINUX);
desiredCaps.setPlatform(Platform.ANDROID);
desiredCaps.setCapability(DEVICE_SCREEN_SIZE_NAME, DEVICE_SCREEN_SIZE_VALUE_PHONE);
desiredCaps.setCapability(DEVICE_SCREEN_DENSITY_NAME, DEVICE_SCREEN_DENSITY_VALUE_PHONE);
when(driver.getCapabilities()).thenReturn(desiredCaps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void testSwitchToWebViewTimeout() {
when(contextSwitcher.getContext()).thenReturn(NATIVE_CONTEXT_HANDLE);
when(driver.getTitle()).thenReturn(DEFAULT_WEBVIEW_TITLE);
when(contextSwitcher.context(testWebViewHandle)).thenReturn(driver);
mock.setMobilePlatform(Platform.LINUX);
mock.setMobilePlatform(Platform.ANDROID);
TimeoutException e =
expectThrows(
TimeoutException.class, () -> provider.setPageContextToWebView("Nonexistent Title"));
Expand Down