I want to create a file of certain size (20MB) in the cypress test.
I don't want to include a real file in the fixtures as it would clutter my repository.
I can't use an environment file as this would be run locally and on CI. It needs to be platform independent.
Is there a way I can do this in the test without the usage of system scripts? Like in this question Creating an empty file of a certain size?
Here is an example which is working for me with the use of Cypress.Buffer
without creating a physical file on disk:
const moreThanFiftyMb = 50000000 + 1
const bigFile = Cypress.Buffer.alloc(moreThanFiftyMb)
bigFile.write("X", moreThanFiftyMb)
cy.get("#file-manager-drop-target").selectFile({
contents: bigFile,
fileName: 'more-than50mb.txt',
mimeType: 'text/plain'
});`