cypress-file-upload icon indicating copy to clipboard operation
cypress-file-upload copied to clipboard

[Feature] Allow for mocking file size

Open haggen opened this issue 4 years ago • 2 comments

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

haggen avatar May 25 '21 19:05 haggen

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

NandoSangenetto avatar Apr 26 '22 16:04 NandoSangenetto

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.

abramenal avatar Apr 29 '22 15:04 abramenal