DEV Community

Discussion on: E2E Testing of excel file downloads with cypress

Collapse
tuly12 profile image
tuly12

another issue,
i finally succeeded to run the code but it fail with the following error :
fs.readFileSync is not a function

i read that it because :
fs will not work in the browser. This is by design as to protect your filesystem from potential security threats.

in case it is true, how the demo show that it is possible?

Thread Thread
prabhat66in profile image
Prabhat66in • Edited

you need to add this in command.js file for above code to work
Cypress.Commands.add("parseXlsx", (inputFile) => {
return cy.task('parseXlsx', { filePath: inputFile })
});