diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 54570f4881a2..71a861b41c62 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -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 diff --git a/packages/driver/cypress/e2e/commands/sessions/sessions.cy.js b/packages/driver/cypress/e2e/commands/sessions/sessions.cy.js index 5249f7a8d8c4..ce6d6581c1cd 100644 --- a/packages/driver/cypress/e2e/commands/sessions/sessions.cy.js +++ b/packages/driver/cypress/e2e/commands/sessions/sessions.cy.js @@ -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')) @@ -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')) @@ -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')) }) @@ -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')) @@ -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')) @@ -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')) @@ -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')) diff --git a/packages/driver/cypress/e2e/commands/window.cy.js b/packages/driver/cypress/e2e/commands/window.cy.js index eb7f2006e680..9a3b8cff31a9 100644 --- a/packages/driver/cypress/e2e/commands/window.cy.js +++ b/packages/driver/cypress/e2e/commands/window.cy.js @@ -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(() => { diff --git a/packages/server/lib/cloud/protocol.ts b/packages/server/lib/cloud/protocol.ts index 98163018db0d..3631d173d711 100644 --- a/packages/server/lib/cloud/protocol.ts +++ b/packages/server/lib/cloud/protocol.ts @@ -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) { diff --git a/packages/server/test/unit/cloud/protocol_spec.ts b/packages/server/test/unit/cloud/protocol_spec.ts index 64c9123a940c..1a79328470ad 100644 --- a/packages/server/test/unit/cloud/protocol_spec.ts +++ b/packages/server/test/unit/cloud/protocol_spec.ts @@ -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'),