UNPKG

@argos-ci/cypress

Version:

Cypress SDK for visual testing with Argos.

69 lines (68 loc) 2.15 kB
import { StabilizationPluginOptions, ViewportOption } from "@argos-ci/browser"; //#region src/support.d.ts type ArgosScreenshotOptions = Partial<Cypress.Loggable & Cypress.Timeoutable & Cypress.ScreenshotOptions> & { /** * Viewports to take screenshots of. */ viewports?: ViewportOption[]; /** * Custom CSS evaluated during the screenshot process. */ argosCSS?: string; /** * 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. * cy.argosScreenshot("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[]; }; declare global { namespace Cypress { interface Chainable { /** * Stabilize the UI and takes a screenshot of the application under test. * * @see https://argos-ci.com/docs/reference/cypress * @example * cy.argosScreenshot("my-screenshot") * cy.get(".post").argosScreenshot() */ argosScreenshot: ( /** * Name of the screenshot. Must be unique. */ name: string, /** * Options for the screenshot. */ options?: ArgosScreenshotOptions) => Chainable<null>; } } }