Cypress Image Diff Documentation
  • Migrate from v1 to v2
  • Getting started
    • Cypress integration
      • Typescript
      • Javascript
      • Browserstack
      • Cypress < v10
    • cy.compareSnapshot command
    • Custom config file
      • ROOT_DIR
      • FAILURE_THRESHOLD
      • RETRY_OPTIONS
      • FAIL_ON_MISSING_BASELINE
      • COMPARISON_OPTIONS
      • JSON_REPORT
      • CYPRESS_SCREENSHOT_OPTIONS
      • REPORT_DIR
      • SCREENSHOTS_DIR
      • NAME_TEMPLATE
    • Reporting
      • JSON report
      • Cypress Image Diff HTML Report
      • Legacy HTML Report
    • Client options
    • Running tests
    • Contributing
    • Publishing
Powered by GitBook
On this page
  1. Getting started

cy.compareSnapshot command

All available options for compareSnapshot command

PreviousCypress < v10NextCustom config file

Last updated 9 months ago

cy.compareSnapshot command could be use in a most basic way:

cy.compareSnapshot('header')

or in a more configurable way:

cy.compareSnapshot({
  name: 'header',
  testThreshold: 0.2
})
  • Available options are:

Option
Type
Required/Default value
Description

name

string

required

The name of the snapshots that will be generated

nameTemplate

string

undefined

The snapshot naming pattern. Same as , but with higher precedence

testThreshold

number

0

A number between 0 and 1 that represents the allowed percentage of pixels that can be different between the two snapshots

retryOptions

{ limit:1 }

Config objects passed to

exactName

boolean

false

If set to true, will use the given name as it is without transforming it to [spec_file_name]-[name]

cypressScreenshotOptions

undefined

options object to change the default behavior of cy.screenshot()

NAME_TEMPLATE
Partial<RecurseDefaults>
cypress-recurse
Partial<Cypress.ScreenshotOptions & Cypress.Loggable & Cypress.Timeoutable>