File download that uses document.location.href does not work
bahmutov opened this issue · comments
Gleb Bahmutov commented
See https://github.com/cypress-io/cypress-example-recipes/tree/add-href-download-example where I have added a failing test.
The application downloads the file using
document.querySelector('[data-cy=download-csv-href]').addEventListener('click', () => {
console.log('about to download CSV file')
document.location.href = 'records.csv'
})
The CSV file is actually downloaded, but then the test runner times out waiting for the page to load
I think this is a very common problem with file downloads many people are reporting