
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
cypress-visual-testing
Advanced tools
Module for adding visual regression testing to Cypress.
Install:
$ npm install cypress-visual-testing
Add the following config to your cypress.json file:
{
"screenshotsFolder": "cypress/snapshots/actual",
"trashAssetsBeforeRuns": true,
"env": {
"type": "actual",
"missingBase": "strict"
}
}
Add the plugin to cypress/plugins/index.js:
const getCompareSnapshotsPlugin = require('cypress-visual-testing/dist/plugin');
module.exports = (on) => {
getCompareSnapshotsPlugin(on);
};
Add the command to cypress/support/commands.js:
const compareSnapshotCommand = require('cypress-visual-testing/dist/command');
compareSnapshotCommand();
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.
For example:
it('should display the login page correctly', () => {
cy.visit('/03.html');
cy.get('H1').contains('Login');
cy.compareSnapshot('login', 0.0);
cy.compareSnapshot('login', 0.1);
});
You can target a single HTML element as well:
cy.get('#my-header').compareSnapshot('just-header')
Looking for more examples? Review docker/cypress/integration/main.spec.js.
Take the base images:
$ ./node_modules/.bin/cypress run --env type=base --config screenshotsFolder=cypress/snapshots/base
# use comma separated format for multiple config commands
$ ./node_modules/.bin/cypress run \
--env type=base \
--config screenshotsFolder=cypress/snapshots/base,testFiles=\"**/*regression-tests.js\
Find regressions:
$ ./node_modules/.bin/cypress run --env type=actual

FAQs
Module for adding visual regression testing to Cypress
The npm package cypress-visual-testing receives a total of 3 weekly downloads. As such, cypress-visual-testing popularity was classified as not popular.
We found that cypress-visual-testing demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.