jaredpalmer / cypress-image-snapshot

Catch visual regressions in Cypress
MIT License
887 stars 160 forks source link

Is there anyway to enable/disable taking snapshot ? Not Update #178

Open tmanasi opened 3 years ago

tmanasi commented 3 years ago

Is there anyway to enable/disable taking snapshot ? Not Update I want to know if there is any way where I can choose when my snapshot test cases will run and when will not .

Develliot commented 3 years ago

Inside commands I skip snapshots if I am in interactive mode so it only takes snapshots in docker command.js:

if (Cypress.config('isInteractive')) {
  Cypress.Commands.add('matchImageSnapshot', () => {
    cy.log('Skipping snapshot');
  });
} else {
  addMatchImageSnapshotCommand();
}
Vishwaas commented 3 years ago

Yes, i used a environment variable to determine that

if (Cypress.env('enableSnapshots')) {
        cy.get('.pointer').matchImageSnapshot('sq-cm-arrow-pointer-down')
      }

//to run
cypress open --env enableSnapshots=true

You can also add these env values in config file or in a separate environment file