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.
If state is completed, should it push both 'complete:download' and 'canceled:download'?
There was a problem hiding this comment.
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.
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.
Oh I see what you mean. yes it should return fast
29 flaky tests on run #52123 ↗︎Details:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Test | Artifacts | |
|---|---|---|
| cy.origin assertions > #consoleProps > .should() and .and() |
Output
|
|
cypress/cypress.cy.js • 3 flaky tests • 5x-driver-firefox
| Test | Artifacts | |
|---|---|---|
| ... > correctly returns currentRetry |
Output
|
|
| ... > correctly returns currentRetry |
Output
|
|
| ... > correctly returns currentRetry |
Output
|
|
runs.cy.ts • 1 flaky test • app-e2e
| Test | Artifacts | |
|---|---|---|
| ... > displays each run with correct information |
Test Replay
Output
Screenshots
|
|
cypress/cypress.cy.js • 3 flaky tests • 5x-driver-electron
| Test | Artifacts | |
|---|---|---|
| ... > correctly returns currentRetry |
Test Replay
Output
|
|
| ... > correctly returns currentRetry |
Test Replay
Output
|
|
| ... > correctly returns currentRetry |
Test Replay
Output
|
|
specs_list_latest_runs.cy.ts • 1 flaky test • app-e2e
| Test | Artifacts | |
|---|---|---|
| App/Cloud Integration - Latest runs and Average duration > when no runs are recorded > shows placeholders for all visible specs |
Test Replay
Output
Screenshots
|
|
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 |
downloadattribute. Without thedownloadattribute, abeforeUnloadevent 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?