UNPKG

@ngx-playwright/test

Version:
160 lines 9.73 kB
/** @typedef {import("@ngx-playwright/harness").HarnessEnvironment} _HE */ /** * @implements {_HE} */ export class PlaywrightHarnessEnvironment implements _HE { /** * @internal * @param {import('@playwright/test').Page} page * @param {Readonly<import('./types.js').PlaywrightHarnessEnvironmentOptions>=} options * @param {import('@playwright/test').Locator=} documentRoot * @param {import('@playwright/test').ElementHandle<HTMLElement | SVGElement> | import('@playwright/test').Locator=} element */ constructor(page: import("@playwright/test").Page, { respectShadowBoundaries, useLocators, innerTextWithShadows, selectorEngine, }?: Readonly<import("./types.js").PlaywrightHarnessEnvironmentOptions> | undefined, documentRoot?: import("@playwright/test").Locator | undefined, element?: (import("@playwright/test").ElementHandle<HTMLElement | SVGElement> | import("@playwright/test").Locator) | undefined); /** * If true, all query selectors respect shadowroots * * By default, shadow boundaries are pierced by all queries. * * @deprecated This property is not necessary */ get respectShadowBoundaries(): boolean; /** * The selector engine to use * * The `light` engine only traverses light DOM, it never pierces shadow roots or slotted content. * The `composed` engine traverses the composed DOM, i.e. the DOM with shadow and light intermixed into one tree. * The `playwright` engine is playwright's default engine, which traverses the light DOM while also piercing shadow roots. This engine doesn't traverse into slotted content, meaning it does something between `light` and `composed`. * * The default engine is `playwright`. */ get selectorEngine(): "playwright" | "light" | "composed"; /** * If true, `TestElement#text()` will include shadow content and slotted content * * Enabling this deviates from other `TestElement` implementations, so it is currently opt-in to try and ensure compatibility. */ get innerTextWithShadows(): boolean; /** * The playwright page in which this environment looks for elements and components */ get page(): import("@playwright/test").Page; /** * Wait until the angular app is bootstrapped and stable * * This does more than {@link #forceStabilize}, which only waits for stability. */ waitForAngularReady(): Promise<void>; /** * Returns the playwright handle for the given element * * @param {import('@ngx-playwright/harness').TestElement} element A TestElement created by this environment * @returns {Promise<import('@playwright/test').ElementHandle<HTMLElement | SVGElement>>} The playwright ElementHandle underpinning the given TestElement * @throws If the given element wasn't created by a playwright environment */ getPlaywrightHandle(element: import("@ngx-playwright/harness").TestElement): Promise<import("@playwright/test").ElementHandle<HTMLElement | SVGElement>>; /** * Returns the playwright locator for the given element * * @param {import('@angular/cdk/testing').TestElement} element A TestElement created by this environment * @returns {import('@playwright/test').Locator} The playwright ElementHandle underpinning the given TestElement * @throws If the given element wasn't created by a playwright environment, * or if this playwright environment isn't configured to use locators */ getPlaywrightLocator(element: import("@angular/cdk/testing").TestElement): import("@playwright/test").Locator; /** * Create a copy of the current environment with the given options * * @param {import('./types.js').PlaywrightHarnessEnvironmentOptions} options * @returns {PlaywrightHarnessEnvironment} */ withOptions(options: import("./types.js").PlaywrightHarnessEnvironmentOptions): PlaywrightHarnessEnvironment; /** * @param {string} selector * @returns {Promise<import("@ngx-playwright/harness").HarnessLoader>} */ getChildLoader(selector: string): Promise<import("@ngx-playwright/harness").HarnessLoader>; /** * @param {string} selector * @returns {Promise<import("@ngx-playwright/harness").HarnessLoader[]>} */ getAllChildLoaders(selector: string): Promise<import("@ngx-playwright/harness").HarnessLoader[]>; /** * @template {import('@ngx-playwright/harness').AnyComponentHarness} T * @param {import("@ngx-playwright/harness").HarnessQuery<T> | import("./types.js").CdkHarnessQuery<T>} query * @returns {Promise<T>} */ getHarness<T extends import("@ngx-playwright/harness").AnyComponentHarness>(query: import("@ngx-playwright/harness").HarnessQuery<T> | import("./types.js").CdkHarnessQuery<T>): Promise<T>; /** * @template {import('@ngx-playwright/harness').AnyComponentHarness} T * @param {import("@ngx-playwright/harness").HarnessQuery<T> | import("./types.js").CdkHarnessQuery<T>} query * @returns {Promise<T | null>} */ getHarnessOrNull<T extends import("@ngx-playwright/harness").AnyComponentHarness>(query: import("@ngx-playwright/harness").HarnessQuery<T> | import("./types.js").CdkHarnessQuery<T>): Promise<T | null>; /** * @template {import('@ngx-playwright/harness').AnyComponentHarness} T * @param {import("@ngx-playwright/harness").HarnessQuery<T> | import("./types.js").CdkHarnessQuery<T>} query * @returns {Promise<T[]>} */ getAllHarnesses<T extends import("@ngx-playwright/harness").AnyComponentHarness>(query: import("@ngx-playwright/harness").HarnessQuery<T> | import("./types.js").CdkHarnessQuery<T>): Promise<T[]>; /** * @template {import('@ngx-playwright/harness').AnyComponentHarness} T * @param {import("@ngx-playwright/harness").HarnessQuery<T> | import("./types.js").CdkHarnessQuery<T>} query * @returns {Promise<boolean>} */ hasHarness<T extends import("@ngx-playwright/harness").AnyComponentHarness>(query: import("@ngx-playwright/harness").HarnessQuery<T> | import("./types.js").CdkHarnessQuery<T>): Promise<boolean>; /** @returns {import("@ngx-playwright/harness").LocatorFactory} */ documentRootLocatorFactory(): import("@ngx-playwright/harness").LocatorFactory; set rootElement(rootElement: import("@ngx-playwright/harness").TestElement); /** @returns {import("@ngx-playwright/harness").TestElement} */ get rootElement(): import("@ngx-playwright/harness").TestElement; /** * @template {(import("@ngx-playwright/harness").HarnessQuery<any> | import("./types.js").CdkHarnessQuery<any> | string)[]} T * @param {T} queries * @returns {import("@ngx-playwright/harness").AsyncFactoryFn<import("@ngx-playwright/harness").LocatorFnResult<T>>} */ locatorFor<T extends (import("@ngx-playwright/harness").HarnessQuery<any> | import("./types.js").CdkHarnessQuery<any> | string)[]>(...queries: T): import("@ngx-playwright/harness").AsyncFactoryFn<import("@ngx-playwright/harness").LocatorFnResult<T>>; /** * @template {(import("@ngx-playwright/harness").HarnessQuery<any> | import("./types.js").CdkHarnessQuery<any> | string)[]} T * @param {T} queries * @returns {import("@ngx-playwright/harness").AsyncFactoryFn<import("@ngx-playwright/harness").LocatorFnResult<T> | null>} */ locatorForOptional<T extends (import("@ngx-playwright/harness").HarnessQuery<any> | import("./types.js").CdkHarnessQuery<any> | string)[]>(...queries: T): import("@ngx-playwright/harness").AsyncFactoryFn<import("@ngx-playwright/harness").LocatorFnResult<T> | null>; /** * @template {(import("@ngx-playwright/harness").HarnessQuery<any> | import("./types.js").CdkHarnessQuery<any> | string)[]} T * @param {T} queries * @returns {import("@ngx-playwright/harness").AsyncFactoryFn<import("@ngx-playwright/harness").LocatorFnResult<T>[]>} */ locatorForAll<T extends (import("@ngx-playwright/harness").HarnessQuery<any> | import("./types.js").CdkHarnessQuery<any> | string)[]>(...queries: T): import("@ngx-playwright/harness").AsyncFactoryFn<import("@ngx-playwright/harness").LocatorFnResult<T>[]>; /** @returns {Promise<import("@ngx-playwright/harness").HarnessLoader>} */ rootHarnessLoader(): Promise<import("@ngx-playwright/harness").HarnessLoader>; /** * @param {string} selector * @returns {Promise<import("@ngx-playwright/harness").HarnessLoader>} */ harnessLoaderFor(selector: string): Promise<import("@ngx-playwright/harness").HarnessLoader>; /** * @param {string} selector * @returns {Promise<import("@ngx-playwright/harness").HarnessLoader | null>} */ harnessLoaderForOptional(selector: string): Promise<import("@ngx-playwright/harness").HarnessLoader | null>; /** * @param {string} selector * @returns {Promise<import("@ngx-playwright/harness").HarnessLoader[]>} */ harnessLoaderForAll(selector: string): Promise<import("@ngx-playwright/harness").HarnessLoader[]>; /** * Flushes change detection and async tasks captured in the Angular zone. * In most cases it should not be necessary to call this manually. However, there may be some edge * cases where it is needed to fully flush animation events. */ forceStabilize(): Promise<void>; /** * Waits for all scheduled or running async tasks to complete. This allows harness * authors to wait for async tasks outside of the Angular zone. */ waitForTasksOutsideAngular(): Promise<void>; #private; } export type _HE = import("@ngx-playwright/harness").HarnessEnvironment; //# sourceMappingURL=../../src/harness/environment.d.ts.map