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

134
Visualizações
Getting different error message when uploading file through cypress than manually

I was writing end to end test case for a site. In this site, user is supposed to upload python file. I want to test what happens if I rename png file with `.py extension and upload it. When I did manually, the website gave the error

ERROR: You have submitted a file factorial.py of type py but the contents are of image/png type

However, when I uploaded through cypress using cypress-file-upload plugin, it gave me following error:

ERROR: You have submitted a file factorial.py of type py but the contents are of application/octet-stream type

Why is this so? Am I missing something or am getting diffrent message because of the way the plugin uploads file in some peculiar manner? Can I imitate the manual file upload output through cypress (that is get exactly the same error of image/png type)?

Update

I also checked for the mp3 file. Manual upload was giving error:

ERROR: You have submitted a file factorial.py of type py but the contents are of audio/mpeg type

whereas cypress upload was giving same application/octet-stream type-error.

Also, my code to upload the file looks like this:

cy.get('input[name="docfile"]').attachFile(filePath)
cy.contains('input','Upload').click()

Explicitly adding a mimetype also doesn't work and still gives same error:

cy.get('input[name="docfile"]').attachFile({ filePath: _filePath, mimeType : _mimeType })
about 4 years ago · Juan Pablo Isaza
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