1
//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

Bhushan
  • 11
  • 4
  • What is the error that you are getting ? – Alapan Das Aug 08 '21 at 20:19
  • 1. In Network tab , I see the "Invalidate" error (400 Bad request) as shown below :=> {"code":2000,"message":"Token not found"} -----------------------------------------------------------------------------------------2. Also There is a "Document" error (400 Bad request) after the above error :=> {"referenceId":"a1df15aa-883a-460e-9235-cb192611c721","data":{"allowedFormats":[".png",".bmp",".jpg",".tif",".gif"]},"msg":"DocumentVerificationFileFormatNotSupported"} – Bhushan Aug 09 '21 at 09:44
  • @Bhushan look like you need to login/auth yourself for file upload operation. – Tej-work Aug 09 '21 at 10:15
  • @Tej-work, As this is UI Automation, I have to login with Username and Password to submit an application (Which I have automated already ) but in the flow I am getting this type of issue... Please let me know if there is any code issue – Bhushan Aug 09 '21 at 13:28
  • @Bhushan can you share error (cypress runner screenshot)? – Tej-work Aug 09 '21 at 15:22
  • @Tej-work , Please find attached the error screenshot in test runner, a broken Image is shown instead of the image uploaded in application (Basically there is no error shown in test runner logs - but if I go to developers view -> network tab there is 400 error code, shown in screenshot as well) . – Bhushan Aug 09 '21 at 18:29

0 Answers0