We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I wrote a function that allows me to upload files by request when needed (e.g. creating default project without UI clicking). Here's code for it :
cy.wait(1000) .window() .then((win) => { const requestObject = { method: 'POST', url: `${(win as any).remote_service_base_url}/my-endpoint`, headers: { authorization: 'bearer ' + (win as any).abp.auth.getToken(), 'content-type': 'multipart/form-data', }, }; cy.fixture(FilesPage.singleFile, 'binary') .then((file) => Cypress.Blob.binaryStringToBlob(file)) .then((blob) => { const formData = new FormData(); formData.append('projectId', projectId); formData.append('comment', ''); formData.append(FilesPage.firstFileName, blob, FilesPage.firstFileName); cy.request({ ...requestObject, body: formData }).then((response) => { expect(response.status).to.eq(200); cy.wait(500); if (amountOfFiles === 2) { cy.fixture(`${FilesPage.filesPath}/${FilesPage.secondFileName}`, 'binary') .then((file) => Cypress.Blob.binaryStringToBlob(file)) .then((blob) => { const formData = new FormData(); formData.append('projectId', projectId); formData.append('comment', ''); formData.append(FilesPage.secondFileName, blob, FilesPage.secondFileName); cy.request({ ...requestObject, body: formData }).then((response) => { expect(response.status).to.eq(200); cy.wait(5000); }); }); } }); }); });
And this works just fine, it does its job.
However, in next test suite I use cypress-file-upload package and method attachFile
cypress-file-upload
attachFile
cy.log('before attachFile'); cy.get('p-fileupload input[type="file"]').wait(1000).attachFile({ filePath: filePath, encoding: 'base64', }); cy.log('after attachFile');
to upload files using the UI and I get this error. You can see that after using attachFile method the following cy.log is not invoked:
cy.log
The stack trace for this error is here, I couldn't find hints there:
What I could notice, is that if I skip the function that uploads files by request the attachFile method works as expected.
A desired behavior here would be working functionality of attachFile method no matter if upload by request is used or not.
cypress: 8.3.0 cypress-file-upload: 5.0.8 operating system: windows 10 20H2 browser: Chrome 96
I've seen topic about this error message on stackoverflow, and tried solution, but this doesn't solve the problem.
The text was updated successfully, but these errors were encountered:
abramenal
No branches or pull requests
Current behavior:
I wrote a function that allows me to upload files by request when needed (e.g. creating default project without UI clicking). Here's code for it :
And this works just fine, it does its job.
However, in next test suite I use
cypress-file-upload
package and methodattachFile
to upload files using the UI and I get this error. You can see that after using
attachFile
method the followingcy.log
is not invoked:The stack trace for this error is here, I couldn't find hints there:
What I could notice, is that if I skip the function that uploads files by request the
attachFile
method works as expected.Desired behavior:
A desired behavior here would be working functionality of
attachFile
method no matter if upload by request is used or not.Versions
cypress: 8.3.0
cypress-file-upload: 5.0.8
operating system: windows 10 20H2
browser: Chrome 96
I've seen topic about this error message on stackoverflow, and tried solution, but this doesn't solve the problem.
The text was updated successfully, but these errors were encountered: