-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix: ensure Cypress.stop fires all end events appropriately #31830
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9f3420d
fix: ensure that Cypress.stop fires all end events appropriately
ryanthemanuel 5b8bcae
Merge branch 'develop' into ryanm/fix/attempt-to-fix-Cypress.stop
ryanthemanuel 097260c
improvement
ryanthemanuel 1c9f3e9
add system-tests
mschile a138279
abort before/beforeEach
mschile 9ebb065
rename
mschile 81f69b8
always wait
mschile a7450d0
Merge branch 'develop' into ryanm/fix/attempt-to-fix-Cypress.stop
mschile 4be318a
update changelog
mschile e213486
updates
mschile 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 hidden or 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 hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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,5 @@ | ||
module.exports = { | ||
e2e: { | ||
setupNodeEvents (on, config) {}, | ||
}, | ||
} |
18 changes: 18 additions & 0 deletions
18
system-tests/projects/cypress-stop/cypress/e2e/after.cy.js
This file contains hidden or 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,18 @@ | ||
describe('Cypress.stop() in after', () => { | ||
after(() => { | ||
console.log('after 1') | ||
}) | ||
|
||
after(() => { | ||
Cypress.stop() | ||
console.log('after 2') | ||
}) | ||
|
||
after(() => { | ||
console.log('after 3') | ||
}) | ||
|
||
it('should run this test', () => { | ||
cy.url().should('equal', 'about:blank') | ||
}) | ||
}) |
22 changes: 22 additions & 0 deletions
22
system-tests/projects/cypress-stop/cypress/e2e/afterEach.cy.js
This file contains hidden or 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,22 @@ | ||
describe('Cypress.stop() in afterEach', () => { | ||
afterEach(() => { | ||
console.log('afterEach 1') | ||
}) | ||
|
||
afterEach(() => { | ||
Cypress.stop() | ||
console.log('afterEach 2') | ||
}) | ||
|
||
afterEach(() => { | ||
console.log('afterEach 3') | ||
}) | ||
|
||
it('should run this test', () => { | ||
cy.url().should('equal', 'about:blank') | ||
}) | ||
|
||
it('should not run this test', () => { | ||
throw new Error('This test should not run') | ||
}) | ||
}) |
22 changes: 22 additions & 0 deletions
22
system-tests/projects/cypress-stop/cypress/e2e/before.cy.js
This file contains hidden or 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,22 @@ | ||
describe('Cypress.stop() in before', () => { | ||
before(() => { | ||
console.log('before 1') | ||
}) | ||
|
||
before(() => { | ||
Cypress.stop() | ||
console.log('before 2') | ||
}) | ||
|
||
before(() => { | ||
console.log('before 3') | ||
}) | ||
|
||
it('should not run this test', () => { | ||
throw new Error('This test should not run') | ||
}) | ||
|
||
it('should also not run this test', () => { | ||
throw new Error('This test should not run') | ||
}) | ||
}) |
22 changes: 22 additions & 0 deletions
22
system-tests/projects/cypress-stop/cypress/e2e/beforeEach.cy.js
This file contains hidden or 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,22 @@ | ||
describe('Cypress.stop() in beforeEach', () => { | ||
beforeEach(() => { | ||
console.log('beforeEach 1') | ||
}) | ||
|
||
beforeEach(() => { | ||
Cypress.stop() | ||
console.log('beforeEach 2') | ||
}) | ||
|
||
beforeEach(() => { | ||
console.log('beforeEach 3') | ||
}) | ||
|
||
it('should not run this test', () => { | ||
throw new Error('This test should not run') | ||
}) | ||
|
||
it('should also not run this test', () => { | ||
throw new Error('This test should not run') | ||
}) | ||
}) |
This file contains hidden or 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,18 @@ | ||
describe('Cypress.stop() in test', () => { | ||
it('should run this test', () => { | ||
console.log('test 1') | ||
}) | ||
|
||
it('should stop during test execution', () => { | ||
return Cypress.stop() | ||
|
||
// eslint-disable-next-line no-unreachable | ||
console.log('test 2') | ||
throw new Error('This code should not run') | ||
}) | ||
|
||
it('should not run this test', () => { | ||
console.log('test 3') | ||
throw new Error('This test should not run') | ||
}) | ||
}) |
This file contains hidden or 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,38 @@ | ||
before(() => { | ||
console.log('global before') | ||
}) | ||
|
||
beforeEach(() => { | ||
console.log('global beforeEach') | ||
}) | ||
|
||
afterEach(() => { | ||
console.log('global afterEach') | ||
}) | ||
|
||
after(() => { | ||
console.log('global after') | ||
}) | ||
|
||
Cypress.on('test:before:run:async', async () => { | ||
await new Promise((resolve) => setTimeout(resolve, 1000)) | ||
console.log('test:before:run:async') | ||
}) | ||
|
||
Cypress.on('test:before:run', () => { | ||
console.log('test:before:run') | ||
}) | ||
|
||
Cypress.on('test:before:after:run:async', async () => { | ||
await new Promise((resolve) => setTimeout(resolve, 1000)) | ||
console.log('test:before:after:run:async') | ||
}) | ||
|
||
Cypress.on('test:after:run', () => { | ||
console.log('test:after:run') | ||
}) | ||
|
||
Cypress.on('test:after:run:async', async () => { | ||
await new Promise((resolve) => setTimeout(resolve, 1000)) | ||
console.log('test:after:run:async') | ||
}) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.