To upload a file in cypress, you need to install a dependency to upload the file. Follow these steps:
- Install the dependency
npm install cypress-file-upload
- Add import
‘cypress-file-upload’; to cypress/support/commands.js file
Go to spec file where you are creating your test code:
declare a constant having path of your file and use attachFile command.
const urFilePath = 'abc.png';