effect-playwright
    Preparing search index...

    Interface PageAssertionsToHaveScreenshotOptions

    interface PageAssertionsToHaveScreenshotOptions {
        animations?: "allow" | "disabled";
        caret?: "hide" | "initial";
        clip?: { height: number; width: number; x: number; y: number };
        fullPage?: boolean;
        mask?: Locator[];
        maskColor?: string;
        maxDiffPixelRatio?: number;
        maxDiffPixels?: number;
        omitBackground?: boolean;
        scale?: "css" | "device";
        signal?: AbortSignal;
        stylePath?: string | string[];
        threshold?: number;
        timeout?: number;
    }
    Index
    animations?: "allow" | "disabled"

    When set to "disabled", stops CSS animations, CSS transitions and Web Animations. Animations get different treatment depending on their duration:

    • finite animations are fast-forwarded to completion, so they'll fire transitionend event.
    • infinite animations are canceled to initial state, and then played over after the screenshot.

    Defaults to "disabled" that disables animations.

    caret?: "hide" | "initial"

    When set to "hide", screenshot will hide text caret. When set to "initial", text caret behavior will not be changed. Defaults to "hide".

    clip?: { height: number; width: number; x: number; y: number }

    An object which specifies clipping of the resulting image.

    Type Declaration

    • height: number

      height of clipping area

    • width: number

      width of clipping area

    • x: number

      x-coordinate of top-left corner of clip area

    • y: number

      y-coordinate of top-left corner of clip area

    fullPage?: boolean

    When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults to false.

    mask?: Locator[]

    Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box #FF00FF (customized by maskColor) that completely covers its bounding box. The mask is also applied to invisible elements, see Matching only visible elements to disable that.

    maskColor?: string

    Specify the color of the overlay box for masked elements, in CSS color format. Default color is pink #FF00FF.

    maxDiffPixelRatio?: number

    An acceptable ratio of pixels that are different to the total amount of pixels, between 0 and 1. Default is configurable with TestConfig.expect. Unset by default.

    maxDiffPixels?: number

    An acceptable amount of pixels that could be different. Default is configurable with TestConfig.expect. Unset by default.

    omitBackground?: boolean

    Hides default white background and allows capturing screenshots with transparency. Not applicable to jpeg images. Defaults to false.

    scale?: "css" | "device"

    When set to "css", screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will keep screenshots small. Using "device" option will produce a single pixel per each device pixel, so screenshots of high-dpi devices will be twice as large or even larger.

    Defaults to "css".

    signal?: AbortSignal

    An optional AbortSignal that can cancel the assertion. Aborting the signal fails the assertion like a timeout: if the signal is aborted while the assertion is retrying, or is already aborted before the assertion starts, the assertion fails without retrying further.

    stylePath?: string | string[]

    File name containing the stylesheet to apply while making the screenshot. This is where you can hide dynamic elements, make elements invisible or change their properties to help you creating repeatable screenshots. This stylesheet pierces the Shadow DOM and applies to the inner frames.

    threshold?: number

    An acceptable perceived color difference in the YIQ color space between the same pixel in compared images, between zero (strict) and one (lax), default is configurable with TestConfig.expect. Defaults to 0.2.

    timeout?: number

    Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.