Closed josephzidell closed 4 years ago
I'm seeing this too with the 4.1.0 version of this plugin.
Looking at the code in the traceback it looks like the fileContent
is wrapped with a Promise and that triggers the Cypress deprecation:
https://github.com/abramenal/cypress-file-upload/blob/b773da5be776a309f2b8b261911e9bead118869e/lib/file/getFileContent.js#L4
I'm not sure what the solution should be. In my code I ended up doing:
cy.fixture('file.xls', 'binary')
.then((binaryContent) => {
const fileContent = Cypress.Blob.binaryStringToBlob(binaryContent)
delete fileContent.then; // <== THIS
cy.get('input[data-testid=file-input]').attachFile({
fileContent,
fileName: 'file.xls',
mimeType:
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
encoding: 'utf8',
})
})
Same problem with Cypress 5.0
I opened PR https://github.com/abramenal/cypress-file-upload/pull/225
I'm seeing this too with the 4.1.0 version of this plugin.
Looking at the code in the traceback it looks like the
fileContent
is wrapped with a Promise and that triggers the Cypress deprecation: https://github.com/abramenal/cypress-file-upload/blob/b773da5be776a309f2b8b261911e9bead118869e/lib/file/getFileContent.js#L4I'm not sure what the solution should be. In my code I ended up doing:
cy.fixture('file.xls', 'binary') .then((binaryContent) => { const fileContent = Cypress.Blob.binaryStringToBlob(binaryContent) delete fileContent.then; // <== THIS cy.get('input[data-testid=file-input]').attachFile({ fileContent, fileName: 'file.xls', mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', encoding: 'utf8', }) })
Current behavior:
Desired behavior:
The file object uploads
Steps to reproduce: (app code and test code)
Versions
Cypress: 5.0 Operating system: Mac Browser: Firefox