-
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
fix(regression): cy.pause() should not be ignored with cypress run --headed --no-exit
#20877
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ Flakiness
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 |
name: 'exit', | ||
defaultValue: true, | ||
validation: validate.isBoolean, | ||
canUpdateDuringTestTime: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does removing this fix the issue? 🤔
Do you mind explaining a little more about this fixed the regression (not entirely clear what part of the regression PR linked broke this in the first place).
Is the bug actually caused by the unique combo of --headed
and --no-exit
, or is it just related to one of those flags? Looking at the snippet in the related issue:
if (!config('isInteractive') && (!config('browser').isHeaded || config('exit'))) {
Seems it's one or the other (which means we'd probably want two system tests, one with each condition).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lmiller1990 I've updated this PR description with more details about the regression. The expected behavior is that Cypress will pause if it is in open mode or if it in run mode with --headed
and --no-exit
both passed as args. Therefore, if cypress is in run mode aka not interactive (!config('isInteractive')
) and either --headed
or --no-exit
was not passed, then we do not want to pause. Hence, the logic in the snippet above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I see! I hope we can have config('mode')
in the future - config('mode') === 'run
would be way more readable. Nice job hunting down this regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine - I had my comment clarified, also left one final question but happy to drop the ✔️ since the regression is fixed w/ a test.
spec: 'pause_simple_spec.js', | ||
snapshot: false, | ||
headed: true, | ||
noExit: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhat surprised a test can have an exit code of 0 and have noExit
as true - seems like these would conflict, but seems this isn't the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this test is still a wip- it will hang forever because --no-exit
has been passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently working on adding a callback to ExecOptions
(something like onSpawn
) that yields the ChildProcess
so we can listen to the stdout and kill the ChildProcess
within the system test itself when not exiting due to options.exit being false
gets logged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Nice!! Glad you got this figured out. At this point are the existing driver tests around this behavior helpful and/or should those test cases be updated as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work on the clean fix for this, and on the new test coverage for --no-exit
. I was really surprised that we have no coverage considering it's part of our public API.
Co-authored-by: Emily Rohrbough <[email protected]>
Co-authored-by: Zach Bloomquist <[email protected]>
* 10.0-release: (25 commits) fix: stop running spec when switching specs (#21038) fix: remove asset size warnings and enable nuxt e2e tests (#21074) feat: swap the #__cy_root id selector to become data-cy-root for component mounting (#20951) fix: Doc changes around vue2 (#21066) feat: Add vue2 package from npm/vue/v2 branch (#21026) skip failing test fix: add possible frameworks to object API config (#21056) fix snapshot spacing fix system test fix snapshot update snapshots rename spec files rename files update snapshots release 9.5.4 [skip ci] fix(regression): cy.pause() should not be ignored with `cypress run --headed --no-exit` (#20877) fix: add missing Cypress.Commands.addAll() types (#20894) chore: Don't store video and screenshot artifacts for runs (#20979) chore: Update Chrome (beta) to 101.0.4951.26 (#20957) chore: remove parallelism from test-binary-against-repo jobs (#21004) ...
User facing changelog
Fixes a regression that was introduced by this PR which prevented cy.pause() from correctly executing when run with
cypress run --headed --no-exit
.Additional details
Original implementation PR: #18358
The cause of this regression was the addition of
exit
toResolvedConfigOptions
in this PR. As a result, when the args got merged with the config,config('exit')
would always betrue
even when--no-exit
was passed. When this change was made, we should have removed this lineHowever, it was decided that
exit
should be an arg that is not included as part of config. Therefore, this PR removesexit
from theResolvedConfigOptions
and correctly passesexit
through the options so no conflicts will occur with the config and--no-exit
will still work as expected.PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?