-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Update Blob use to be compatible with Cypress 5.0 #215
Update Blob use to be compatible with Cypress 5.0 #215
Conversation
Any way I can test this? I tried:
|
Cypress adds a val.then = function () {
$errUtil.throwErrByPath('breaking_change.blob_util2', {
args: {
functionName: key,
},
})
} Perhaps wrapping it around According to the bluebird docs:
|
Maybe @jennifer-shehane can shed some light on this? What else would have to be done to have a working blob-util again? |
We added the You should be able to work around it by using // before:
Cypress.Promise.resolve(Cypress.Blob.base64StringToBlob(fileContent, mimeType))
// after:
Cypress.Promise.try(() => Cypress.Blob.base64StringToBlob(fileContent, mimeType))) |
I tried with this code instead, but I get the very same result...
|
Co-authored-by: Chris Breiding <[email protected]>
Thanks, @chrisbreiding! I missed that detail... still a bit early in the morning 😅 ☕ |
It's just a fancy way of handling the non-async part of the potential errors.
|
That's my bad. I suggested it before trying it out. I had hoped it wouldn't trigger using Might have to resort to an ugly hack to fix this. Something like the following: const removeThen = (value) => {
if (value) value.then = undefined
return value
}
Cypress.Promise.resolve(removeThen(Cypress.Blob.base64StringToBlob(fileContent, mimeType))) |
I'm thinking we'll want to condition that on the Cypress version too? To be compatible with < 5.0.0. I'll draft it up. |
Sorry for the hassle with this one. We'll improve this for the next release, but unfortunately the hack will have to remain for users on 5.0.0. |
Ok, I actually did due diligence this time and confirmed efa9358 works on my tests locally for 4.12.1 and 5.0.0. 🤞 |
Yeah, I can confirm that this fix work perfectly fine now :) |
Is there an estimate for when this might be merged for the plugin? I'm trying to use the PR branch but I'm running into some issues (webpack can't resolve the module). |
MaintainerNotAvailableException? |
Hope this gets merged soon this works perfectly! |
Can anyone help me figure out how to use the https://github.com/binti-family/cypress-file-upload/tree/cypress-v5-compat branch in my build? What I did:
When I run my test, I get this error:
When I inspect the I'm using yarn workspaces, so my === cd /node_modules/cypress-file-input
yarn
yarn build |
Ok! Updated to use semver for comparison and I tried it locally on Cypress 4 and 5. Would appreciate anyone else double checking though! |
@abramenal Before this gets merged, I asked the author to try a different way that introduces no new dependencies and might also be safer. Hopefully we can wait 1 more day for that. |
I had a chance to update to use @josephzidell's approach and check it on Cypress 4 and 5 again. |
LGTM |
@all-contributors add @emilong for code |
I've put up a pull request to add @emilong! 🎉 |
Will you also make a new release? |
We're working on it 🍻 |
@all-contributors add @josephzidell for maintenance |
I've put up a pull request to add @josephzidell! 🎉 |
Thanks everyone for working on this, |
Unfortunately, Cypress 5 is still showing this error:
|
Thank you !!! I can confirmed that it worked !! 👍 |
It worked for me too !! Thanks a lot |
I just pulled the latest code, I can confirm the file upload is working on the latest cypress version, thank you so much guys! |
Having the same error here |
I'm also still getting the error that @josephzidell and @JohnnyChiang mentioned. Going to downgrade again until this is stable. |
@Ksan8 @josephzidell @JohnnyChiang can you say more about your set up? E.g. I'm using cypress to drive chrome only and I didn't have any other plugins/extensions that hit this issue. Those are the first two things that come to mind as being possibilities? |
@Ksan8 @josephzidell @JohnnyChiang take a look at #222 and #225 to see if that is your use case. Also, 4.1.1 has been released with a fix. |
Wraps return value of
Cypress.Blob.base64StringToBlob()
in aCypress.Promise.resolve
, which will allow us to treat it as a Promise no matter what. If it's already a Promise, as it was in Cypress <=4, this will be also be compatible.Fixes #214