diff --git a/scripts/test-install.sh b/scripts/test-install.sh index c7d14e4f..77088981 100755 --- a/scripts/test-install.sh +++ b/scripts/test-install.sh @@ -78,6 +78,7 @@ import puppeteer from 'puppeteer'; const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto('http://example.com'); + await page.\$('aria/example'); await page.screenshot({ path: 'example.png' }); await browser.close(); })(); diff --git a/src/common/AriaQueryHandler.ts b/src/common/AriaQueryHandler.ts index 97bd9b88..1db69a42 100644 --- a/src/common/AriaQueryHandler.ts +++ b/src/common/AriaQueryHandler.ts @@ -146,7 +146,7 @@ const waitFor: PuppeteerQueryHandler['waitFor'] = async ( element, selector, options, - new Set([ariaQuerySelector]) + new Map([['ariaQuerySelector', ariaQuerySelector]]) ); if (element) { await element.dispose(); diff --git a/src/common/IsolatedWorld.ts b/src/common/IsolatedWorld.ts index c19759cc..d2aea9af 100644 --- a/src/common/IsolatedWorld.ts +++ b/src/common/IsolatedWorld.ts @@ -502,7 +502,7 @@ export class IsolatedWorld { root: ElementHandle | undefined, selector: string, options: WaitForSelectorOptions, - bindings = new Set<(...args: never[]) => unknown>() + bindings = new Map unknown>() ): Promise | null> { const { visible: waitForVisible = false, @@ -568,7 +568,7 @@ export class IsolatedWorld { polling?: 'raf' | 'mutation' | number; timeout?: number; root?: ElementHandle; - bindings?: Set<(...args: never[]) => unknown>; + bindings?: Map unknown>; } = {}, ...args: Params ): Promise>>> { diff --git a/src/common/WaitTask.ts b/src/common/WaitTask.ts index 4a5370e5..955cc2d8 100644 --- a/src/common/WaitTask.ts +++ b/src/common/WaitTask.ts @@ -26,7 +26,7 @@ import {HandleFor} from './types.js'; * @internal */ export interface WaitTaskOptions { - bindings?: Set<(...args: never[]) => unknown>; + bindings?: Map unknown>; polling: 'raf' | 'mutation' | number; root?: ElementHandle; timeout: number; @@ -37,7 +37,7 @@ export interface WaitTaskOptions { */ export class WaitTask { #world: IsolatedWorld; - #bindings: Set<(...args: never[]) => unknown>; + #bindings: Map unknown>; #polling: 'raf' | 'mutation' | number; #root?: ElementHandle; @@ -57,7 +57,7 @@ export class WaitTask { ...args: unknown[] ) { this.#world = world; - this.#bindings = options.bindings ?? new Set(); + this.#bindings = options.bindings ?? new Map(); this.#polling = options.polling; this.#root = options.root; @@ -82,8 +82,8 @@ export class WaitTask { } if (this.#bindings.size !== 0) { - for (const fn of this.#bindings) { - this.#world._boundFunctions.set(fn.name, fn); + for (const [name, fn] of this.#bindings) { + this.#world._boundFunctions.set(name, fn); } } @@ -99,7 +99,7 @@ export class WaitTask { if (this.#bindings.size !== 0) { const context = await this.#world.executionContext(); await Promise.all( - [...this.#bindings].map(async ({name}) => { + [...this.#bindings].map(async ([name]) => { return await this.#world._addBindingToContext(context, name); }) );