abramenal / cypress-file-upload

File upload testing made easy
https://npm.im/cypress-file-upload
MIT License
496 stars 89 forks source link

[Bug] #346

Closed ngianluca closed 2 years ago

ngianluca commented 2 years ago

Current behavior:

Uploading a jar file corrupts it and it becomes unusable.

Desired behavior:

The file is able to be uploaded without being corrupted.

Steps to reproduce: (app code and test code)

            .contains('Package file')
            .parent()
            .find('div')
            .attachFile('monitoring-1.1.3.jar', { subjectType: 'drag-n-drop', mimeType: 'application/java-archive' })

Versions:

8.0.0 of cypress 5.0.8 of the plugin

tested with the latest chrome and firefox

abramenal commented 2 years ago

Hi @ngianluca Thanks for submitting the issue! Currently jar file extension is not supported out of the box, so you have to specify encoding property. I think it should work if you do as follows:

.attachFile('monitoring-1.1.3.jar', { subjectType: 'drag-n-drop', mimeType: 'application/java-archive', encoding: 'binary' })

Please let me know if that works out, so I can add built-in support for this extension. Cheers!