@mknrt/cypress-plugin-snapshots
v1.5.3
Published
Cypress snapshot functionality for data
Maintainers
Readme
@mknrt/cypress-plugin-snapshots
Plugin for snapshot testing in Cypress.io.
About This Project
This plugin is a fork of the original repository meinaart/cypress-plugin-snapshots with important improvements from suchipi/cypress-plugin-snapshots.
Key Improvements:
- Cypress 15.1.0 Support: The plugin has been fixed and is fully compatible with Cypress version 15.1.0
- Latest Updates: The most recent commits are published to npm
- Cypress Compatibility: Modified peerDependencies for better compatibility across Cypress versions
- TypeScript Types: Updated types for cross-version compatibility
Installation
npm install --save-dev @mknrt/cypress-plugin-snapshotsConfiguration
Add the plugin to cypress/plugins/index.js:
const { initPlugin } = require('@mknrt/cypress-plugin-snapshots/plugin');
module.exports = (on, config) => {
initPlugin(on, config);
return config;
};Add the command to cypress/support/index.js:
import '@mknrt/cypress-plugin-snapshots/commands';Usage
// Compare with snapshot
cy.get('.my-element').toMatchSnapshot();
// Compare with specific snapshot name
cy.get('.my-element').toMatchSnapshot('specific-snapshot-name');Development
For development you need to:
- Run
npm installin both the root directory and thecypressdirectory - Run
npm startin one terminal andnpm testin another
Credits
- Based on the work of meinaart/cypress-plugin-snapshots
- Improvements from suchipi/cypress-plugin-snapshots
- Adapted for Cypress 15.1.0
