-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
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
[7.0.1]Bug: uploading a fixture break Cypress #15898
Comments
same here, it's also crashing when you're just selecting a file in the UI testrunner, so it might be more mabye an underlying problem and not with the test istelf? |
Think it's same as #15901 |
Having a very similar (if not the same) issue. @LukasM937 Can you post your full test. I guess you are starting off with a In my case I was in the process of migrating from |
I also noticed it does not crash if you stub the upload ( |
We're not sure if this is a duplicate of #15901 exactly since a fully reproducible example wasn't provided. Can someone provide a reproducible example? |
We merged in a fix for the other issue #15946, so you may try the next release around Monday to see if this issue is resolved if it is actually related. |
@jennifer-shehane Is that a patch release? I'm subscribed to the releases page so I should get a notification I guess? |
@verheyenkoen We'll have a feature release on Monday like we do every 2 weeks, barring any complications on the release day. You could technically download the pre-release if you want to follow instructions on the specific commit: a702835#commitcomment-49866616 |
@jennifer-shehane Tested that (not sure if I did it correctly though) and didn't fix my issue. Will try again on Monday after release. If not I'll try to come up with a reproducible repo. |
Thank you for the Information! Thank you for your work! |
Release 7.2.0 didn't fix our issue. Will try to create a reproducible test suite. |
@verheyenkoen, It looks like that. I look at the workaround with reverting to using |
@jennifer-shehane Here's a a test suite (using yarn) with both a |
I've tested this with release 7.2.0 and the issue still exists. In my case I'm uploading an Excel (.xlsx) file using this command Cypress.Commands.add('apiCreateTask', (eventId, task, fileName) => {
cy.intercept('POST', '/api/task').as('postTask')
const fileType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
cy.window().then(window => {
cy.fixture(fileName, 'binary').then((file) => {
// File in binary format gets converted to blob so it can be sent as Form data
const fileBlob = Cypress.Blob.binaryStringToBlob(file, fileType)
const fileToUpload = new File([fileBlob], 'testing.xlsx', { type: fileType })
window.model.taskService.saveTask(eventId, task, fileToUpload)
})
})
return cy.wait('@postTask')
})
async saveTask (task, file) {
const requestBody = new FormData()
requestBody.append('file', file)
const options = {
headers: {
'Content-Type': 'multipart/form-data'
}
}
await http.post('/api/task', requestBody, options)
} |
@verheyenkoen Thanks so much for providing a reproducible example. I can see Cypress crashing when running the tests in this repo: https://github.com/verheyenkoen/cypress-upload-intercept-problem
|
There's an example in this issue that may or may not be related. In that example, there is no uploading from within Cypress, but simply uploading a video within their app that is running inside Cypress. See #16223 (comment) |
@jennifer-shehane Which is basically what my example repo does except it does the uploading from within Cypress. If you remove the intercept there is no problem. Also if you stub the response it doesn't crash I noticed. Tested in Chrome, Electron and Firefox (both GUI and CLI). |
The code for this is done in cypress-io/cypress#16306, but has yet to be released. |
If you would like to download the pre-release version of Cypress to get this fix. Follow the instructions here |
@jennifer-shehane I already tested it on my test suite mentioned above and it works (on darwin). |
@jennifer-shehane I also tested it on the breaking test. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
I upgraded Cypress from 5.5.0 to 6.8.0 noticing a issue with the uploading from images as fixtures.
This issue was present also when one manually uploads a image to the tested site.
Since this issue, manifested after the update, I updated to 7.0.0 (and to 7.0.1 for that matter).
Current behavior
Cypress breaks when uploading an Image, thus stoping execution.
Test code to reproduce
This is the breaking part of the test,
while "cy.wait('imageRequest')" is open during it it breaks.
Due to some uncertainty in confindelity I sadly can't publish the full test.
Error Message
Versions
It works in 5.5.0,
from 6.0.1 it doesn't work but did not brake,
from 7.0.0 it breaks Cypress.
The text was updated successfully, but these errors were encountered: