cypress: file download not working in electron
Current behavior
This appears to be the same issue as described in https://github.com/cypress-io/cypress/issues/14747
However I am getting it in cypress 8.6.0
It eventually bombs out with
Error: ERR_FAILED (-2) loading 'https://docs.google.com/uc?export=download&id=1qnZDkUKzYKcgsrQlflMYtiQL5U1rmP_h'
at rejectAndCleanup (electron/js2c/browser_init.js:161:7486)
at Object.stopLoadingListener (electron/js2c/browser_init.js:161:7861)
at Object.emit (events.js:376:20)
{
errno: -2,
code: 'ERR_FAILED',
url: 'https://docs.google.com/uc?export=download&id=1qnZDkUKzYKcgsrQlflMYtiQL5U1rmP_h'
}
Error: ERR_FAILED (-2) loading 'https://docs.google.com/uc?export=download&id=1qnZDkUKzYKcgsrQlflMYtiQL5U1rmP_h'
at rejectAndCleanup (electron/js2c/browser_init.js:161:7486)
at Object.stopLoadingListener (electron/js2c/browser_init.js:161:7861)
at Object.emit (events.js:376:20)
And returns you to the command line my downloads folder is empty
I ran into the same problem when trying to write a test in my automation framework at work and thought it might be a problem with the app (or proxy) but this seems to indicate otherwise.
Am I doing something wrong here?
Desired behavior
Allow me to download the file
Test code to reproduce
To reproduce:
- Create a new NPM project
- Install Cypress
- Create a spec file as follows
describe('test', () => {
it('downloads', () => {
cy.visit('https://www.appsloveworld.com/sample-excel-data-for-analysis/')
cy.get('.Downloadbutton')
.eq(0)
.click();
});
});
- Run the spec file in the runner
Cypress Version
8.6.0
Other
No response
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 6
- Comments: 15 (3 by maintainers)
I am getting the same issue in Cypress
12.14.0I am getting seemingly the same problem:
And it stops going over the rest of tests. We are debugging our own web app deployed to a public URL. Our code does not use
new-windowanywhere nor opensabout:blanknorabout:blank#blocked. All test steps can be repeated manually without problems.The versions:
It does seem like there is a bug here. When we are doing the
win.loadURLfor the childBrowserWindow, we aren’t catching exceptions, and so loading a broken URL just crashes Cypress. Need more investigation on what to do here, but that does seem like the likely culprit. Possibly it’s not just broken URLs, but any URL that causes an immediate file download.We have a reproduction from #24354 in this repo: https://github.com/aaron-qa/cy-error-repoduce
I have the same issue downloading a PDF in a new tab crashes Electron. As a result it is impossible to run these kind of tests in CI. This issue doesn’t happen with other browsers.