UNPKG

playwright-fluent

Version:
58 lines (57 loc) 1.99 kB
export interface WaitOptions { /** * Defaults to 30000 milliseconds. * * @type {number} * @memberof WaitOptions */ timeoutInMilliseconds: number; /** * Time during which the callback must always return true. * Defaults to 300 milliseconds. * You must not setup a duration < 100 milliseconds. * @type {number} * @memberof WaitOptions */ stabilityInMilliseconds: number; } export interface WaitUntilOptions extends WaitOptions { /** * Throw a timeout exception when the callback still returns false. * Defaults to true. * @type {boolean} * @memberof WaitUntilOptions */ throwOnTimeout: boolean; /** * Output to the console all steps of the waiting mechanism. * Defaults to false. * Use this option when the waitUntil() method does not wait as expected. * * @type {boolean} * @memberof WaitUntilOptions */ verbose: boolean; /** * Prevents the predicate execution to break the wait-until loop. * Defaults to false. * Use this option when the predicate execution might throw an exception (in case for example of a page reload, or when navigating to another page) * @type {boolean} * @memberof WaitUntilOptions */ wrapPredicateExecutionInsideTryCatch: boolean; } export declare const defaultWaitUntilOptions: WaitUntilOptions; export declare const noWaitNoThrowOptions: WaitUntilOptions; /** * Wait until predicate becomes true, * and always return true during 300 ms. * The waiting mechanism can be modified by setting options * * @export * @param {() => Promise<boolean>} predicate * @param {(string | (() => Promise<string>))} errorMessage * @param {WaitUntilOptions} [options=defaultWaitUntilOptions] * @returns {Promise<void>} */ export declare function waitUntil(predicate: () => Promise<boolean>, errorMessage: string | (() => Promise<string>), options?: WaitUntilOptions): Promise<void>;