Skip to content

[Bug] Binary fixture upload  #70

@kammerer

Description

@kammerer

Not sure if that should be considered a bug in cypress-file-upload since there is also an ongoing discussion for cypress itself: cypress-io/cypress#1558. Still, I think it makes sense to point out that there is a problem with binaries.

Current behavior:

I am trying to upload binary files constituting a shapefile.
I specify "binary" as enconding, both for fixture and upload payload.
I get InvalidCharacterError: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded error when doing the upload.

Desired behavior:

Upload works correctly with encoding specified as "binary".

Steps to reproduce: (app code and test code)

cy.fixture("Test.shp", "binary").then(data => {                                                                                                          
  cy.get('#upload').upload(
    { fileContent: data, fileName: "Test.shp", encoding: "binary", mimeType: "application/octet-stream" },
    { subjectType: 'input' }
  );                                                                                 
});

Workaround

Use "base64" as encoding (both for fixture loading and upload).

Versions

cypress 3.2.0
cypress-file-upload: 3.1.1
Linux Mint 18.2 Cinnamon 64-bit

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions