Capture screenshot fields
Referenced In
Fields
| Field | Type | Description | Default |
|---|---|---|---|
| surface | one of: - string - object(Browser surface) - object(App surface) | Optional. The browser window/tab or app window to capture. Omit to capture the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind (a background process can’t be captured). Specifying a surface switches the active surface for the steps that follow. App surfaces use the object form ({ “app”: … }). App captures don’t support crop. | — |
| path | string | Optional. File path of the PNG file. Accepts absolute paths. A relative path resolves against directory if set, else against the spec file, or against outputDir for a spec loaded from a URL. If not specified, the file is <stepId>.png, in directory if set, else in outputDir. If an http(s) URL is supplied, the remote image is downloaded and used as a read-only reference for comparison; the new capture is written to the context’s screenshots/ folder inside the run folder (<runDir>/specs/<specId>/tests/<testId>/contexts/<contextId>/screenshots/) instead of being uploaded back to the URL.Pattern: `^(?:https?://.+.(?:png | PNG)(?:?.*)? |
| directory | string | Optional. Directory of the PNG file. If the directory doesn’t exist, creates the directory. | — |
| maxVariation | number | Optional. Allowed variation as a fraction (0 to 1) of pixels different between the new screenshot and the existing screenshot at path. For example, 0.1 means 10%. If the difference between the new screenshot and the existing screenshot is greater than maxVariation, the step returns a warning. If a screenshot doesn’t exist at path, this value is ignored.Minimum: 0. Maximum: 1 | 0.05 |
| overwrite | string | Optional. If true, overwrites the existing screenshot at path if it exists.If aboveVariation, overwrites the existing screenshot at path if the difference between the new screenshot and the existing screenshot is greater than maxVariation.Accepted values: true, false, aboveVariation | aboveVariation |
| crop | one of: - string - object(Crop by element (detailed)) | Optional. No description provided. | — |
| annotations | array of unknown | Optional. Visual annotations to draw onto the screenshot. Annotations are composited into the image and never touch the page, so they can’t disturb the page under test or appear in a recording that’s running at the same time. Each annotation is resolved against the capture after any crop. To keep annotations on screen across steps and in recordings, use an annotate step instead. | — |
| sourceIntegration | object(sourceIntegration) | Optional. Information about the source integration for this screenshot, enabling upload of changed files back to the source CMS. Set automatically during test resolution for files from integrations. | — |
Examples
{"surface": "chrome","path": "example","directory": "example","maxVariation": 0.05,"overwrite": "aboveVariation","crop": "example","annotations": [],"sourceIntegration": {"type": "heretto","integrationName": "example"}}