import { Browser, Page, BrowserContext } from 'playwright' export type WaitConditionType = 'load' | 'domcontentloaded' | 'networkidle' export type SupportedBrowsers = 'chromium' | 'firefox' type TypeElement = 'div'|'span'|'a'|'button'|'input'|'select'|'textarea'|'img' interface WaitCondition{ timeout: number waitUntil: WaitConditionType } interface GetClassName{ typeElement: TypeElement predicate: (className: string) => boolean nth?: number } interface WaitForClassName{ typeElement: TypeElement predicate: (className: string) => boolean ms?: number count?: number } interface FindWithTextNth{ typeElement: TypeElement text: string nth: number } interface FindWithPredicate{ typeElement: TypeElement predicate: (el: HTMLElement) => Promise nth?: number } interface HttpAuth{ username: string password: string } interface SlowNetwork{ offline: boolean downloadThroughput: number uploadThroughput: number latency: number } export interface InputPlaywright{ extraProps?: object resolution?: Resolution url?: string mobile?: boolean slowNetwork?: SlowNetwork | true httpAuth?: HttpAuth browser?: SupportedBrowsers headless?: boolean fullScreen?: boolean waitCondition?: WaitConditionType | WaitCondition logFlag?: boolean logAllFlag?: boolean logMethod?: (input: object) => void } interface ServerMock{ route: string path: string } interface ExecuteInsideIframe{ selector: string ms?: number executeFn: (singleElement: HTMLElement) => Promise predicate: (singleElement: HTMLElement) => Promise } interface ExecuteInsideNamedIframe extends ExecuteInsideIframe{ frameName: string } interface FillInsideIframe{ text: string predicate: (singleElement: HTMLElement) => Promise selector?: string ms?: number } interface ClickWith{ typeElement: TypeElement predicate: (prop: string) => boolean prop?: 'className'|'id' nth?: number } interface AttachOutput{ applyMocks: (serverMocks: Array) => Promise click: (el: string, nth: number) => Promise forceClick: (playwrightInput: string) => Promise clickAndWaitForNavigation: (playwrightInput: string, navigateEndsWith: string) => Promise findWithTextNth: (input: FindWithTextNth) => Promise findWithPredicate: (input: FindWithPredicate) => Promise clickWith: (input: ClickWith) => Promise clickWithText: (text: string, ms?: number) => Promise clickWithTextNth: (input: FindWithTextNth) => Promise executeInsideIframe: (input: ExecuteInsideIframe) => Promise executeInsideNamedIframe: (input: ExecuteInsideNamedIframe) => Promise fillInsideIframe: (input: FillInsideIframe) => Promise count: (selector: string) => Promise delay: (ms: number) => Promise exists: (selector: string) => Promise getAllClassNames: (typeElement: TypeElement) => Promise> getClassName: (input: GetClassName)=> Promise goto: (url: string) => Promise page: Page pressTab: (timesToPress: number) => Promise snap: (label?: string) => Promise sleep: () => Promise waitAgainst: (playwrightInput: string, count?: number, ms?: number) => Promise waitAgainstText: (text: string, ms?: number) => Promise waitFor: (playwrightInput: string, count?: number, ms?: number) => Promise waitForPredicate: (predicate: () => Promise, ms?: number) => Promise waitForText: (text: string, ms?: number) => Promise waitForAndClick: (playwrightInput: string, nth?: number, ms?: number) => Promise waitForClassName: (input: WaitForClassName) => Promise waitForLocation: (predicate: (url: string) => boolean, ms?: number) => Promise } interface OutputPlaywright{ page: Page browser: Browser context: BrowserContext } interface Resolution { x: number y: number } interface PlaywrightSettings{ args: Array pipe?: boolean handleSIGINT?: boolean ignoreHTTPSErrors?: boolean handleSIGTERM?: boolean handleSIGHUP?: boolean headless: boolean } export function initPlaywright(input: InputPlaywright): Promise export function wrapPlaywright(input: { fn: (_: AttachOutput, input?: any) => Promise, fallback: T, url: string, fnInput?: any }): Promise export function attach(page: Page, screenDir?: string): AttachOutput