e2ed
Version:
E2E testing framework over Playwright
85 lines (84 loc) • 2.83 kB
TypeScript
import type { PageRoute } from './PageRoute';
import type { AsyncVoid, NavigateToUrlOptions, PageClassTypeArgs, Url } from './types/internal';
/**
* Abstract page with base methods.
*/
export declare abstract class Page<PageParams = undefined> {
/**
* Type of page parameters.
*/
readonly __PARAMS_KEY: PageParams;
/**
* Default maximum interval (in milliseconds) between requests.
* After navigating to the page, `e2ed` will wait until
* all requests will complete, and only after that it will consider the page loaded.
* If there are no new requests for more than this interval,
* then we will consider that all requests completes
* The default value is taken from the corresponding field of the pack config.
*/
readonly maxIntervalBetweenRequestsInMs: number;
/**
* Default timeout for navigation to url (`navigateToPage`, `navigateToUrl` actions) in milliseconds.
* The default value is taken from the corresponding field of the pack config.
*/
readonly navigationTimeout: number;
/**
* Immutable page parameters.
*/
readonly pageParams: PageParams;
constructor(...args: PageClassTypeArgs<PageParams>);
/**
* Optional hook that runs after asserts the page.
*/
afterAssertPage?(): AsyncVoid;
/**
* Optional hook that runs after navigation to the page.
*/
afterNavigateToPage?(): AsyncVoid;
/**
* Optional hook that runs after reload to the page.
*/
afterReloadPage?(): AsyncVoid;
/**
* Asserts that we are on the expected page by `isMatch` flage.
* `isMatch` equals `true`, if url matches the page with given parameters, and `false` otherwise.
*/
assertPage(isMatch: boolean, documentUrl: Url): AsyncVoid;
/**
* Optional hook that runs before asserts the page.
*/
beforeAssertPage?(): AsyncVoid;
/**
* Optional hook that runs before navigation to the page (but after page initialization).
*/
beforeNavigateToPage?(): AsyncVoid;
/**
* Optional hook that runs before reload to the page.
*/
beforeReloadPage?(): AsyncVoid;
/**
* Optional initialization (asynchronous or synchronous) of the page after
* the synchronous constructor has run.
*/
init?(): AsyncVoid;
/**
* Navigates to the page by url.
*/
navigateToPage(url: Url, options?: NavigateToUrlOptions): Promise<void>;
/**
* Reloads the page.
*/
reloadPage(): Promise<void>;
/**
* Waits for `DOMContentLoaded` event.
*/
waitForDomContentLoaded(): Promise<void>;
/**
* Waits for page loaded.
*/
waitForPageLoaded(): Promise<void>;
/**
* Get page route (for navigation to the page).
*/
abstract getRoute(): PageRoute<unknown>;
}