Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

294
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda