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: ensure that fatal protocol errors are only limited to the spec they occurred on #27720

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ _Released 09/12/2023 (PENDING)_
- Fixed a regression introduced in Cypress [13.0.0](#13-0-0) where the [Module API](https://docs.cypress.io/guides/guides/module-api), [`after:run`](https://docs.cypress.io/api/plugins/after-run-api), and [`after:spec`](https://docs.cypress.io/api/plugins/after-spec-api) results did not include the `stats.skipped` field for each run result. Fixes [#27694](https://github.com/cypress-io/cypress/issues/27694). Addressed in [#27695](https://github.com/cypress-io/cypress/pull/27695).
- Individual CDP errors that occur while capturing data for test replay will no longer prevent the entire run from being available. Addressed in [#27709](https://github.com/cypress-io/cypress/pull/27709).
- Fixed an issue where the release date on the `v13` landing page was a day behind. Fixed in [#27711](https://github.com/cypress-io/cypress/pull/27711).
- Fixed an issue where fatal protocol errors would leak between specs causing all subsequent specs to fail to upload protocol information. Fixed in [#27720](https://github.com/cypress-io/cypress/pull/27720)

## 13.0.0

Expand Down
14 changes: 7 additions & 7 deletions packages/driver/cypress/e2e/commands/sessions/sessions.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('cy.session', { retries: 0 }, () => {
const clearCurrentSessionData = cy.spy(Cypress.session, 'clearCurrentSessionData')

await Cypress.action('runner:test:before:run:async', {
runnable: 'r1',
id: 'r1',
currentRetry: 0,
}, Cypress.state('runnable'))

Expand All @@ -127,7 +127,7 @@ describe('cy.session', { retries: 0 }, () => {
const backendSpy = cy.spy(Cypress, 'backend').log(false)

await Cypress.action('runner:test:before:run:async', {
runnable: 'r1',
id: 'r1',
currentRetry: 0,
}, Cypress.state('runnable'))

Expand All @@ -144,7 +144,7 @@ describe('cy.session', { retries: 0 }, () => {
cy.spy(Cypress, 'action').log(false)

await Cypress.action('runner:test:before:run:async', {
runnable: 'r1',
id: 'r1',
currentRetry: 0,
}, Cypress.state('runnable'))
})
Expand Down Expand Up @@ -839,7 +839,7 @@ describe('cy.session', { retries: 0 }, () => {
cy.spy(Cypress, 'action').log(false)

await Cypress.action('runner:test:before:run:async', {
runnable: 'r1',
id: 'r1',
currentRetry: 0,
}, Cypress.state('runnable'))

Expand All @@ -853,7 +853,7 @@ describe('cy.session', { retries: 0 }, () => {
const clearCurrentSessionData = cy.spy(Cypress.session, 'clearCurrentSessionData')

await Cypress.action('runner:test:before:run:async', {
runnable: 'r1',
id: 'r1',
currentRetry: 0,
}, Cypress.state('runnable'))

Expand All @@ -864,7 +864,7 @@ describe('cy.session', { retries: 0 }, () => {
const backendSpy = cy.spy(Cypress, 'backend').log(false)

await Cypress.action('runner:test:before:run:async', {
runnable: 'r1',
id: 'r1',
currentRetry: 0,
}, Cypress.state('runnable'))

Expand All @@ -882,7 +882,7 @@ describe('cy.session', { retries: 0 }, () => {
cy.spy(Cypress, 'action').log(false)

await Cypress.action('runner:test:before:run:async', {
runnable: 'r1',
id: 'r1',
currentRetry: 0,
}, Cypress.state('runnable'))

Expand Down
2 changes: 1 addition & 1 deletion packages/driver/cypress/e2e/commands/window.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ describe('src/cy/commands/window', () => {

cy.viewport(500, 400).then(async () => {
await Cypress.action('runner:test:before:run:async', {
runnable: 'r1',
id: 'r1',
currentRetry: 0,
}, Cypress.state('runnable'))
.then(() => {
Expand Down
3 changes: 3 additions & 0 deletions packages/server/lib/cloud/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ export class ProtocolManager implements ProtocolManagerShape {
return
}

// Reset the errors here so that we are tracking on them per-spec
this._errors = []

try {
this._beforeSpec(spec)
} catch (error) {
Expand Down
8 changes: 8 additions & 0 deletions packages/server/test/unit/cloud/protocol_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,18 @@ describe('lib/cloud/protocol', () => {
it('should be able to initialize a new spec', () => {
sinon.stub(protocol, 'beforeSpec')

;(protocolManager as any)._errors = [
{
captureMethod: 'cdpClient.on',
},
]

protocolManager.beforeSpec({
instanceId: 'instanceId',
})

expect((protocolManager as any)._errors).to.be.empty

expect(protocol.beforeSpec).to.be.calledWith({
workingDirectory: path.join(os.tmpdir(), 'cypress', 'protocol'),
archivePath: path.join(os.tmpdir(), 'cypress', 'protocol', 'instanceId.tar'),
Expand Down