|
18 | 18 | package org.openqa.selenium.bidi.browsingcontext;
|
19 | 19 |
|
20 | 20 | import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
|
| 21 | +import static org.openqa.selenium.testing.drivers.Browser.*; |
21 | 22 |
|
22 | 23 | import java.util.List;
|
23 | 24 | import java.util.concurrent.CompletableFuture;
|
|
30 | 31 | import org.openqa.selenium.bidi.module.BrowsingContextInspector;
|
31 | 32 | import org.openqa.selenium.testing.JupiterTestBase;
|
32 | 33 | import org.openqa.selenium.testing.NeedsFreshDriver;
|
| 34 | +import org.openqa.selenium.testing.NotYetImplemented; |
33 | 35 |
|
34 | 36 | class BrowsingContextInspectorTest extends JupiterTestBase {
|
35 | 37 |
|
@@ -213,4 +215,22 @@ void canListenToUserPromptClosedEvent()
|
213 | 215 | assertThat(userPromptClosed.getAccepted()).isTrue();
|
214 | 216 | }
|
215 | 217 | }
|
| 218 | + |
| 219 | + @Test |
| 220 | + @NeedsFreshDriver |
| 221 | + @NotYetImplemented(FIREFOX) |
| 222 | + void canListenToNavigationCommittedEvent() |
| 223 | + throws ExecutionException, InterruptedException, TimeoutException { |
| 224 | + try (BrowsingContextInspector inspector = new BrowsingContextInspector(driver)) { |
| 225 | + CompletableFuture<NavigationInfo> future = new CompletableFuture<>(); |
| 226 | + |
| 227 | + BrowsingContext context = new BrowsingContext(driver, driver.getWindowHandle()); |
| 228 | + inspector.onNavigationCommitted(future::complete); |
| 229 | + context.navigate(appServer.whereIs("/bidi/logEntryAdded.html"), ReadinessState.COMPLETE); |
| 230 | + |
| 231 | + NavigationInfo navigationInfo = future.get(5, TimeUnit.SECONDS); |
| 232 | + assertThat(navigationInfo.getBrowsingContextId()).isEqualTo(context.getId()); |
| 233 | + assertThat(navigationInfo.getUrl()).contains("/bidi/logEntryAdded.html"); |
| 234 | + } |
| 235 | + } |
216 | 236 | }
|
0 commit comments