-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Cypress Promise behavior differs between local run and CI run #2651
Comments
This fails the same way with: promise.then((value) => updateDiv('then', `then: ${value}`))
promise.catch((value) => updateDiv('catch', `catch: ${value}`))
promise.finally(() => updateDiv('finally', 'finally'))
So does not seem to simply be a problem with the return value of |
Cypress really only guarantees that its own code and your test code will run in the browser. Since this is your app code, it's out of Cypress's jurisdiction. If you were to run your code in IE or Edge, it would fail for the same reason, regardless of Cypress. I guess the bug here is that you can currently only run in Electron headlessly and you can't control that version. We plan to add support for other headless browsers in the future so you'll have more control over what's running headlessly. In any case, we'll be bumping the Electron version in the near future, which will 'fix' this. |
Ah, that would explain it, thanks. I did add: throw new Error(Promise.prototype.finally) to the spec ( 1) Cypress Promise behavior works:
Error: function (onFinally) {
var C = speciesConstructor(this, core.Promise || global.Promise);
var isFunction = typeof onFinally == 'function';
return this.then(
isFunction ? function (x) {
return promiseResolve(C, onFinally()).then(function () { return x; });
} : onFinally,
isFunction ? function (e) {
return promiseResolve(C, onFinally()).then(function () { throw e; });
} : onFinally
);
} so I mistakenly thought it was available. I also tried adding a promise finally shim but got the same result. Thanks again! I've refactored my actual code to use async/await and try/catch (Babel transpiled) which seem to work fine. Looking forward to the new version. |
You can run Chrome in Closing this issue in favor of the issue to upgrade Electron, which would solve your issue: #2559 |
Is this a Feature or Bug?
Bug
Current behavior:
finally
not definedDesired behavior:
Promises behave consistently between environments and a Promise's
finally
method is defined and supported incypress run
.Steps to reproduce:
I created a simple example page for reproduction:
To reproduce:
$ yarn run serve # start server to serve index.html
$ yarn run cypress open # open Cypress and click on the promise spec
Observe it works as expected (and mirrors browser behavior):

Use the runner (assuming server still running):
Versions
(I've tried all of the above using
npm
instead ofyarn
just to make sure and it succeeded/failed the same way)The text was updated successfully, but these errors were encountered: