Closed SidharthLala1 closed 3 years ago
Is this a duplicate of (or at least related to) #214 ?
@SidharthLala1 Does this work in Cypress v4.12.1?
Alternatively, please test against v4.1.0
My pre-5.0 code for this uses Cypress.Blob.binaryStringToBlob
and works:
cy.fixture('simple_2017.xlsx', 'binary')
.then(Cypress.Blob.binaryStringToBlob)
.then((fileContent) => {
cy.get('input[data-testid=pnl-input]').attachFile({
fileContent,
fileName: 'simple_2017.xlsx',
mimeType:
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
encoding: 'utf8',
})
})
I don't think .xlsx files are base64 encoded
@saschwarz does the snippet you shared work for you on current versions? I have cypress-file-upload 4.1.1 and cypress 6.2.1 and sadly it does not work for me (no errors thrown on Cypress side, but my app UI thrown an error that was not able to parse xlsx and find excelSheet)
Don't think this is relevant anymore. Feel free to reopen if you still experience this.
I am using file upload plugin to uploag imgages , csv file which works like fine now when i am trying to upload .xlsx file it throwing an error.
Desired behavior:
While using the file upload plugin and using the correct Blob type and mime , i belive i should be able to upload the .xlsx file format.
Steps to reproduce: (app code and test code)
cy.fixture('asin_xlsx.xlsx', 'binary') .then(Cypress.Blob.base64StringToBlob) .then(fileContent => { cy.get('input[type=file]').upload({ fileContent, fileName: 'asin_xlsx.xlsx', mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', encoding: 'utf-8', }) })
Versions
Cypress version 5.0 , Windows 64 bit , Windows 10 Pro https://www.loom.com/share/da6acb11bc70424a9346dca35338fc38