Module for adding visual regression testing to Cypress
Branch: master
Clone or download
Pull request Compare This branch is 6 commits ahead, 8 commits behind mjhea0:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
docker bumps cypress to v3.1.2 Nov 24, 2018
src removing diff from command Nov 30, 2018
.eslintrc added ci tests Jul 6, 2018
.gitignore updated docker tests Aug 1, 2018
.travis.yml bumps cypress to v3.1.1 Nov 9, 2018
LICENSE init Jul 3, 2018 updated package Nov 30, 2018
cypress-visual-regression.gif updated readme Jul 20, 2018
package-lock.json creating diff folder if missing Nov 30, 2018
package.json creating diff folder if missing Nov 30, 2018

Cypress Visual Regression


Build Status

Module for adding visual regression testing to Cypress.

NOTE: This is forked from mjhea0 who did all the hard work this was created just to remove the dependency on image-magik to see if it could be done directly with blink so no external install needed

I've currently taken the type switch out so the base images is a manual process.

Getting Started


$ npm install cypress-blink-test

Add the following config to your cypress.json file:

  "screenshotsFolder": "cypress/snapshots/actual",
  "trashAssetsBeforeRuns": true

Add the plugin to cypress/plugins/index.js:

const getCompareSnapshotsPlugin = require('cypress-visual-regression/dist/plugin');

module.exports = (on) => {

Add the command to cypress/support/commands.js:

const compareSnapshotCommand = require('cypress-visual-regression/dist/command');


To Use

Add cy.compareSnapshot('home'); in your tests specs whenever you want to test for visual regressions, making sure to replace home with a relevant name. You can also add an optional error threshold: Value can range from 0.00 (no difference) to 1.00 (every pixel is different). So, if you enter an error threshold of 0.50, the test would fail only if 0.51 percent of pixels are different.

Find regressions:

$ ./node_modules/.bin/cypress run 




  1. Allow end user to customize options (screenshot directory)
  2. Test functionality of taking screenshots without running visual regression
  3. Prevent "base" tests runs from actually running the regular Cypress tests