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

Wait route #4

Open
chaosmirage opened this issue Jun 28, 2019 · 2 comments
Open

Wait route #4

chaosmirage opened this issue Jun 28, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@chaosmirage
Copy link

chaosmirage commented Jun 28, 2019

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

@Nanciee
Copy link
Owner

Nanciee commented Jul 5, 2019

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).

@Nanciee Nanciee added the bug Something isn't working label Jul 5, 2019
@chaosmirage
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants