@snapvisor/cypress
v8.0.0
Published
Cypress SDK for visual testing with Snapvisor.
Readme
Official Argos Cypress integration
Capture stable Argos screenshots from your Cypress tests.
Visit the Cypress SDK documentation for guides, the API reference, and more.
Installation
npm install --save-dev @snapvisor/cypressUsage
Register the Argos task in your Cypress config:
// cypress.config.js
const { defineConfig } = require("cypress");
const { registerArgosTask } = require("@snapvisor/cypress/task");
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
registerArgosTask(on, config, {
// Upload the screenshots to Argos only on CI.
uploadToArgos: !!process.env.CI,
});
return config;
},
},
});Import the command in your support file:
// cypress/support/e2e.js
import "@snapvisor/cypress/support";Then capture stable screenshots with cy.argosScreenshot in your tests:
// cypress/e2e/example.cy.js
describe("Homepage", () => {
it("takes a screenshot", () => {
cy.visit("http://localhost:3000");
cy.argosScreenshot("homepage");
});
});