Skip to content
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

CLI cypress test during download opens window #4814

Closed
joszo opened this issue Jul 25, 2019 · 2 comments
Closed

CLI cypress test during download opens window #4814

joszo opened this issue Jul 25, 2019 · 2 comments

Comments

@joszo
Copy link

joszo commented Jul 25, 2019

Hello,

I'm struggling problem with running tests in CLI.

cy.xpath(page.generatePdfButton).wait(500).eq(0).click().wait('@pdf').then((xhr) => {
  expect(xhr.status).to.eq(200);
});

Tests clicks download button in npx cypress open, the windows is not opened, file is downloaded.

But in CLI runs cypress open that window:

Screen Shot 2019-07-25 at 12 12 32 PM

How can I handle this?

@jennifer-shehane
Copy link
Member

We don't fully support downloading files yet. Closing as duplicate of this issue #949

@jennifer-shehane
Copy link
Member

File download is now supported in Cypress 6.3.0.

You can now test file downloads in Cypress without the download prompt displaying. Any files downloaded while testing file downloads will be stored in the downloadsFolder which is set to cypress/downloads by default. The downloadsFolder will be deleted before each run unless trashAssetsBeforeRuns is set to false.

This means that if you had any code written to prevent the download prompt or to configure the download location (like in a before:browser:launch event handler), you can remove all of these workarounds.

Our file download recipe has been updated, so you can see some ways to test different types of files after they've been downloaded there.

If you're encountering any bugs while testing file downloads, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants