@stencil/playwright
Version:
Testing adapter to use Playwright with Stencil
37 lines (36 loc) • 1.28 kB
TypeScript
import type { Locator } from '@playwright/test';
import type { E2EPage } from '../../playwright-declarations';
import { EventSpy } from '../event-spy';
export type LocatorOptions = {
hasText?: string | RegExp;
has?: Locator;
};
declare module '@playwright/test' {
interface Locator {
/**
* Creates a new EventSpy and listens on the element for an event.
* The test will timeout if the event never fires.
*
* Usage:
* const input = page.locator('ion-input');
* const ionChange = await locator.spyOnEvent('ionChange');
* ...
* await ionChange.next();
*/
spyOnEvent: (eventName: string) => Promise<EventSpy>;
}
}
export interface E2ELocator extends Locator {
/**
* Creates a new EventSpy and listens on the element for an event.
* The test will timeout if the event never fires.
*
* Usage:
* const input = page.locator('ion-input');
* const ionChange = await locator.spyOnEvent('ionChange');
* ...
* await ionChange.next();
*/
spyOnEvent: (eventName: string) => Promise<EventSpy>;
}
export declare const locator: (page: E2EPage, originalFn: typeof page.locator, selector: string, options?: LocatorOptions) => E2ELocator;