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

cy.writeFile() doesn't work with new Cypress version 12.15.0 #27131

Closed
KristinaV-Spotos opened this issue Jun 26, 2023 · 4 comments
Closed

cy.writeFile() doesn't work with new Cypress version 12.15.0 #27131

KristinaV-Spotos opened this issue Jun 26, 2023 · 4 comments

Comments

@KristinaV-Spotos
Copy link

Current behavior

image

With the latest Cypress version 12.15.0 cy.writeFile() is broken when trying to write response contents to pdf. It says "cy.writeFile() must only be invoked from the spec file or support file."

Started happening after this got fixed: #27099

Desired behavior

File written successfully/blank file written

Test code to reproduce

it('Download Pdf', () => {
const pdfUrl = 'http://www.pdf995.com/samples/pdf.pdf';

      cy.request({ url: pdfUrl})
          .then((response) => {
              const fileName = 'test';
              const filePath = 'downloads/' + fileName + '.pdf';
              cy.writeFile(filePath, response.body, 'binary');
  });

Cypress Version

12.15.0

Node version

v16.15.0

Operating System

Windows

Debug Logs

No response

Other

No response

@bimanpathirage
Copy link

bimanpathirage commented Jun 29, 2023

Hi @KristinaV-Spotos, were you able to find a workaround for this? I'm also facing the same issue with no luck

@Jacek-fstack
Copy link

Same issue for me!

@mike-plummer
Copy link
Contributor

Hi @bimanpathirage @Jacek-fstack - there is some more info available here with potential causes & solutions

@Jacek-fstack
Copy link

Jacek-fstack commented Jun 30, 2023

oh thanks @mike-plummer I'll check it out
FYI: this only occurs in headless mode for me

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

4 participants