cypress-autorecord
cypress-autorecord copied to clipboard
Wait route
Hello. I have a problem.
In my test I want to describe sequence of commands, where each command should wait response from mock and go to next command.
How can I do this with this plugin?
Now when I try use use:
cy.server()
cy.route({
method: 'GET',
url: 'my-url',
}).as('routeName');
cy.wait('@routeName')
this plugin stops to mock this request
Hi @chaosmirage
It is the default behaviour of Cypress that if you don't pass in a response on a route that it would pass the route through without stubbing. You can read more about it here: https://docs.cypress.io/api/commands/route.html#Without-Stubbing
Let me look into this on my end to see if theres any hacks around it but for now, your best bet is to use a cy.wait(time)
.
I tried to implement a similar solution in your library: https://github.com/Cloudo/cy-auto-stub/blob/master/src/commands.js
But my attempt was unsuccessful.
Perhaps this example will inspire you.
Thank you for this tool!