diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index feabaa545a98..bb7e1e0e5c84 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -20,6 +20,10 @@ _Released 11/21/2023 (PENDING)_ - Browser tabs and windows other than the Cypress tab are now closed between tests in Chromium-based browsers. Addressed in [#28204](https://github.com/cypress-io/cypress/pull/28204). - Cypress now ensures the main browser tab is active before running each command in Chromium-based browsers. Addressed in [#28334](https://github.com/cypress-io/cypress/pull/28334). +**Dependency Updates:** + +- Upgraded [`chrome-remote-interface`](https://www.npmjs.com/package/chrome-remote-interface) from `0.31.3` to `0.33.0` to increase the max payload from 100MB to 256MB. Addressed in [#27998](https://github.com/cypress-io/cypress/pull/27998). + ## 13.5.1 _Released 11/14/2023_ diff --git a/packages/data-context/src/DataContext.ts b/packages/data-context/src/DataContext.ts index e59f89233088..3b4db97e276a 100644 --- a/packages/data-context/src/DataContext.ts +++ b/packages/data-context/src/DataContext.ts @@ -351,6 +351,7 @@ export class DataContext { } _reset () { + DataContext.#activeRequestCount = 0 this.actions.servers.setAppSocketServer(undefined) this.actions.servers.setGqlSocketServer(undefined) @@ -408,6 +409,7 @@ export class DataContext { static finishActiveRequest () { this.#activeRequestCount-- + if (this.#activeRequestCount === 0) { this.#awaitingEmptyRequestCount.forEach((fn) => fn()) this.#awaitingEmptyRequestCount = [] diff --git a/packages/frontend-shared/cypress/e2e/e2ePluginSetup.ts b/packages/frontend-shared/cypress/e2e/e2ePluginSetup.ts index a6f5c0664a6b..5df4e957ff0e 100644 --- a/packages/frontend-shared/cypress/e2e/e2ePluginSetup.ts +++ b/packages/frontend-shared/cypress/e2e/e2ePluginSetup.ts @@ -202,7 +202,7 @@ async function makeE2ETasks () { process.chdir(cachedCwd) testState = {} remoteGraphQLOptions = {} - await DataContext.waitForActiveRequestsToFlush() + await globalPubSub.emitThen('test:cleanup') await ctx.actions.app.removeAppDataDir() await ctx.actions.app.ensureAppDataDirExists() diff --git a/packages/server/lib/browsers/chrome.ts b/packages/server/lib/browsers/chrome.ts index 864286776b29..57e9c7187963 100644 --- a/packages/server/lib/browsers/chrome.ts +++ b/packages/server/lib/browsers/chrome.ts @@ -611,7 +611,15 @@ export = { // navigate to the actual url if (!options.onError) throw new Error('Missing onError in chrome#open') - browserCriClient = await BrowserCriClient.create({ hosts: ['127.0.0.1'], port, browserName: browser.displayName, onAsynchronousError: options.onError, onReconnect, protocolManager: options.protocolManager, fullyManageTabs: true }) + browserCriClient = await BrowserCriClient.create({ + hosts: ['127.0.0.1'], + port, + browserName: browser.displayName, + onAsynchronousError: options.onError, + onReconnect, + protocolManager: options.protocolManager, + fullyManageTabs: true, + }) la(browserCriClient, 'expected Chrome remote interface reference', browserCriClient) diff --git a/packages/server/package.json b/packages/server/package.json index 85139411da54..c23572a2902b 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -46,7 +46,7 @@ "chalk": "2.4.2", "check-more-types": "2.24.0", "chokidar": "3.5.1", - "chrome-remote-interface": "0.31.3", + "chrome-remote-interface": "0.33.0", "cli-table3": "0.5.1", "coffeescript": "2.6.0", "color-string": "1.5.5", @@ -160,7 +160,7 @@ "@tooling/system-tests": "0.0.0-development", "@types/chai-as-promised": "7.1.2", "@types/chrome": "0.0.101", - "@types/chrome-remote-interface": "0.31.4", + "@types/chrome-remote-interface": "0.31.11", "@types/http-proxy": "1.17.4", "@types/mime": "3.0.1", "@types/node": "18.17.5", diff --git a/packages/server/test/integration/cdp_spec.ts b/packages/server/test/integration/cdp_spec.ts index b38f4208a363..f2988d74445d 100644 --- a/packages/server/test/integration/cdp_spec.ts +++ b/packages/server/test/integration/cdp_spec.ts @@ -209,13 +209,13 @@ describe('CDP Clients', () => { const send = (commands: CDPCommands[]) => { commands.forEach(({ command, params }) => { - return criClient.send(command, params) + criClient.send(command, params).catch(() => {}) }) } const on = (subscriptions: CDPSubscriptions[]) => { subscriptions.forEach(({ eventName, cb }) => { - return criClient.on(eventName, cb) + criClient.on(eventName, cb) }) } diff --git a/system-tests/__snapshots__/browser_crash_handling_spec.js b/system-tests/__snapshots__/browser_crash_handling_spec.js index e73a03aebb52..4d4c49f7c24c 100644 --- a/system-tests/__snapshots__/browser_crash_handling_spec.js +++ b/system-tests/__snapshots__/browser_crash_handling_spec.js @@ -521,7 +521,7 @@ exports['Browser Crash Handling / when the tab closes in electron / fails'] = ` Running: chrome_tab_close.cy.js (1 of 2) -We detected that the electron browser process closed unexpectedly. +We detected that the electron tab running Cypress tests closed unexpectedly. We have failed the current spec and aborted the run. diff --git a/system-tests/projects/config-with-crashing-plugin/cypress/e2e/simple_multiple.cy.js b/system-tests/projects/config-with-crashing-plugin/cypress/e2e/simple_multiple.cy.js index 8c710948ce29..6f3eab6d17c6 100644 --- a/system-tests/projects/config-with-crashing-plugin/cypress/e2e/simple_multiple.cy.js +++ b/system-tests/projects/config-with-crashing-plugin/cypress/e2e/simple_multiple.cy.js @@ -5,8 +5,8 @@ describe('suite', function () { }) it('is still true', () => { - // the config should crash before this test completes; - // this is a long wait in order to improve predictability + // the config should crash before this test completes; + // this is a long wait in order to improve predictability cy.wait(10000) expect(true).to.be.true }) diff --git a/system-tests/test/browser_crash_handling_spec.js b/system-tests/test/browser_crash_handling_spec.js index 9762dbb9f5bb..315c2cf427b5 100644 --- a/system-tests/test/browser_crash_handling_spec.js +++ b/system-tests/test/browser_crash_handling_spec.js @@ -8,22 +8,14 @@ describe('Browser Crash Handling', () => { }) // It should fail the chrome_tab_crash spec, but the simple spec should run and succeed - context('when the tab crashes in chrome', () => { - systemTests.it('fails', { - browser: 'chrome', - spec: 'chrome_tab_crash.cy.js,simple.cy.js', - snapshot: true, - expectedExitCode: 1, - }) - }) - - // It should fail the chrome_tab_crash spec, but the simple spec should run and succeed - context('when the tab crashes in electron', () => { - systemTests.it('fails', { - browser: 'electron', - spec: 'chrome_tab_crash.cy.js,simple.cy.js', - snapshot: true, - expectedExitCode: 1, + ;['chrome', 'electron'].forEach((browser) => { + context(`when the tab crashes in ${browser}`, () => { + systemTests.it('fails', { + browser, + spec: 'chrome_tab_crash.cy.js,simple.cy.js', + snapshot: true, + expectedExitCode: 1, + }) }) }) @@ -59,10 +51,7 @@ describe('Browser Crash Handling', () => { }) }) - // Because electron does not have any concepts with regard to a "page" aka a tab - // ...when the tab itself closes, the whole browser process is also closed - // so we actually want the same behavior as the "browser process is killed" - // and not to recover or continue, we should exit early + // It should fail the chrome_tab_close spec, and exit early, do not move onto the next spec context('when the tab closes in electron', () => { systemTests.it('fails', { browser: 'electron', diff --git a/yarn.lock b/yarn.lock index 7dc7a9e13952..cfb7e6c8ec98 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6210,10 +6210,10 @@ dependencies: "@types/node" "*" -"@types/chrome-remote-interface@0.31.4": - version "0.31.4" - resolved "https://registry.yarnpkg.com/@types/chrome-remote-interface/-/chrome-remote-interface-0.31.4.tgz#d07b34f4af0c7294c5b0164780b3d7bfce078155" - integrity sha512-DJHDwimNqCgAyG5gFmr6Y265pe967u3mnkeMVc0iHuf04PHzTgFypA2AjxSvtkM/pogqWxvfRYXy9Wa5Dj0U1g== +"@types/chrome-remote-interface@0.31.11": + version "0.31.11" + resolved "https://registry.yarnpkg.com/@types/chrome-remote-interface/-/chrome-remote-interface-0.31.11.tgz#bd8e3317eac339d1f831659dbb8f07a7ad785f2e" + integrity sha512-9NzphRNJaDSfI6BKQx/i6F3xQghU9PN39bssoPckYPAsOABNy2I1tCH2JUdubuAsED3zszTwivWS+K0X024pJg== dependencies: devtools-protocol "0.0.927104" @@ -10669,10 +10669,10 @@ chrome-har-capturer@0.13.4: chrome-remote-interface "^0.25.7" commander "2.x.x" -chrome-remote-interface@0.31.3: - version "0.31.3" - resolved "https://registry.yarnpkg.com/chrome-remote-interface/-/chrome-remote-interface-0.31.3.tgz#bd01b89f5f0e968f7eeb37b8b7c5ac20e6e1f4d0" - integrity sha512-NTwb1YNPHXLTus1RjqsLxJmdViKwKJg/lrFEcM6pbyQy04Ow2QKWHXyPpxzwE+dFsJghWuvSAdTy4W0trluz1g== +chrome-remote-interface@0.33.0: + version "0.33.0" + resolved "https://registry.yarnpkg.com/chrome-remote-interface/-/chrome-remote-interface-0.33.0.tgz#9140b5612ee5cdc39212cd0296d3b61ea881c47a" + integrity sha512-tv/SgeBfShXk43fwFpQ9wnS7mOCPzETnzDXTNxCb6TqKOiOeIfbrJz+2NAp8GmzwizpKa058wnU1Te7apONaYg== dependencies: commander "2.11.x" ws "^7.2.0"