Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

add example with snapshots and test retries #363

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions examples/snapshots/cypress/component/PositiveCounter-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,23 @@ describe('PositiveCounter', () => {
.toMatchSnapshot()
})
})

// test retries from
// https://github.com/cypress-io/cypress/pull/3968
// you can skip the tests if there is no retries feature
const describeOrSkip = Cypress.getTestRetries ? describe : describe.skip
describeOrSkip('Retries', () => {
it.skip('work with snapshots', { retries: 2 }, () => {
mount(<PositiveCounter />)
cy.contains('Value: 0')

// click the button the current number of retries
const n = cy.state('test').currentRetry()
Cypress._.times(n, () => {
cy.get('.increment').click()
})

// make sure the component updates until it reaches counter 2
cy.contains('Value:').toMatchHTML()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ exports[`PositiveCounter > starts with zero #0`] =
{
"html": "<span>Value: 0<button class=\"decrement\">−</button><button class=\"increment\">+</button></span>"
};

exports[`Retries > work with snapshots #0`] =
{
"html": "<span>Value: 2<button class=\"decrement\">−</button><button class=\"increment\">+</button></span>"
};

exports[`Retries > work with snapshots #1`] =
{
"html": "<span>Value: 1<button class=\"decrement\">−</button><button class=\"increment\">+</button></span>"
};