import type { PlaywrightTestArgs , TestFixture } from '@playwright/test' ; import { getDocument , queries as unscopedQueries } from '.' ; import { queryNames } from './common' ; import type { ScopedQueries as Queries } from './typedefs' ; interface TestingLibraryFixtures { queries : Queries ; } const fixture = async ( { page } , use ) => { const queries = { } as Queries ; queryNames . forEach ( name => { queries [ name ] = async ( ... args ) => { const document = await getDocument ( page ) ; return unscopedQueries [ name ] ( document , ... args ) ; } ; } ) ; await use ( queries ) ; } ; const fixtures = { queries : fixture } ; export { fixture , fixtures } ; export type { Queries , TestingLibraryFixtures } ;