Nanciee / cypress-autorecord

Simplify API mocking by auto-recording/stubbing HTTP interactions and automating the process of updating/deleting mocks.
223 stars 53 forks source link

`cy.clock` makes my spec hang #41

Closed ha404 closed 3 years ago

ha404 commented 3 years ago

For some reason this line that establishes cy.clock makes my spec hang.

I'll attempt to cy.visit a route and never resolve. Network requests seem to never occur, it's like I'm frozen in time.

https://github.com/Nanciee/cypress-autorecord/blob/3662aee3faaeb4bddb381fd616d6aa6a87701dde/index.js#L182-L186

After commenting all instances of cy.clock everything works fine. Any ideas?

Thanks!

Nanciee commented 3 years ago

Let me take a look into this

ha404 commented 3 years ago

@Nanciee @RobertCorey I found a way to get around this for the time being by adding this to you beforeEach in each of your specs:

From https://docs.cypress.io/api/commands/clock#Restore-clock:

beforeEach(() => {
  cy.clock().invoke('restore')
})
ha404 commented 3 years ago

I've made a PR to restore it within the plugin: https://github.com/Nanciee/cypress-autorecord/pull/46/files?w=1

ha404 commented 3 years ago

🎉 Resolved: https://github.com/Nanciee/cypress-autorecord/pull/46/files?w=1