Skip to content

Latest commit

 

History

History
 
 

snapshots

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

example: react-snapshots

Component testing with snapshots using cypress-plugin-snapshots

Note: run npm install in this folder to symlink cypress-react-unit-test dependency.

npm install
npm run cy:open
# or just run headless tests
npm test

Example component taken from Snapshot Testing React Components with Jest

Snapshot test

See cypress/component/PositiveCounter-spec.js and saved snapshots in cypress/component/snapshots/.

Failing test

If the snapshot contents does not match the saved snapshot file, the test fails. You can click on the snapshot command, review the difference, and if the difference is expected, update the snapshot from the Test Runner's GUI.

Update snapshot

More info

You can use other snapshot plugins from the plugins list