
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
cypress-lens
Advanced tools
Join us, we're hiring.
Based on Cypress Visual Regression
Module for visual regression testing and reporting for Cypress.
Install:
$ npm install cypress-lens
Add the following config to your cypress.config.js file:
const { defineConfig } = require("cypress");
const getCompareSnapshotsPlugin = require("cypress-lens/dist/plugin");
module.exports = defineConfig({
screenshotsFolder: "./cypress/snapshots/actual",
trashAssetsBeforeRuns: true,
video: false,
e2e: {
setupNodeEvents(on, config) {
getCompareSnapshotsPlugin(on, config);
},
},
});
Add the command to cypress/support/commands.js:
const compareSnapshotCommand = require("cypress-lens/dist/command");
compareSnapshotCommand();
Make sure you import commands.js in cypress/support/e2e.js:
import "./commands";
cypress/tsconfig.json
{
"compilerOptions": {
"types": ["cypress", "cypress-lens"]
}
}
Install cypress-multi-reporters: This plugin allows us to use more than one reporters since we want to keep the cypress default spec reports.
$ npm install cypress-multi-reporters
Create reporter-config.json and place the following code
{
"reporterEnabled": "spec, cypress-lens"
}
Add the following config to your cypress.config.js file:
const { defineConfig } = require("cypress");
const getCompareSnapshotsPlugin = require("cypress-lens/dist/plugin");
module.exports = defineConfig({
screenshotsFolder: "./cypress/snapshots/actual",
trashAssetsBeforeRuns: true,
video: false,
e2e: {
reporter: "cypress-multi-reporters",
reporterOptions: {
configFile: "reporter-config.json",
},
setupNodeEvents(on, config) {
getCompareSnapshotsPlugin(on, config);
},
},
});
it("Should display the home page according to baseline snapshot", () => {
cy.visit("www.dreamshot.bg");
cy.compareSnapshot("home-page");
});
failSilently
is enabled by default. Add the following config to your cypress.config.js file to see the errors:
{
env: {
failSilently: false;
}
}
You can also pass default arguments to compareSnapshotCommand()
:
const compareSnapshotCommand = require("cypress-visual-regression/dist/command");
compareSnapshotCommand({
capture: "fullPage",
});
These will be used by default when no parameters are passed to the compareSnapshot command.
$ ./node_modules/.bin/cypress run --env type=base"
$ ./node_modules/.bin/cypress run --env type=actual
FAQs
Module for visual regression testing and reporting in Cypress
The npm package cypress-lens receives a total of 1,078 weekly downloads. As such, cypress-lens popularity was classified as popular.
We found that cypress-lens demonstrated a healthy version release cadence and project activity because the last version was released less than 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.