import { StabilizationPluginOptions, ViewportOption } from "@argos-ci/browser"; import { ElementHandle, Page, ScreenshotOptions } from "puppeteer"; //#region src/index.d.ts /** * Accepts all Puppeteer screenshot options and adds Argos-specific options. */ type ArgosScreenshotOptions = Omit & { /** * ElementHandle or string selector of the element to take a screenshot of. */ element?: string | ElementHandle; /** * Viewports to take screenshots of. */ viewports?: ViewportOption[]; /** * Custom CSS evaluated during the screenshot process. */ argosCSS?: string; /** * Disable hover effects by moving the mouse to the top-left corner of the page. * @default true */ disableHover?: boolean; /** * Sensitivity threshold between 0 and 1. * The higher the threshold, the less sensitive the diff will be. * @default 0.5 */ threshold?: number; /** * Name, or list of names, to compare this screenshot against instead of its * own name. A list is tried in order and the first name found in the baseline * build wins, which lets a brand new screenshot fall back to an existing one * rather than showing up as added. * * The screenshot's own name is not implicitly included: list it first to keep * comparing against itself when it exists. * * @example * // Compare "home-variant-b" against itself, or against "home" if it is new. * argosScreenshot(page, "home-variant-b", { * baseName: ["home-variant-b", "home"], * }) */ baseName?: string | string[]; /** * Wait for the UI to stabilize before taking the screenshot. * Set to `false` to disable stabilization. * Pass an object to customize the stabilization. * @default true */ stabilize?: boolean | StabilizationPluginOptions; /** * Tag or array of tags to attach to the screenshot. */ tag?: string | string[]; }; /** * Stabilize the UI and takes a screenshot of the application under test. * * @example * argosScreenshot(page, "my-screenshot") * @see https://argos-ci.com/docs/reference/puppeteer */ declare function argosScreenshot( /** * Puppeteer `page` object. */ page: Page, /** * Name of the screenshot. Must be unique. */ name: string, /** * Options for the screenshot. */ options?: ArgosScreenshotOptions): Promise; //#endregion export { ArgosScreenshotOptions, argosScreenshot };