-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Clicking on anchor elements expects a page load event #15220
Comments
@mohsenny We have several examples of anchor links with download attributes being tested in our recipes: https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/testing-dom__download/cypress/integration/remote-download-spec.js None of them show this behavior. There must be something more unique about the application you're testing. Is there an onclick handler? Maybe it's setting the location? Ideally a reproducible example - like a repo - that shows the issue would be best so we can investigate. |
Hey @jennifer-shehane thank you for the links. You're probably right. Let me communicate this to our dev team and I'll get back to this ticket with more information 🙏 |
Actually, I'm not sure if it is a duplicate of #14857 exactly without a repro. So, comment here if it's different - or comment in the other issue if it is. |
@jennifer-shehane Yep, it's an exact duplicate. Thank you so far! |
Current behavior
In our web application, we have buttons in form of anchor elements, with links inside of them of course. These links points to S3 bucket files and clicking on those button triggers a download.
However, from Cypress' perspective, clicking on any
anchor
element that containshref
inside of them, would expect a new page to load. For example here:at line
#11
we're clicking on the button and the file starts getting downloaded, but immediately Cypress starts to wait for a new page to load which in this case there would be no new page to open, and therefore the tests failDesired behavior
Either Cypress should detect if redirection to a new page is happening when clicking on an anchor (maybe looking for the
download
attribute not to exist) to start waiting for a new page to load, or, another approach could be passing an option to click element that stops such event from being triggered:Test code to reproduce
This is the HTML element for the Download button:
Versions
Cypress version:
6.5.0
Node version:
15.3.0
The text was updated successfully, but these errors were encountered: