import { ByRoleOptions as ByRoleOptions_, Matcher, MatcherOptions as MatcherOptions_, SelectorMatcherOptions as SelectorMatcherOptions_, waitForOptions, } from '@testing-library/dom' import {ElementHandle} from 'puppeteer' type Element = ElementHandle type MatcherOptions = Omit type SelectorMatcherOptions = Omit type ByRoleOptions = Omit interface IQueryMethods { queryByPlaceholderText(el: Element, m: Matcher, opts?: MatcherOptions): Promise queryAllByPlaceholderText(el: Element, m: Matcher, opts?: MatcherOptions): Promise getByPlaceholderText(el: Element, m: Matcher, opts?: MatcherOptions): Promise getAllByPlaceholderText(el: Element, m: Matcher, opts?: MatcherOptions): Promise findByPlaceholderText( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise findAllByPlaceholderText( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise queryByText(el: Element, m: Matcher, opts?: SelectorMatcherOptions): Promise queryAllByText(el: Element, m: Matcher, opts?: SelectorMatcherOptions): Promise getByText(el: Element, m: Matcher, opts?: SelectorMatcherOptions): Promise getAllByText(el: Element, m: Matcher, opts?: SelectorMatcherOptions): Promise findByText( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise findAllByText( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise queryByLabelText(el: Element, m: Matcher, opts?: SelectorMatcherOptions): Promise queryAllByLabelText(el: Element, m: Matcher, opts?: SelectorMatcherOptions): Promise getByLabelText(el: Element, m: Matcher, opts?: SelectorMatcherOptions): Promise getAllByLabelText(el: Element, m: Matcher, opts?: SelectorMatcherOptions): Promise findByLabelText( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise findAllByLabelText( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise queryByAltText(el: Element, m: Matcher, opts?: MatcherOptions): Promise queryAllByAltText(el: Element, m: Matcher, opts?: MatcherOptions): Promise getByAltText(el: Element, m: Matcher, opts?: MatcherOptions): Promise getAllByAltText(el: Element, m: Matcher, opts?: MatcherOptions): Promise findByAltText( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise findAllByAltText( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise queryByTestId(el: Element, m: Matcher, opts?: MatcherOptions): Promise queryAllByTestId(el: Element, m: Matcher, opts?: MatcherOptions): Promise getByTestId(el: Element, m: Matcher, opts?: MatcherOptions): Promise getAllByTestId(el: Element, m: Matcher, opts?: MatcherOptions): Promise findByTestId( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise findAllByTestId( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise queryByTitle(el: Element, m: Matcher, opts?: MatcherOptions): Promise queryAllByTitle(el: Element, m: Matcher, opts?: MatcherOptions): Promise getByTitle(el: Element, m: Matcher, opts?: MatcherOptions): Promise getAllByTitle(el: Element, m: Matcher, opts?: MatcherOptions): Promise findByTitle( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise findAllByTitle( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise queryByRole(el: Element, m: Matcher, opts?: ByRoleOptions): Promise queryAllByRole(el: Element, m: Matcher, opts?: ByRoleOptions): Promise getByRole(el: Element, m: Matcher, opts?: ByRoleOptions): Promise getAllByRole(el: Element, m: Matcher, opts?: ByRoleOptions): Promise findByRole( el: Element, m: Matcher, opts?: ByRoleOptions, waitForOpts?: waitForOptions, ): Promise findAllByRole( el: Element, m: Matcher, opts?: ByRoleOptions, waitForOpts?: waitForOptions, ): Promise queryByDisplayValue(el: Element, m: Matcher, opts?: MatcherOptions): Promise queryAllByDisplayValue(el: Element, m: Matcher, opts?: MatcherOptions): Promise getByDisplayValue(el: Element, m: Matcher, opts?: MatcherOptions): Promise getAllByDisplayValue(el: Element, m: Matcher, opts?: MatcherOptions): Promise findByDisplayValue( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise findAllByDisplayValue( el: Element, m: Matcher, opts?: SelectorMatcherOptions, waitForOpts?: waitForOptions, ): Promise } export type BoundFunction = T extends ( attribute: string, element: Element, text: infer P, options: infer Q, ) => infer R ? (text: P, options?: Q) => R : T extends (a1: any, text: infer P, options: infer Q, waitForOptions: infer W) => infer R ? (text: P, options?: Q, waitForOptions?: W) => R : T extends (a1: any, text: infer P, options: infer Q) => infer R ? (text: P, options?: Q) => R : never export type BoundFunctions = {[P in keyof T]: BoundFunction} export interface IScopedQueryUtils extends BoundFunctions { getQueriesForElement(): IScopedQueryUtils getNodeText(): Promise } export interface IQueryUtils extends IQueryMethods { getQueriesForElement(): IScopedQueryUtils getNodeText(el: Element): Promise } export interface IConfigureOptions { testIdAttribute: string }