chore: update expected bidi errors (#11022)

This commit is contained in:
Alex Rudenko 2023-10-31 16:23:29 +01:00 committed by GitHub
parent b4b6fe2702
commit 019bc82192
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View File

@ -53,6 +53,7 @@ export class WaitTask<T = unknown> {
#poller?: JSHandle<Poller<T>>; #poller?: JSHandle<Poller<T>>;
#signal?: AbortSignal; #signal?: AbortSignal;
#reruns: AbortController[] = [];
constructor( constructor(
world: Realm, world: Realm,
@ -102,6 +103,12 @@ export class WaitTask<T = unknown> {
} }
async rerun(): Promise<void> { async rerun(): Promise<void> {
for (const prev of this.#reruns) {
prev.abort();
}
this.#reruns.length = 0;
const controller = new AbortController();
this.#reruns.push(controller);
try { try {
switch (this.#polling) { switch (this.#polling) {
case 'raf': case 'raf':
@ -164,6 +171,9 @@ export class WaitTask<T = unknown> {
await this.terminate(); await this.terminate();
} catch (error) { } catch (error) {
if (controller.signal.aborted) {
return;
}
const badError = this.getBadError(error); const badError = this.getBadError(error);
if (badError) { if (badError) {
await this.terminate(badError); await this.terminate(badError);
@ -221,11 +231,15 @@ export class WaitTask<T = unknown> {
// We could have tried to evaluate in a context which was already // We could have tried to evaluate in a context which was already
// destroyed. // destroyed.
if (error.message.includes('Cannot find context with specified id')) {
return;
}
// Errors coming from WebDriver BiDi. TODO: Adjust messages after
// https://github.com/w3c/webdriver-bidi/issues/540 is resolved.
if ( if (
error.message.includes('Cannot find context with specified id') ||
// Firefox BiDi Error, update one https://github.com/w3c/webdriver-bidi/issues/540 is resolved
error.message.includes( error.message.includes(
"destroyed before query 'MessageHandlerFrameParent:sendCommand'" "AbortError: Actor 'MessageHandlerFrame' destroyed"
) )
) { ) {
return; return;

View File

@ -3699,7 +3699,7 @@
"testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction should survive cross-process navigation", "testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction should survive cross-process navigation",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"], "parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"] "expectations": ["PASS"]
}, },
{ {
"testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction should survive cross-process navigation", "testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction should survive cross-process navigation",
@ -3711,7 +3711,7 @@
"testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction should survive navigations", "testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction should survive navigations",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"], "parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"] "expectations": ["PASS"]
}, },
{ {
"testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction should work when resolved right before execution context disposal", "testIdPattern": "[waittask.spec] waittask specs Frame.waitForFunction should work when resolved right before execution context disposal",
@ -3765,7 +3765,7 @@
"testIdPattern": "[waittask.spec] waittask specs Frame.waitForSelector should survive cross-process navigation", "testIdPattern": "[waittask.spec] waittask specs Frame.waitForSelector should survive cross-process navigation",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"], "parameters": ["firefox", "webDriverBiDi"],
"expectations": ["FAIL"] "expectations": ["PASS"]
}, },
{ {
"testIdPattern": "[waittask.spec] waittask specs Frame.waitForSelector should survive cross-process navigation", "testIdPattern": "[waittask.spec] waittask specs Frame.waitForSelector should survive cross-process navigation",