meinaart / cypress-plugin-snapshots

Plugin for snapshot tests in Cypress.io
MIT License
491 stars 116 forks source link

[updateSnaphots = true] dosn't work with multiple snapshottests in one test(bug) #111

Closed AnnaLohse closed 4 years ago

AnnaLohse commented 4 years ago

Describe the bug If updateSnapshots=true is set in the config, only the first snapshot will be corrected during execution because the test failed during the snapshot comparison and the runner stops after the test. So if I have multiple snapshot tests in one test I have to run it several times with [updateSnapshots = true] until all snapshots are failed once and updated afterwards.

To Reproduce Steps to reproduce the behavior:

  1. set updateSnapshots in config to true
  2. write test like
    describe('MultipleSnapshottests', () => {
    it('test', () => {
        cy.get('[data-e2e="component"]')
            .toMatchSnapshot();
        cy.get('[data-e2e="component2"]')
            .toMatchSnapshot();
    });
    });
  3. run test

Expected behavior When updateSnapshots ist set to true, the runner shouldn't stop after toMatchSnapshot() failed.

Desktop

meinaart commented 4 years ago

I am working on a fix, you are right. This is not how it should work.

AnnaLohse commented 4 years ago

Thanks for the quick fix, everything works perfect now.