Turbolinks issues when clicking links.
See original GitHub issueCurrent behavior:
I use Turbolinks in my application. If I click on two links after each other, where the link is present on both pages like a “Next” link, I get “xhr aborted” and it fails.
It seems as cypress clicks the same link twice (not waiting for the xhr to finish)…
If I add a cy.wait(0)
between the clicks it seems to work. But it’s a bit of a hack 😃
Desired behavior:
It should wait for the next page and click the correct link.
Steps to reproduce:
Create a page with Turbolinks which links to another page (like a “Next” link in a pagination). On this other page, add the same link to a “Next” page.
Now, run a Cypress test where you click on the “Next” link twice. This will fail (might be a bit random).
Adding cy.wait(0)
between the clicks seem to solve the problem for some reason.
Versions
Cypress: 3.0.1 Macos 10.13.4
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (5 by maintainers)
Top GitHub Comments
For anyone still having issues with turbolinks and Cypress, I solved mine by using the following implementation of the above suggestions (goes into support/commands.js):
Alternatively, you can disable turbolinks while running in Cypress, by canceling each
turbolinks:click
event (this goes into support/index.js):@carlobeltrame Thank you, that’s a great solution. Our team is using it by passing turbo as an option like so: