Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

287
Views
Does tests order matter in Cypress? When tests uploading pdf files are at the beginning they pass, when at the end: Failed to execute atob on Window

I have a tests written in Cypress. One of the tests uploading one pdf file looks like this:

it('uploads one document', () => {
        cy.get('input[type="file"]')
        .attachFile({ filePath: pdfFilePath, encoding: 'base64' , mimeType: 'application/pdf'});

        cy.get('div.table-body>.table-row')
            .find('.col-upload-name')
            .should('have.text', 'TestDocument.pdf')

        cy.get('a.button-action').contains('Upload').click()

        cy.get('div.table-body>.table-row')
            .find('.status-done')
            .should('contain.text', 'Uploaded')
    })

Where pdfFilePath is string path to pdf file in fixtures directory.

When tests uploading pdf files are at the beginning of the test suite, they pass:

enter image description here

When they are at the end of the test suite, they fail:

enter image description here

and I get this error:

enter image description here

Does anyone has any ideas why is that?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I tried reproducing the issue on my side. I was not getting the same error, but it was not adding the file. After adding fileContent it worked for me.

    cy.get('[type="file"]').attachFile({
      fileContent,
      filePath: "filepath",
      fileName: "filename",
      encoding: 'base64', 
      mimeType: 'application/pdf'

});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!