abramenal / cypress-file-upload

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

[Feature] Allow for mocking file size #307

Open haggen opened 3 years ago

haggen commented 3 years ago

Current behavior:

When attaching a file you can provide the description of a file ({ filePath, mimeType, ... }) and even mock its contents via fileContent, but you can't mock its size.

Desired behavior:

I wish I could provide the file size without resorting to mock its content. That would be especially useful for mocking large files.

cy.get("input[type=file]").attachFile({ fileSize: 100 * 1024 * 1024 }); // Just an example, this doesn't work.

Versions

n/a

NandoSangenetto commented 2 years ago

This feature would be awesome. Is there a way in doing that? I'm willing to help.

abramenal commented 2 years ago

Hi @nandosangenetto, There are some samples I found on Stackoverflow (this and this). If you are interested, please feel free to submit a PR. This could be indeed a nice addition to simplify file upload testing.