Skip to content

Commit 4d1b705

Browse files
Fix failing test and improve existing exception
1 parent d791fa5 commit 4d1b705

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,9 @@ public void testSwitchToWebViewWithMultipleWebViewsAndroid() {
406406
});
407407
when(driver.getWindowHandles()).thenReturn(windowHandles);
408408
when(driver.getTitle()).thenReturn("").thenReturn(testWebViewTitle);
409-
when(contextSwitcher.getContext()).thenReturn(contextTracker.currentContext);
409+
when(contextSwitcher.getContext())
410+
.thenReturn(contextTracker.currentContext)
411+
.thenReturn(testWebViewHandle);
410412
mock.setMobilePlatform(Platform.LINUX);
411413
MobileDriverAdapter adapter = mock.getMobileDriverAdapter();
412414
assertThat(
@@ -432,10 +434,7 @@ public void testSwitchToWebViewWithNoWebViewsAndroid() {
432434
when(driver.getCapabilities().getPlatformName()).thenReturn(Platform.ANDROID);
433435
when(contextSwitcher.getContextHandles()).thenReturn(contextHandles);
434436
when(driver.getWindowHandles())
435-
.then(
436-
(arg) -> {
437-
throw new UnsupportedCommandException("getWindowHandles {}");
438-
});
437+
.thenThrow(new UnsupportedCommandException("getWindowHandles {}"));
439438
when(contextSwitcher.getContext()).thenReturn(contextTracker.currentContext);
440439
mock.setMobilePlatform(Platform.LINUX);
441440
MobileDriverAdapter adapter = mock.getMobileDriverAdapter();

0 commit comments

Comments
 (0)