Migrate from v1 to v2
New HTML Report

New compareSnapshot arguments type
Rename import path
Rename default screenshots and report folder
New config options
Last updated
// cypress-image-diff v1.32.0 and older
cy.compareSnapshot('header')
cy.compareSnapshot('header', 0.2)
cy.compareSnapshot('header', 0.2, { limit: 6, delay: 1000 })
// cypress-image-diff v2.0.0 and newer
cy.compareSnapshot('header')
cy.compareSnapshot({
name: 'header',
testThreshold: 0.2
})
cy.compareSnapshot({
name: 'header',
testThreshold: 0.2,
recurseOptions: { limit: 6, delay: 1000 }
})
cy.compareSnapshot({
name: 'header',
testThreshold: 0.2,
recurseOptions: { limit: 6, delay: 1000 },
// new custom cypress screenshot options
cypressScreenshotOptions: {
clip: { x: 0, y: 0, width: 100, height: 100 }
}
// new exactName option
exactName: true
})🚫 import getCompareSnapshotsPlugin from 'cypress-image-diff-js/dist/plugin';
✅ import getCompareSnapshotsPlugin from 'cypress-image-diff-js/plugin';
🚫 import compareSnapshotCommand from 'cypress-image-diff-js/dist/command';
✅ import compareSnapshotCommand from 'cypress-image-diff-js/command';🚫 cypress-visual-screenshots
✅ cypress-image-diff-screenshots
🚫 cypress-visual-report
✅ cypress-image-diff-html-report// cypress-image-diff.config.js
const config = {
REPORT_DIR: 'html-report',
SCREENSHOTS_DIR: 'visual-screenshots'
};
module.exports = config;