Skip to content
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

fix: Remove error message wrapping of Cypress.Blob return values #8366

Merged
merged 2 commits into from
Aug 20, 2020

Conversation

chrisbreiding
Copy link
Contributor

@chrisbreiding chrisbreiding commented Aug 20, 2020

User facing changelog

  • Cypress no longer adds a .then method to the return value of Cypress.Blob methods for the sake of a custom error message. Fixes an issue where those return values were mistaken for promises and unintentionally trigger the custom error.

Additional details

There is no longer a custom error message for using the old promise-returning API of Blob methods, but it makes it easier to wrap those methods for backwards compatibility. I think this an okay compromise.

How has the user experience changed?

Before, this would incorrectly error:

Cypress.Promise.resolve(Cypress.Blob.base64StringToBlob(btoa('foo'))
// => throws error 'base64StringToBlob() no longer returns a Promise. Update the use of base64StringToBlob() to expect a returned Blob'

Now it does not error:

Cypress.Promise.resolve(Cypress.Blob.base64StringToBlob(btoa('foo'))
// => returns promise with base64 value

The error experience of using .then has degraded a bit:

Before:

Cypress.Blob.base64StringToBlob(btoa('foo').then(() => {})
// => throws error 'base64StringToBlob() no longer returns a Promise. Update the use of base64StringToBlob() to expect a returned Blob'

After:

Cypress.Blob.base64StringToBlob(btoa('foo').then(() => {})
// => throws error '.then is not a function'

PR Tasks

  • Have tests been added/updated?
  • Has the original issue been tagged with a release in ZenHub?

@chrisbreiding chrisbreiding requested a review from kuceb August 20, 2020 15:30
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 20, 2020

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Aug 20, 2020



Test summary

8134 0 108 3


Run details

Project cypress
Status Passed
Commit fbaf084
Started Aug 20, 2020 4:31 PM
Ended Aug 20, 2020 4:38 PM
Duration 06:56 💡
OS Linux Debian - 10.2
Browser Multiple

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@chrisbreiding chrisbreiding merged commit 1fb7a88 into develop Aug 20, 2020
@chrisbreiding chrisbreiding deleted the issue-8365-blob-method-fix branch April 5, 2022 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove .then wrap from return value of Cypress.Blob.base64StringToBlob
2 participants