Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show example how to restore synthetic clock #429

Open
bahmutov opened this issue Jun 23, 2020 · 1 comment
Open

Show example how to restore synthetic clock #429

bahmutov opened this issue Jun 23, 2020 · 1 comment

Comments

@bahmutov
Copy link
Contributor

it('restores', () => {
  cy.clock(+ new Date())
  cy.visit('http://localhost:3000/sudoku')
  // make sure the application has rendered
  // and the synthetic clock started working
  cy.get('.game__cell--filled').should('have.length', 45)

  cy.tick(600 * 1000) // 10 minutes
  cy.contains('.status__time', '10:00')

  // resume the clock
  cy.tick().then(clock => {
    clock.restore()
  })
  // the clock is restored to original value
  // thus the timer will start measuring again
  // from the original date passed to "cy.clock"
  cy.contains('.status__time', '00:03')
})
@bahmutov
Copy link
Contributor Author

People have trouble finding this info https://twitter.com/huchenme/status/1275225026531225600

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants