diff --git a/.circleci/cache-version.txt b/.circleci/cache-version.txt index 36b5b0fd6622..e28e8ca9e43d 100644 --- a/.circleci/cache-version.txt +++ b/.circleci/cache-version.txt @@ -1,3 +1,3 @@ # Bump this version to force CI to re-create the cache from scratch. -04-15-24-macstadium-3 +04-22-24 diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index a37d595f6a39..23358e95ad6b 100644 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -29,9 +29,7 @@ mainBuildFilters: &mainBuildFilters - develop - /^release\/\d+\.\d+\.\d+$/ # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - - 'cacie/fix/websocket-closed' - - 'app-mem-mng-flag' - - 'publish-binary' + - 'update-v8-snapshot-cache-on-develop' # usually we don't build Mac app - it takes a long time # but sometimes we want to really confirm we are doing the right thing @@ -42,8 +40,7 @@ macWorkflowFilters: &darwin-workflow-filters - equal: [ develop, << pipeline.git.branch >> ] # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] - - equal: [ 'cacie/fix/websocket-closed', << pipeline.git.branch >> ] - - equal: [ 'app-mem-mng-flag', << pipeline.git.branch >> ] + - equal: [ 'mschile/service_worker_uncontrolled', << pipeline.git.branch >> ] - matches: pattern: /^release\/\d+\.\d+\.\d+$/ value: << pipeline.git.branch >> @@ -54,8 +51,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters - equal: [ develop, << pipeline.git.branch >> ] # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] - - equal: [ 'cacie/fix/websocket-closed', << pipeline.git.branch >> ] - - equal: [ 'app-mem-mng-flag', << pipeline.git.branch >> ] + - equal: [ 'mschile/service_worker_uncontrolled', << pipeline.git.branch >> ] - matches: pattern: /^release\/\d+\.\d+\.\d+$/ value: << pipeline.git.branch >> @@ -78,8 +74,7 @@ windowsWorkflowFilters: &windows-workflow-filters - equal: [ develop, << pipeline.git.branch >> ] # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] - - equal: [ 'cacie/fix/websocket-closed', << pipeline.git.branch >> ] - - equal: [ 'app-mem-mng-flag', << pipeline.git.branch >> ] + - equal: [ 'mschile/service_worker_uncontrolled', << pipeline.git.branch >> ] - matches: pattern: /^release\/\d+\.\d+\.\d+$/ value: << pipeline.git.branch >> @@ -146,7 +141,7 @@ commands: name: Set environment variable to determine whether or not to persist artifacts command: | echo "Setting SHOULD_PERSIST_ARTIFACTS variable" - echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "feat/psrotocol_shadow_dom_support" && "$CIRCLE_BRANCH" != "feat/support_wds5" && "$CIRCLE_BRANCH" != "cacie/fix/websocket-closed" ]]; then + echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "mschile/service_worker_uncontrolled" ]]; then export SHOULD_PERSIST_ARTIFACTS=true fi' >> "$BASH_ENV" # You must run `setup_should_persist_artifacts` command and be using bash before running this command diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index cae1ef0d82c4..c3d3e2a049f1 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -3,9 +3,13 @@ _Released 4/23/2024 (PENDING)_ +**Performance:** + +- Fixed a performance issue with activated service workers that aren't controlling clients which could lead to correlation timeouts. Fixes [#29333](https://github.com/cypress-io/cypress/issues/29333) and [#29126](https://github.com/cypress-io/cypress/issues/29126). + **Bugfixes:** -- Fixed a bug introduced in [`13.6.0`](https://docs.cypress.io/guides/references/changelog#13-6-0) where Cypress would occasionally exit with status code 1, even when a test run was successfully, due to an unhandled WebSocket exception (`Error: WebSocket connection closed`). Addresses [#28523](https://github.com/cypress-io/cypress/issues/28523). +- Fixed a regression introduced in [`13.6.0`](https://docs.cypress.io/guides/references/changelog#13-6-0) where Cypress would occasionally exit with status code 1, even when a test run was successful, due to an unhandled WebSocket exception (`Error: WebSocket connection closed`). Addresses [#28523](https://github.com/cypress-io/cypress/issues/28523). - Fixed an issue where Cypress would hang on some commands when an invalid `timeout` option was provided. Fixes [#29323](https://github.com/cypress-io/cypress/issues/29323). **Dependency Updates:** diff --git a/packages/driver/cypress/e2e/e2e/service-worker.cy.js b/packages/driver/cypress/e2e/e2e/service-worker.cy.js index d4e93d663c93..122782d82fcc 100644 --- a/packages/driver/cypress/e2e/e2e/service-worker.cy.js +++ b/packages/driver/cypress/e2e/e2e/service-worker.cy.js @@ -666,4 +666,51 @@ describe('service workers', { defaultCommandTimeout: 1000, pageLoadTimeout: 1000 cy.get('#output').should('have.text', 'done') validateFetchHandlers({ listenerCount: 1 }) }) + + it('supports a service worker that is activated but not handling fetch events', () => { + const script = () => { + self.addEventListener('fetch', function (event) { + event.respondWith(fetch(event.request)) + }) + } + + cy.intercept('/fixtures/service-worker.js', (req) => { + req.reply(`(${script})()`, + { 'Content-Type': 'application/javascript' }) + }) + + cy.visit('fixtures/service-worker.html?skipReload') + + cy.get('#output').should('have.text', 'done') + validateFetchHandlers({ listenerCount: 1 }) + }) + + it('supports a redirected request', () => { + const script = () => { + self.addEventListener('fetch', function (event) { + return + }) + } + + cy.intercept('/fixtures/service-worker.js', (req) => { + req.reply(`(${script})()`, + { 'Content-Type': 'application/javascript' }) + }) + + cy.intercept('/fixtures/1mb*', (req) => { + req.reply({ + statusCode: 302, + headers: { + location: '/fixtures/redirected', + }, + }) + }) + + cy.intercept('/fixtures/redirected', (req) => { + req.reply('redirected') + }) + + cy.visit('fixtures/service-worker.html') + cy.get('#output').should('have.text', 'done') + }) }) diff --git a/packages/driver/cypress/fixtures/service-worker.html b/packages/driver/cypress/fixtures/service-worker.html index 6ca9ad9eebf5..182ffda29033 100644 --- a/packages/driver/cypress/fixtures/service-worker.html +++ b/packages/driver/cypress/fixtures/service-worker.html @@ -4,7 +4,7 @@