Skip to content

Commit d8b4821

Browse files
fix: ensure that fatal protocol errors are only limited to the spec they occurred on (#27720)
1 parent 6081751 commit d8b4821

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

cli/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ _Released 09/12/2023 (PENDING)_
1212
- 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).
1313
- 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).
1414
- 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).
15+
- 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)
1516

1617
## 13.0.0
1718

packages/driver/cypress/e2e/commands/sessions/sessions.cy.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('cy.session', { retries: 0 }, () => {
116116
const clearCurrentSessionData = cy.spy(Cypress.session, 'clearCurrentSessionData')
117117

118118
await Cypress.action('runner:test:before:run:async', {
119-
runnable: 'r1',
119+
id: 'r1',
120120
currentRetry: 0,
121121
}, Cypress.state('runnable'))
122122

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

129129
await Cypress.action('runner:test:before:run:async', {
130-
runnable: 'r1',
130+
id: 'r1',
131131
currentRetry: 0,
132132
}, Cypress.state('runnable'))
133133

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

146146
await Cypress.action('runner:test:before:run:async', {
147-
runnable: 'r1',
147+
id: 'r1',
148148
currentRetry: 0,
149149
}, Cypress.state('runnable'))
150150
})
@@ -839,7 +839,7 @@ describe('cy.session', { retries: 0 }, () => {
839839
cy.spy(Cypress, 'action').log(false)
840840

841841
await Cypress.action('runner:test:before:run:async', {
842-
runnable: 'r1',
842+
id: 'r1',
843843
currentRetry: 0,
844844
}, Cypress.state('runnable'))
845845

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

855855
await Cypress.action('runner:test:before:run:async', {
856-
runnable: 'r1',
856+
id: 'r1',
857857
currentRetry: 0,
858858
}, Cypress.state('runnable'))
859859

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

866866
await Cypress.action('runner:test:before:run:async', {
867-
runnable: 'r1',
867+
id: 'r1',
868868
currentRetry: 0,
869869
}, Cypress.state('runnable'))
870870

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

884884
await Cypress.action('runner:test:before:run:async', {
885-
runnable: 'r1',
885+
id: 'r1',
886886
currentRetry: 0,
887887
}, Cypress.state('runnable'))
888888

packages/driver/cypress/e2e/commands/window.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ describe('src/cy/commands/window', () => {
670670

671671
cy.viewport(500, 400).then(async () => {
672672
await Cypress.action('runner:test:before:run:async', {
673-
runnable: 'r1',
673+
id: 'r1',
674674
currentRetry: 0,
675675
}, Cypress.state('runnable'))
676676
.then(() => {

packages/server/lib/cloud/protocol.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ export class ProtocolManager implements ProtocolManagerShape {
134134
return
135135
}
136136

137+
// Reset the errors here so that we are tracking on them per-spec
138+
this._errors = []
139+
137140
try {
138141
this._beforeSpec(spec)
139142
} catch (error) {

packages/server/test/unit/cloud/protocol_spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,18 @@ describe('lib/cloud/protocol', () => {
8080
it('should be able to initialize a new spec', () => {
8181
sinon.stub(protocol, 'beforeSpec')
8282

83+
;(protocolManager as any)._errors = [
84+
{
85+
captureMethod: 'cdpClient.on',
86+
},
87+
]
88+
8389
protocolManager.beforeSpec({
8490
instanceId: 'instanceId',
8591
})
8692

93+
expect((protocolManager as any)._errors).to.be.empty
94+
8795
expect(protocol.beforeSpec).to.be.calledWith({
8896
workingDirectory: path.join(os.tmpdir(), 'cypress', 'protocol'),
8997
archivePath: path.join(os.tmpdir(), 'cypress', 'protocol', 'instanceId.tar'),

0 commit comments

Comments
 (0)