playwright-testing-library
Version:
playwright + dom-testing-library
43 lines (42 loc) • 4.36 kB
TypeScript
import type { Page } from '@playwright/test';
import { Locator } from '@playwright/test';
import type { AllQuery, Config, QueriesReturn, Query, QueryRoot, Screen } from '../types';
declare const isAllQuery: (query: Query) => query is AllQuery;
declare const isNotFindQuery: (query: Query) => query is "getByLabelText" | "getAllByLabelText" | "queryByLabelText" | "queryAllByLabelText" | "getByPlaceholderText" | "getAllByPlaceholderText" | "queryByPlaceholderText" | "queryAllByPlaceholderText" | "getByText" | "getAllByText" | "queryByText" | "queryAllByText" | "getByAltText" | "getAllByAltText" | "queryByAltText" | "queryAllByAltText" | "getByTitle" | "getAllByTitle" | "queryByTitle" | "queryAllByTitle" | "getByDisplayValue" | "getAllByDisplayValue" | "queryByDisplayValue" | "queryAllByDisplayValue" | "getByRole" | "getAllByRole" | "queryByRole" | "queryAllByRole" | "getByTestId" | "getAllByTestId" | "queryByTestId" | "queryAllByTestId";
declare const allQueryNames: ("getByLabelText" | "getAllByLabelText" | "queryByLabelText" | "queryAllByLabelText" | "findByLabelText" | "findAllByLabelText" | "getByPlaceholderText" | "getAllByPlaceholderText" | "queryByPlaceholderText" | "queryAllByPlaceholderText" | "findByPlaceholderText" | "findAllByPlaceholderText" | "getByText" | "getAllByText" | "queryByText" | "queryAllByText" | "findByText" | "findAllByText" | "getByAltText" | "getAllByAltText" | "queryByAltText" | "queryAllByAltText" | "findByAltText" | "findAllByAltText" | "getByTitle" | "getAllByTitle" | "queryByTitle" | "queryAllByTitle" | "findByTitle" | "findAllByTitle" | "getByDisplayValue" | "getAllByDisplayValue" | "queryByDisplayValue" | "queryAllByDisplayValue" | "findByDisplayValue" | "findAllByDisplayValue" | "getByRole" | "getAllByRole" | "queryByRole" | "queryAllByRole" | "findByRole" | "findAllByRole" | "getByTestId" | "getAllByTestId" | "queryByTestId" | "queryAllByTestId" | "findByTestId" | "findAllByTestId")[];
declare const synchronousQueryNames: ("getByLabelText" | "getAllByLabelText" | "queryByLabelText" | "queryAllByLabelText" | "getByPlaceholderText" | "getAllByPlaceholderText" | "queryByPlaceholderText" | "queryAllByPlaceholderText" | "getByText" | "getAllByText" | "queryByText" | "queryAllByText" | "getByAltText" | "getAllByAltText" | "queryByAltText" | "queryAllByAltText" | "getByTitle" | "getAllByTitle" | "queryByTitle" | "queryAllByTitle" | "getByDisplayValue" | "getAllByDisplayValue" | "queryByDisplayValue" | "queryAllByDisplayValue" | "getByRole" | "getAllByRole" | "queryByRole" | "queryAllByRole" | "getByTestId" | "getAllByTestId" | "queryByTestId" | "queryAllByTestId")[];
declare class LocatorPromise extends Promise<Locator> {
/**
* Wrap an `async` function `Promise` return value in a `LocatorPromise`.
* This allows us to use `async/await` and still return a custom
* `LocatorPromise` instance instead of `Promise`.
*
* @param fn
* @returns
*/
static wrap<A extends any[]>(fn: (...args: A) => Promise<Locator>, config: Partial<Config>): (...args: A) => LocatorPromise;
static from(promise: Promise<Locator>, config: Partial<Config>): LocatorPromise;
config: Partial<Config>;
constructor(executor: (resolve: (value: Locator | PromiseLike<Locator>) => void, reject: (reason?: any) => void) => void, config: Partial<Config>);
within(): QueriesReturn<this>;
}
/**
* Given a `Page` or `Locator` instance, return an object of Testing Library
* query methods that return a `Locator` instance for the queried element
*
* @internal this API is not currently intended for public usage and may be
* removed or changed outside of semantic release versioning. If possible, you
* should use the `locatorFixtures` with **@playwright/test** instead.
* @see {@link locatorFixtures}
*
* @param root `Page` or `Locator` instance to use as the query root
* @param config Testing Library configuration to apply to queries
*
* @returns object containing scoped Testing Library query methods
*/
declare const queriesFor: <Root extends QueryRoot>(root: Root, config: Partial<Config>) => QueriesReturn<Root>;
declare const screenFor: (page: Page, config: Partial<Config>) => {
proxy: Screen;
revoke: () => void;
};
export { LocatorPromise, allQueryNames, isAllQuery, isNotFindQuery, queriesFor, screenFor, synchronousQueryNames, };