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

132
Views
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
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!