@argos-ci/cypress
Version:
Cypress SDK for visual testing with Argos.
53 lines (52 loc) • 1.49 kB
text/typescript
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;
/**
* 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/cypress#api-overview
* @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>;
}
}
}