chore: fix waitForNavigation BiDi (#10671)

This commit is contained in:
Nikolay Vitkov 2023-08-02 13:13:39 +02:00 committed by GitHub
parent 87bd791ddc
commit 63b2be122d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 56 deletions

View File

@ -226,9 +226,10 @@ export class Frame extends BaseFrame {
getWaitUntilSingle(waitUntil)
) as string;
const [info] = await Promise.all([
const [info] = await Deferred.race([
// TODO(lightning00blade): Should also keep tack of
// navigationAborted and navigationFailed
Promise.all([
waitForEvent<Bidi.BrowsingContext.NavigationInfo>(
this.#context,
waitUntilEvent,
@ -238,7 +239,6 @@ export class Frame extends BaseFrame {
timeout,
this.#abortDeferred.valueOrThrow()
),
Deferred.race([
waitForEvent(
this.#context,
Bidi.ChromiumBidi.BrowsingContext.EventNames.NavigationStarted,
@ -248,7 +248,8 @@ export class Frame extends BaseFrame {
timeout,
this.#abortDeferred.valueOrThrow()
),
waitForEvent(
]),
waitForEvent<Bidi.BrowsingContext.NavigationInfo>(
this.#context,
Bidi.ChromiumBidi.BrowsingContext.EventNames.FragmentNavigated,
() => {
@ -256,8 +257,9 @@ export class Frame extends BaseFrame {
},
timeout,
this.#abortDeferred.valueOrThrow()
),
]),
).then(info => {
return [info, undefined];
}),
]);
return this.#page.getNavigationResponse(info.navigation);

View File

@ -1055,30 +1055,6 @@
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with clicking on anchor links",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["TIMEOUT"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with DOM history.back()/history.forward()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL", "TIMEOUT"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.pushState()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["TIMEOUT"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.replaceState()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["TIMEOUT"]
},
{
"testIdPattern": "[network.spec] network Network Events Page.Events.RequestFinished",
"platforms": ["darwin", "linux", "win32"],
@ -1895,18 +1871,18 @@
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[elementhandle.spec] ElementHandle specs ElementHandle.boundingBox should force a layout",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[dialog.spec] Page.Events.Dialog should allow accepting prompts",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[elementhandle.spec] ElementHandle specs ElementHandle.boundingBox should force a layout",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[elementhandle.spec] ElementHandle specs ElementHandle.boundingBox should handle nested frames",
"platforms": ["darwin", "linux", "win32"],
@ -2813,24 +2789,48 @@
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["TIMEOUT"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with clicking on anchor links",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with DOM history.back()/history.forward()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with DOM history.back()/history.forward()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.pushState()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.pushState()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.replaceState()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation should work with history.replaceState()",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[network.spec] network \"after all\" hook in \"network\"",
"platforms": ["darwin", "linux", "win32"],
@ -3191,6 +3191,12 @@
"parameters": ["cdp", "firefox"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[page.spec] Page Page.close should run beforeunload if asked for",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.close should terminate network waiters",
"platforms": ["darwin", "linux", "win32"],
@ -3952,11 +3958,5 @@
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "chrome", "headless"],
"expectations": ["FAIL", "PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.close should run beforeunload if asked for",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
}
]