I am getting an Error when I tried to Upload a file (image of jpg/png) with Cypress and Java script

253 views Asked by At
//Click on File Upload and upload the DL
cy.get('p').contains('Upload your Document').parent('span').parent('button').click();
cy.fixture('./testData/JamesBondDL.png').then(fileContent => {
  cy.get('p').contains('Front Side').parent('div>div').find('input[type="file"]').attachFile({
    fileContent: fileContent.toString(),
    fileName: 'JamesBond.png',
    mimeType: 'image/png'
  });
});

// I have added the import package under cypress/support/commands.js // i.e import 'cypress-file-upload';

1

2

3

0

There are 0 answers