Skip to content

Commit cd2820a

Browse files
committed
add test for onNavigationCommitted
1 parent 3b26bc8 commit cd2820a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

java/test/org/openqa/selenium/bidi/browsingcontext/BrowsingContextInspectorTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.openqa.selenium.bidi.browsingcontext;
1919

2020
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
21+
import static org.openqa.selenium.testing.drivers.Browser.*;
2122

2223
import java.util.List;
2324
import java.util.concurrent.CompletableFuture;
@@ -30,6 +31,7 @@
3031
import org.openqa.selenium.bidi.module.BrowsingContextInspector;
3132
import org.openqa.selenium.testing.JupiterTestBase;
3233
import org.openqa.selenium.testing.NeedsFreshDriver;
34+
import org.openqa.selenium.testing.NotYetImplemented;
3335

3436
class BrowsingContextInspectorTest extends JupiterTestBase {
3537

@@ -213,4 +215,23 @@ void canListenToUserPromptClosedEvent()
213215
assertThat(userPromptClosed.getAccepted()).isTrue();
214216
}
215217
}
218+
219+
@Test
220+
@NeedsFreshDriver
221+
@NotYetImplemented(EDGE)
222+
@NotYetImplemented(FIREFOX)
223+
void canListenToNavigationCommittedEvent()
224+
throws ExecutionException, InterruptedException, TimeoutException {
225+
try (BrowsingContextInspector inspector = new BrowsingContextInspector(driver)) {
226+
CompletableFuture<NavigationInfo> future = new CompletableFuture<>();
227+
228+
BrowsingContext context = new BrowsingContext(driver, driver.getWindowHandle());
229+
inspector.onNavigationCommitted(future::complete);
230+
context.navigate(appServer.whereIs("/bidi/logEntryAdded.html"), ReadinessState.COMPLETE);
231+
232+
NavigationInfo navigationInfo = future.get(5, TimeUnit.SECONDS);
233+
assertThat(navigationInfo.getBrowsingContextId()).isEqualTo(context.getId());
234+
assertThat(navigationInfo.getUrl()).contains("/bidi/logEntryAdded.html");
235+
}
236+
}
216237
}

0 commit comments

Comments
 (0)