diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 2989e357003..113d5326edc 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -11,6 +11,7 @@ _Released 10/21/2025 (PENDING)_ - An error is no longer thrown during command execution when the application under test overwrites the `window.$` property with a non-function. Fixes [#1502](https://github.com/cypress-io/cypress/issues/1502). Fixed in [#32682](https://github.com/cypress-io/cypress/pull/32682). - When running `cypress` in Cypress development environments, or when `ELECTRON_ENABLE_LOGGING` is otherwise set to 1, certain messages written to `stderr` will no longer be bracketed with verbose tags. Addresses [#32569](https://github.com/cypress-io/cypress/issues/32569). Addressed in [#32674](https://github.com/cypress-io/cypress/pull/32674). +- Improve performance of time between specs by not resetting the `file_systems` `StorageType` state when executing the CDP command `Storage.clearDataForOrigin`. Fixed in [#32703](https://github.com/cypress-io/cypress/pull/32703). **Misc:** diff --git a/packages/server/lib/browsers/cdp_automation.ts b/packages/server/lib/browsers/cdp_automation.ts index 988ce68f2da..388005feebc 100644 --- a/packages/server/lib/browsers/cdp_automation.ts +++ b/packages/server/lib/browsers/cdp_automation.ts @@ -639,7 +639,9 @@ export class CdpAutomation implements CDPClient, AutomationMiddleware { }) case 'reset:browser:state': return Promise.all([ - this.sendDebuggerCommandFn('Storage.clearDataForOrigin', { origin: '*', storageTypes: 'all' }), + // Note that we are omitting `file_systems` as it is very non-performant to clear: + // https://github.com/cypress-io/cypress/pull/32703 + this.sendDebuggerCommandFn('Storage.clearDataForOrigin', { origin: '*', storageTypes: 'cookies,indexeddb,local_storage,shader_cache,service_workers,cache_storage,interest_groups,shared_storage' }), this.sendDebuggerCommandFn('Network.clearBrowserCache'), ]) case 'reset:browser:tabs:for:next:spec': diff --git a/packages/server/lib/browsers/electron.ts b/packages/server/lib/browsers/electron.ts index fb75f9d7593..803ecc8521c 100644 --- a/packages/server/lib/browsers/electron.ts +++ b/packages/server/lib/browsers/electron.ts @@ -341,7 +341,9 @@ export = { this._handleDownloads(win, options.downloadsFolder, automation), utils.initializeCDP(pageCriClient, automation), // Ensure to clear browser state in between runs. This is handled differently in browsers when we launch new tabs, but we don't have that concept in electron - pageCriClient.send('Storage.clearDataForOrigin', { origin: '*', storageTypes: 'all' }), + // Note that we are omitting `file_systems` as it is very non-performant to clear: + // https://github.com/cypress-io/cypress/pull/32703 + pageCriClient.send('Storage.clearDataForOrigin', { origin: '*', storageTypes: 'cookies,indexeddb,local_storage,shader_cache,service_workers,cache_storage,interest_groups,shared_storage' }), pageCriClient.send('Network.clearBrowserCache'), ]) } diff --git a/packages/server/test/unit/browsers/cdp_automation_spec.ts b/packages/server/test/unit/browsers/cdp_automation_spec.ts index bc33de48b5d..71f3422edf1 100644 --- a/packages/server/test/unit/browsers/cdp_automation_spec.ts +++ b/packages/server/test/unit/browsers/cdp_automation_spec.ts @@ -560,12 +560,12 @@ context('lib/browsers/cdp_automation', () => { describe('reset:browser:state', function () { it('sends Storage.clearDataForOrigin and Network.clearBrowserCache', async function () { - this.sendDebuggerCommand.withArgs('Storage.clearDataForOrigin', { origin: '*', storageTypes: 'all' }).resolves() + this.sendDebuggerCommand.withArgs('Storage.clearDataForOrigin', { origin: '*', storageTypes: 'cookies,indexeddb,local_storage,shader_cache,service_workers,cache_storage,interest_groups,shared_storage' }).resolves() this.sendDebuggerCommand.withArgs('Network.clearBrowserCache').resolves() await this.onRequest('reset:browser:state') - expect(this.sendDebuggerCommand).to.be.calledWith('Storage.clearDataForOrigin', { origin: '*', storageTypes: 'all' }) + expect(this.sendDebuggerCommand).to.be.calledWith('Storage.clearDataForOrigin', { origin: '*', storageTypes: 'cookies,indexeddb,local_storage,shader_cache,service_workers,cache_storage,interest_groups,shared_storage' }) expect(this.sendDebuggerCommand).to.be.calledWith('Network.clearBrowserCache') }) }) diff --git a/packages/server/test/unit/browsers/electron_spec.js b/packages/server/test/unit/browsers/electron_spec.js index 5c679f250d8..7a9cc9f89bb 100644 --- a/packages/server/test/unit/browsers/electron_spec.js +++ b/packages/server/test/unit/browsers/electron_spec.js @@ -517,7 +517,7 @@ describe('lib/browsers/electron', () => { it('expects the browser to be reset', function () { return electron._launch(this.win, this.url, this.automation, this.options, undefined, undefined, { attachCDPClient: sinon.stub() }) .then(() => { - expect(this.pageCriClient.send).to.be.calledWith('Storage.clearDataForOrigin', { origin: '*', storageTypes: 'all' }) + expect(this.pageCriClient.send).to.be.calledWith('Storage.clearDataForOrigin', { origin: '*', storageTypes: 'cookies,indexeddb,local_storage,shader_cache,service_workers,cache_storage,interest_groups,shared_storage' }) expect(this.pageCriClient.send).to.be.calledWith('Network.clearBrowserCache') }) })