问题
I've a UI similar to
I need to upload a xlsx file which I have placed in fixture folder in to the application. Any suggestions how to do it using cypress?
回答1:
This what I found as the solution
Install cypress-file-upload
npm install --save-dev cypress-file-upload
Add following to command .js file
import 'cypress-file-upload';
Use cy.attachFile
const yourFixturePath = 'data.json'; cy.get('[data-cy="file-input"]').attachFile(yourFixturePath);
For details https://www.npmjs.com/package/cypress-file-upload
来源:https://stackoverflow.com/questions/62206500/excel-file-upload-import-using-cypress