I have a tests written in Cypress. One of the tests uploading one pdf file looks like this:
it('uploads one document', () => {
cy.get('input[type="file"]')
.attachFile({ filePath: pdfFilePath, encoding: 'base64' , mimeType: 'application/pdf'});
cy.get('div.table-body>.table-row')
.find('.col-upload-name')
.should('have.text', 'TestDocument.pdf')
cy.get('a.button-action').contains('Upload').click()
cy.get('div.table-body>.table-row')
.find('.status-done')
.should('contain.text', 'Uploaded')
})
Where pdfFilePath is string path to pdf file in fixtures directory.
When tests uploading pdf files are at the beginning of the test suite, they pass:
When they are at the end of the test suite, they fail:
and I get this error:
Does anyone has any ideas why is that?