-
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
fix: handle download from element missing download attribute #28222
Conversation
downloadItem.once('done', (_event, state) => { | ||
if (state === 'completed') { | ||
automation.push('complete:download', { | ||
id: downloadItem.getETag(), | ||
}) | ||
} | ||
|
||
automation.push('canceled:download', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If state is completed, should it push both 'complete:download' and 'canceled:download'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think so - the browser reports these separately. I pulled the canceled state from CDP's states: https://chromedevtools.github.io/devtools-protocol/tot/Browser/#event-downloadProgress
Thoughts on why pushing both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that what it's currently doing? It doesn't return early, so it's going to push twice if state is completed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see what you mean. yes it should return fast
29 flaky tests on run #52123 ↗︎
Details:
e2e/origin/commands/assertions.cy.ts • 1 flaky test • 5x-driver-firefox
cypress/cypress.cy.js • 3 flaky tests • 5x-driver-firefox
runs.cy.ts • 1 flaky test • app-e2e
cypress/cypress.cy.js • 3 flaky tests • 5x-driver-electron
specs_list_latest_runs.cy.ts • 1 flaky test • app-e2e
The first 5 flaky specs are shown, see all 15 specs in Cypress Cloud. Review all test suite changes for PR #28222 ↗︎ |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
download
attribute. Without thedownload
attribute, abeforeUnload
event was triggered, causing Cypress to become "unstable" and wait for a page-load event. The download behavior does not fire a load event which caused the hang & timeout.Additional details
These fixes apply to Chrome/Electron/Firefox. This does not fix issues observed in experimental webkit. Downloads in Safari results in a beforeUnload page event, and then Safari navigates & shows the download in the browser but does not trigger navigation events. Further investigation is needed to account for this divergent behavior but time-boxed this due to webkit being experimental.
Firefox: Firefox is an odd-ball. If the download is invalid - our current FF configuration will follow the link and launch a new window (its also configurable to same tab or new tab in the same window). This results in a new Firefox window being opened on the machine with focus, however Cypress continues to executes tests in the background. Quick testing locally shows this did not seem to impact back-to-back spec executions in run mode. 🤷🏻♀️
PR Tasks
cypress-documentation
?type definitions
?