///
import { Dialog, ElementHandle, Page } from "puppeteer";
/**
* Interval at which pageFunctions may be executed.
*/
type ExpectPolling = number | "mutation" | "raf";
interface MatchSelector {
/**
* A selector type
*/
type: "css" | "xpath";
/**
* The selector string
*/
value: string;
}
/**
* Default options that apply to all expectations and can be set globally
*/
interface ExpectDefaultOptions {
/**
* An interval at which the pageFunction is executed. Defaults to "raf".
*/
polling?: ExpectPolling | undefined;
/**
* Maximum time to wait for in milliseconds. Defaults to 500.
*/
timeout?: number | undefined;
}
/**
* Configures how to poll for an element.
*/
interface ExpectTimingActions extends ExpectDefaultOptions {
/**
* delay to pass to the puppeteer element.type API
*/
delay?: number | undefined;
}
interface ExpectToClickOptions extends ExpectTimingActions {
/**
* Defaults to left.
*/
button?: "left" | "right" | "middle" | undefined;
/**
* defaults to 1. See UIEvent.detail.
*/
clickCount?: number | undefined;
/**
* Time to wait between mousedown and mouseup in milliseconds. Defaults to 0.
*/
delay?: number | undefined;
/**
* A text or a RegExp to match in element textContent.
*/
text?: string | RegExp | undefined;
/**
* wait for element to be present in DOM and to be visible, i.e. to not have display: none or visibility: hidden CSS properties. Defaults to false.
*/
visible?: boolean | undefined;
}
interface ExpectPuppeteer {
// These must all match the ExpectPuppeteer interface above.
// We can't extend from it directly because some method names conflict in type-incompatible ways.
toClick(selector: string | MatchSelector, options?: ExpectToClickOptions): Promise;
toDisplayDialog(block: () => Promise): Promise