-
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
fix(regression): cy.pause() should not be ignored with cypress run --headed --no-exit
#20877
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
24b3933
fix: remove exit from new config
davidmunechika 744e327
add system test
davidmunechika bb99f01
add system test
davidmunechika adba9bc
fix merge
davidmunechika 3e9bed6
Merge branch 'develop' into issue-20745-pause-headed-regression
davidmunechika 2b37016
fix --no-exit
davidmunechika f2b821a
add system tests
davidmunechika 27e6079
add onSpawn callback to system tests
davidmunechika a212cb1
remove outdated test
davidmunechika 1672a4d
fix types
davidmunechika 3ea8a31
fix tests
davidmunechika 48d106e
generalize test name
davidmunechika ecafaad
fix types
davidmunechika e46c82d
Merge branch 'develop' into issue-20745-pause-headed-regression
davidmunechika 6f47be2
fix types
davidmunechika 334e356
fix tests
davidmunechika 9345bb0
fix return type
davidmunechika 3ddfe99
combine spec files
davidmunechika 42ef9ab
update snapshot
davidmunechika File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
179 changes: 179 additions & 0 deletions
179
system-tests/__snapshots__/pause_headed_exit_spec.ts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
exports['cy.pause() in run mode / pauses with --headed and --no-exit'] = ` | ||
|
||
==================================================================================================== | ||
|
||
(Run Starting) | ||
|
||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Cypress: 1.2.3 │ | ||
│ Browser: FooBrowser 88 │ | ||
│ Specs: 1 found (pause_spec.js) │ | ||
│ Searched: cypress/integration/pause_spec.js │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
|
||
|
||
──────────────────────────────────────────────────────────────────────────────────────────────────── | ||
|
||
Running: pause_spec.js (1 of 1) | ||
|
||
|
||
cy.pause() | ||
✓ pauses | ||
|
||
|
||
1 passing | ||
|
||
not exiting due to options.exit being false | ||
|
||
` | ||
|
||
exports['cy.pause() in run mode / does not pause if headless'] = ` | ||
|
||
==================================================================================================== | ||
|
||
(Run Starting) | ||
|
||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Cypress: 1.2.3 │ | ||
│ Browser: FooBrowser 88 │ | ||
│ Specs: 1 found (pause_spec.js) │ | ||
│ Searched: cypress/integration/pause_spec.js │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
|
||
|
||
──────────────────────────────────────────────────────────────────────────────────────────────────── | ||
|
||
Running: pause_spec.js (1 of 1) | ||
|
||
|
||
cy.pause() | ||
✓ pauses | ||
|
||
|
||
1 passing | ||
|
||
not exiting due to options.exit being false | ||
|
||
` | ||
|
||
exports['cy.pause() in run mode / does not pause without --no-exit'] = ` | ||
|
||
==================================================================================================== | ||
|
||
(Run Starting) | ||
|
||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Cypress: 1.2.3 │ | ||
│ Browser: FooBrowser 88 │ | ||
│ Specs: 1 found (pause_spec.js) │ | ||
│ Searched: cypress/integration/pause_spec.js │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
|
||
|
||
──────────────────────────────────────────────────────────────────────────────────────────────────── | ||
|
||
Running: pause_spec.js (1 of 1) | ||
|
||
|
||
cy.pause() | ||
✓ pauses | ||
|
||
|
||
1 passing | ||
|
||
|
||
(Results) | ||
|
||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Tests: 1 │ | ||
│ Passing: 1 │ | ||
│ Failing: 0 │ | ||
│ Pending: 0 │ | ||
│ Skipped: 0 │ | ||
│ Screenshots: 0 │ | ||
│ Video: true │ | ||
│ Duration: X seconds │ | ||
│ Spec Ran: pause_spec.js │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
|
||
|
||
(Video) | ||
|
||
- Started processing: Compressing to 32 CRF | ||
- Finished processing: /XXX/XXX/XXX/cypress/videos/pause_spec.js.mp4 (X second) | ||
|
||
|
||
==================================================================================================== | ||
|
||
(Run Finished) | ||
|
||
|
||
Spec Tests Passing Failing Pending Skipped | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ ✔ pause_spec.js XX:XX 1 1 - - - │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
✔ All specs passed! XX:XX 1 1 - - - | ||
|
||
|
||
` | ||
|
||
exports['cy.pause() in run mode / does not pause without --headed and --no-exit'] = ` | ||
|
||
==================================================================================================== | ||
|
||
(Run Starting) | ||
|
||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Cypress: 1.2.3 │ | ||
│ Browser: FooBrowser 88 │ | ||
│ Specs: 1 found (pause_spec.js) │ | ||
│ Searched: cypress/integration/pause_spec.js │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
|
||
|
||
──────────────────────────────────────────────────────────────────────────────────────────────────── | ||
|
||
Running: pause_spec.js (1 of 1) | ||
|
||
|
||
cy.pause() | ||
✓ pauses | ||
|
||
|
||
1 passing | ||
|
||
|
||
(Results) | ||
|
||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Tests: 1 │ | ||
│ Passing: 1 │ | ||
│ Failing: 0 │ | ||
│ Pending: 0 │ | ||
│ Skipped: 0 │ | ||
│ Screenshots: 0 │ | ||
│ Video: true │ | ||
│ Duration: X seconds │ | ||
│ Spec Ran: pause_spec.js │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
|
||
|
||
(Video) | ||
|
||
- Started processing: Compressing to 32 CRF | ||
- Finished processing: /XXX/XXX/XXX/cypress/videos/pause_spec.js.mp4 (X second) | ||
|
||
|
||
==================================================================================================== | ||
|
||
(Run Finished) | ||
|
||
|
||
Spec Tests Passing Failing Pending Skipped | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ ✔ pause_spec.js XX:XX 1 1 - - - │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
✔ All specs passed! XX:XX 1 1 - - - | ||
|
||
|
||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
system-tests/projects/e2e/cypress/integration/pause_spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
describe('cy.pause()', () => { | ||
it('pauses', () => { | ||
let didPause = false | ||
|
||
cy.visit('https://example.cypress.io') | ||
|
||
cy.once('paused', (name) => { | ||
cy.once('paused', (name) => { | ||
didPause = true | ||
|
||
// resume the rest of the commands so this | ||
// test ends | ||
Cypress.emit('resume:all') | ||
}) | ||
|
||
Cypress.emit('resume:next') | ||
}) | ||
|
||
cy.pause().wrap({}).should('deep.eq', {}).then(function () { | ||
if (Cypress.env('SHOULD_PAUSE')) { | ||
expect(didPause).to.be.true | ||
|
||
// should no longer have onPaused | ||
expect(cy.state('onPaused')).to.be.null | ||
} else { | ||
expect(didPause).to.be.false | ||
} | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: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 aboveThere 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.