Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sadym-chromium committed Jan 31, 2025
1 parent 8526917 commit a0378ee
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
7 changes: 6 additions & 1 deletion src/bidiMapper/modules/context/NavigationTracker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,12 @@ describe('NavigationTracker', () => {

navigationTracker.frameNavigated(YET_ANOTHER_URL, LOADER_ID);

assertNoNavigationEvents();
assertNavigationEvent(
ChromiumBidi.BrowsingContext.EventNames.NavigationCommitted,
sinon.match.any,
YET_ANOTHER_URL,
);

assert.equal(navigationTracker.url, YET_ANOTHER_URL);

navigationTracker.loadPageEvent(LOADER_ID);
Expand Down
2 changes: 1 addition & 1 deletion src/bidiMapper/modules/context/NavigationTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ export class NavigationTracker {
}

const navigation = this.#getNavigationForFrameNavigated(url, loaderId);
navigation.frameNavigated();

if (navigation !== this.#currentNavigation) {
this.#currentNavigation.fail(
Expand All @@ -311,6 +310,7 @@ export class NavigationTracker {
navigation.loaderId = loaderId;
this.#loaderIdToNavigationsMap.set(loaderId, navigation);
navigation.start();
navigation.frameNavigated();

this.#currentNavigation = navigation;
if (this.#pendingNavigation === navigation) {
Expand Down
16 changes: 8 additions & 8 deletions tests/browsing_context/__snapshots__/test_navigate_events.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
'type': 'event',
}),
dict({
'method': 'browsingContext.navigationCommitted',
'method': 'browsingContext.navigationStarted',
'params': dict({
'context': 'stable_0',
'navigation': 'stable_1',
Expand All @@ -332,7 +332,7 @@
'type': 'event',
}),
dict({
'method': 'browsingContext.navigationStarted',
'method': 'browsingContext.navigationCommitted',
'params': dict({
'context': 'stable_0',
'navigation': 'stable_1',
Expand Down Expand Up @@ -575,20 +575,20 @@
'type': 'event',
}),
dict({
'method': 'browsingContext.navigationCommitted',
'method': 'browsingContext.navigationAborted',
'params': dict({
'context': 'stable_0',
'navigation': 'stable_3',
'url': 'stable_4',
'navigation': 'stable_1',
'url': 'stable_2',
}),
'type': 'event',
}),
dict({
'method': 'browsingContext.navigationAborted',
'method': 'browsingContext.navigationCommitted',
'params': dict({
'context': 'stable_0',
'navigation': 'stable_1',
'url': 'stable_2',
'navigation': 'stable_3',
'url': 'stable_4',
}),
'type': 'event',
}),
Expand Down
11 changes: 10 additions & 1 deletion tests/browsing_context/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async def test_browsingContext_windowOpen_nonBlank_eventsEmitted(
})

events = await read_messages(
4,
5,
# Filter out the command result, as it's order is not defined.
filter_lambda=lambda m: 'id' not in m,
keys_to_stabilize=['context', 'navigation'],
Expand Down Expand Up @@ -140,6 +140,15 @@ async def test_browsingContext_windowOpen_nonBlank_eventsEmitted(
'url': url_example,
},
'type': 'event',
}, {
'method': 'browsingContext.navigationCommitted',
'params': {
'context': 'stable_0',
'navigation': 'stable_1',
'timestamp': ANY_TIMESTAMP,
'url': url_example,
},
'type': 'event',
}, {
'method': 'browsingContext.domContentLoaded',
'params': {
Expand Down
2 changes: 0 additions & 2 deletions tests/browsing_context/test_navigate_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ async def test_window_open_url_checkEvents(websocket, context_id, url_example,
read_messages, snapshot):
await subscribe(websocket, ["browsingContext"])

# Make same-document navigation.
await send_JSON_command(
websocket, {
"method": "script.evaluate",
Expand All @@ -110,7 +109,6 @@ async def test_window_open_aboutBlank_checkEvents(websocket, context_id, url,
read_messages, snapshot):
await subscribe(websocket, ["browsingContext"])

# Make same-document navigation.
await send_JSON_command(
websocket, {
"method": "script.evaluate",
Expand Down

0 comments on commit a0378ee

Please sign in to comment.