diff --git a/types/__tests__/type-tests.ts b/types/__tests__/type-tests.ts index ace17dbb..ad47e73d 100644 --- a/types/__tests__/type-tests.ts +++ b/types/__tests__/type-tests.ts @@ -117,6 +117,21 @@ export async function testQueryHelpers() { await findByAutomationId(element, ['id', 'id'], {}) await findAllByAutomationId(element, ['id', 'id']) await findByAutomationId(element, ['id', 'id']) + + const screenWithCustomQueries = within(document.body, { + ...queries, + queryByAutomationId, + getAllByAutomationId, + getByAutomationId, + findAllByAutomationId, + findByAutomationId, + }) + + screenWithCustomQueries.queryByAutomationId('id') + screenWithCustomQueries.getAllByAutomationId('id') + screenWithCustomQueries.getByAutomationId(['id', 'automationId']) + await screenWithCustomQueries.findAllByAutomationId('id', {}, {timeout: 1000}) + await screenWithCustomQueries.findByAutomationId('id', {}, {timeout: 1000}) } export function testBoundFunctions() { diff --git a/types/get-queries-for-element.d.ts b/types/get-queries-for-element.d.ts index 5b5903dc..868d6d2a 100644 --- a/types/get-queries-for-element.d.ts +++ b/types/get-queries-for-element.d.ts @@ -153,6 +153,8 @@ export type BoundFunctions = Q extends typeof queries findAllByTestId( ...args: Parameters>> ): ReturnType> + } & { + [P in keyof Q]: BoundFunction } : { [P in keyof Q]: BoundFunction