diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index ed8fb6f1bb70..7d8dba727ca6 100644 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -3566,7 +3566,7 @@ windows-workflow: &windows-workflow - run-app-integration-tests-chrome: name: windows-run-app-integration-tests-chrome executor: windows - resource_class: windows.large + resource_class: windows.xlarge context: [test-runner:cypress-record-key, test-runner:launchpad-tests] requires: - windows-build @@ -3574,7 +3574,7 @@ windows-workflow: &windows-workflow - run-launchpad-integration-tests-chrome: name: windows-run-launchpad-integration-tests-chrome executor: windows - resource_class: windows.large + resource_class: windows.xlarge context: [test-runner:cypress-record-key, test-runner:launchpad-tests] requires: - windows-build @@ -3582,7 +3582,7 @@ windows-workflow: &windows-workflow - unit-tests: name: windows-unit-tests executor: windows - resource_class: windows.large + resource_class: windows.medium requires: - windows-build @@ -3614,13 +3614,13 @@ windows-workflow: &windows-workflow - v8-integration-tests: name: windows-v8-integration-tests executor: windows - resource_class: windows.large + resource_class: windows.medium requires: - windows-build - driver-integration-memory-tests: name: windows-driver-integration-memory-tests executor: windows - resource_class: windows.large + resource_class: windows.medium requires: - windows-build diff --git a/.vscode/settings.json b/.vscode/settings.json index 4b221598aa42..3e90e64819c5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -19,7 +19,7 @@ "json" ], "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "typescript.tsdk": "node_modules/typescript/lib", diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 1a6cac0810c1..6020238b624f 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -1,12 +1,21 @@ ## 13.6.2 -_Released 12/19/2023 (PENDING)_ +_Released 12/26/2023_ **Bugfixes:** +- Fixed a regression in [`13.6.1`](https://docs.cypress.io/guides/references/changelog/13.6.1) where a malformed URI would crash Cypress. Fixes [#28521](https://github.com/cypress-io/cypress/issues/28521). - Fixed a regression in [`12.4.0`](https://docs.cypress.io/guides/references/changelog/12.4.0) where erroneous `
` tags were displaying in error messages in the Command Log making them less readable. Fixes [#28452](https://github.com/cypress-io/cypress/issues/28452). +**Performance:** + +- Improved performance when finding unique selectors for command log snapshots for Test Replay. Addressed in [#28536](https://github.com/cypress-io/cypress/pull/28536). + +**Dependency Updates:** + +- Updated ts-node from `10.9.1` to `10.9.2`. Cypress will longer error during `cypress run` or `cypress open` when using Typescript 5.3.2+ with `extends` in `tsconfig.json`. Addresses [#28385](https://github.com/cypress-io/cypress/issues/28385). + ## 13.6.1 _Released 12/5/2023_ diff --git a/npm/puppeteer/CHANGELOG.md b/npm/puppeteer/CHANGELOG.md index 540675e4467a..ba968fa59e7a 100644 --- a/npm/puppeteer/CHANGELOG.md +++ b/npm/puppeteer/CHANGELOG.md @@ -1,3 +1,5 @@ +# [@cypress/puppeteer-v0.1.2](https://github.com/cypress-io/cypress/compare/@cypress/puppeteer-v0.1.1...@cypress/puppeteer-v0.1.2) (2023-12-26) + # [@cypress/puppeteer-v0.1.1](https://github.com/cypress-io/cypress/compare/@cypress/puppeteer-v0.1.0...@cypress/puppeteer-v0.1.1) (2023-11-29) diff --git a/npm/puppeteer/package.json b/npm/puppeteer/package.json index 50358f58738a..8c789277725e 100644 --- a/npm/puppeteer/package.json +++ b/npm/puppeteer/package.json @@ -29,7 +29,7 @@ "semantic-release": "19.0.3", "sinon": "^13.0.1", "sinon-chai": "^3.7.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "typescript": "4.7.4" }, "peerDependencies": { diff --git a/npm/vite-dev-server/CHANGELOG.md b/npm/vite-dev-server/CHANGELOG.md index 5a89a1a34ffa..c42533a8ca99 100644 --- a/npm/vite-dev-server/CHANGELOG.md +++ b/npm/vite-dev-server/CHANGELOG.md @@ -1,3 +1,5 @@ +# [@cypress/vite-dev-server-v5.0.7](https://github.com/cypress-io/cypress/compare/@cypress/vite-dev-server-v5.0.6...@cypress/vite-dev-server-v5.0.7) (2023-12-26) + # [@cypress/vite-dev-server-v5.0.6](https://github.com/cypress-io/cypress/compare/@cypress/vite-dev-server-v5.0.5...@cypress/vite-dev-server-v5.0.6) (2023-08-29) diff --git a/npm/vite-dev-server/package.json b/npm/vite-dev-server/package.json index 2988ca3fb0ce..b1c40fb2da10 100644 --- a/npm/vite-dev-server/package.json +++ b/npm/vite-dev-server/package.json @@ -25,7 +25,7 @@ "dedent": "^0.7.0", "mocha": "^9.2.2", "sinon": "^13.0.1", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "vite": "4.3.2", "vite-plugin-inspect": "0.7.24" }, diff --git a/npm/webpack-dev-server/CHANGELOG.md b/npm/webpack-dev-server/CHANGELOG.md index cdb0dca206bb..0e18376bfc4b 100644 --- a/npm/webpack-dev-server/CHANGELOG.md +++ b/npm/webpack-dev-server/CHANGELOG.md @@ -1,3 +1,5 @@ +# [@cypress/webpack-dev-server-v3.7.2](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v3.7.1...@cypress/webpack-dev-server-v3.7.2) (2023-12-26) + # [@cypress/webpack-dev-server-v3.7.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v3.7.0...@cypress/webpack-dev-server-v3.7.1) (2023-11-22) diff --git a/npm/webpack-dev-server/package.json b/npm/webpack-dev-server/package.json index 97312342c377..ef1f143a819e 100644 --- a/npm/webpack-dev-server/package.json +++ b/npm/webpack-dev-server/package.json @@ -39,7 +39,7 @@ "proxyquire": "2.1.3", "sinon": "^13.0.1", "snap-shot-it": "^7.9.6", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "webpack": "npm:webpack@^5", "webpack-4": "npm:webpack@^4", "webpack-dev-server-3": "npm:webpack-dev-server@^3" diff --git a/npm/webpack-preprocessor/CHANGELOG.md b/npm/webpack-preprocessor/CHANGELOG.md index f111d04e8ccf..7075bbb259a9 100644 --- a/npm/webpack-preprocessor/CHANGELOG.md +++ b/npm/webpack-preprocessor/CHANGELOG.md @@ -1,3 +1,5 @@ +# [@cypress/webpack-preprocessor-v6.0.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-preprocessor-v6.0.0...@cypress/webpack-preprocessor-v6.0.1) (2023-12-26) + # [@cypress/webpack-preprocessor-v6.0.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-preprocessor-v5.17.1...@cypress/webpack-preprocessor-v6.0.0) (2023-08-29) diff --git a/npm/webpack-preprocessor/package.json b/npm/webpack-preprocessor/package.json index a23db178cd42..1f37de72738e 100644 --- a/npm/webpack-preprocessor/package.json +++ b/npm/webpack-preprocessor/package.json @@ -46,7 +46,7 @@ "sinon": "^9.0.0", "sinon-chai": "^3.5.0", "snap-shot-it": "7.9.2", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "webpack": "^5.88.2" }, "peerDependencies": { diff --git a/package.json b/package.json index 93e19fa435b0..ce906f8b27ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cypress", - "version": "13.6.1", + "version": "13.6.2", "description": "Cypress is a next generation front end testing tool built for the modern web", "private": true, "scripts": { @@ -207,7 +207,7 @@ "through": "2.3.8", "through2": "^4.0.2", "tree-kill": "1.2.2", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "typescript": "4.7.4", "yarn-deduplicate": "3.1.0" }, diff --git a/packages/driver/package.json b/packages/driver/package.json index cd2aa279f8eb..ca196c19ff95 100644 --- a/packages/driver/package.json +++ b/packages/driver/package.json @@ -19,6 +19,7 @@ "@cypress/webpack-dev-server": "0.0.0-development", "@cypress/webpack-preprocessor": "0.0.0-development", "@cypress/what-is-circular": "1.0.1", + "@medv/finder": "3.1.0", "@packages/config": "0.0.0-development", "@packages/network": "0.0.0-development", "@packages/rewriter": "0.0.0-development", diff --git a/packages/driver/src/cy/snapshots.ts b/packages/driver/src/cy/snapshots.ts index a6dd45f3b399..cde49e02c3dd 100644 --- a/packages/driver/src/cy/snapshots.ts +++ b/packages/driver/src/cy/snapshots.ts @@ -1,13 +1,10 @@ import $ from 'jquery' import _ from 'lodash' -import uniqueSelector from '@cypress/unique-selector' import type { $Cy } from '../cypress/cy' import type { StateFunc } from '../cypress/state' import $dom from '../dom' import { create as createSnapshotsCSS } from './snapshots_css' -import { debug as Debug } from 'debug' - -const debug = Debug('cypress:driver:snapshots') +import { finder } from '@medv/finder' export const HIGHLIGHT_ATTR = 'data-cypress-el' @@ -272,14 +269,9 @@ export const create = ($$: $Cy['$$'], state: StateFunc) => { return [] } - const selector = uniqueSelector(el) - - if (!selector) { - debug('could not find a unique selector for element %o', el) - - return [] - } - + // finder tries to find the shortest unique selector to an element, + // but since we are more concerned with speed, we set the threshold to 1 and maxNumberOfTries to 0 + const selector = finder(el, { root: ownerDoc.body, threshold: 1, maxNumberOfTries: 0 }) const frameId = elWindow['__cypressProtocolMetadata']?.frameId return [{ selector, frameId }] diff --git a/packages/frontend-shared/package.json b/packages/frontend-shared/package.json index b6be8f3cac62..0295d2da54f1 100644 --- a/packages/frontend-shared/package.json +++ b/packages/frontend-shared/package.json @@ -47,7 +47,7 @@ "browser-logos": "github:alrra/browser-logos", "combine-properties": "0.1.0", "cross-env": "6.0.3", - "cypress-axe": "0.14.0", + "cypress-axe": "^1.5.0", "cypress-plugin-tab": "1.0.5", "cypress-real-events": "1.6.0", "dayjs": "^1.9.3", diff --git a/packages/network/lib/uri.ts b/packages/network/lib/uri.ts index 12c5943b5d23..c4be3c4cf652 100644 --- a/packages/network/lib/uri.ts +++ b/packages/network/lib/uri.ts @@ -6,7 +6,7 @@ // - https://nodejs.org/api/url.html#url_url_format_urlobject import _ from 'lodash' -import url, { URL } from 'url' +import url from 'url' // yup, protocol contains a: ':' colon // at the end of it (-______________-) diff --git a/packages/proxy/lib/http/util/prerequests.ts b/packages/proxy/lib/http/util/prerequests.ts index 86b2cd7f9f30..8cb6db9e68aa 100644 --- a/packages/proxy/lib/http/util/prerequests.ts +++ b/packages/proxy/lib/http/util/prerequests.ts @@ -94,6 +94,16 @@ class QueueMap { } } +const tryDecodeURI = (url: string) => { + // decodeURI can throw if the url is malformed + // in this case, we just return the original url + try { + return decodeURI(url) + } catch (e) { + return url + } +} + // This class' purpose is to match up incoming "requests" (requests from the browser received by the http proxy) // with "pre-requests" (events received by our browser extension indicating that the browser is about to make a request). // Because these come from different sources, they can be out of sync, arriving in either order. @@ -148,7 +158,7 @@ export class PreRequests { addPending (browserPreRequest: BrowserPreRequest) { metrics.browserPreRequestsReceived++ - const key = `${browserPreRequest.method}-${decodeURI(browserPreRequest.url)}` + const key = `${browserPreRequest.method}-${tryDecodeURI(browserPreRequest.url)}` const pendingRequest = this.pendingRequests.shift(key) if (pendingRequest) { @@ -193,7 +203,7 @@ export class PreRequests { } addPendingUrlWithoutPreRequest (url: string) { - const key = `GET-${decodeURI(url)}` + const key = `GET-${tryDecodeURI(url)}` const pendingRequest = this.pendingRequests.shift(key) if (pendingRequest) { @@ -236,7 +246,7 @@ export class PreRequests { const proxyRequestReceivedTimestamp = performance.now() + performance.timeOrigin metrics.proxyRequestsReceived++ - const key = `${req.method}-${decodeURI(req.proxiedUrl)}` + const key = `${req.method}-${tryDecodeURI(req.proxiedUrl)}` const pendingPreRequest = this.pendingPreRequests.shift(key) if (pendingPreRequest) { diff --git a/packages/server/package.json b/packages/server/package.json index 13b01eb66903..9d24e57b1b06 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -125,7 +125,7 @@ "tough-cookie": "4.1.3", "trash": "5.2.0", "tree-kill": "1.2.2", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "tslib": "2.3.1", "underscore.string": "3.3.6", "url-parse": "1.5.9", diff --git a/packages/server/test/integration/http_requests_spec.js b/packages/server/test/integration/http_requests_spec.js index a41df8146216..9662d99c2a2c 100644 --- a/packages/server/test/integration/http_requests_spec.js +++ b/packages/server/test/integration/http_requests_spec.js @@ -1230,6 +1230,35 @@ describe('Routes', () => { expect(res.body).to.include('hello from bar!') }) }) + + it('handles malformed URIs', function () { + this.timeout(1500) + + nock(this.server.remoteStates.current().origin) + .get('/?foo=%A4') + .reply(200, 'hello from bar!', { + 'Content-Type': 'text/html', + }) + + const requestPromise = this.rp({ + url: 'http://www.github.com/?foo=%A4', + headers: { + 'Accept-Encoding': 'identity', + }, + }) + + this.networkProxy.addPendingBrowserPreRequest({ + requestId: '1', + method: 'GET', + url: 'http://www.github.com/?foo=%A4', + }) + + return requestPromise.then((res) => { + expect(res.statusCode).to.eq(200) + + expect(res.body).to.include('hello from bar!') + }) + }) }) context('gzip', () => { diff --git a/packages/ts/package.json b/packages/ts/package.json index eb665a3f4c43..6568ded8b4e0 100644 --- a/packages/ts/package.json +++ b/packages/ts/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "debug": "^4.3.4", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "tslib": "2.3.1", "typescript-cached-transpile": "^0.0.6" }, diff --git a/scripts/ensure-node.sh b/scripts/ensure-node.sh index 1e342ce47032..577517880c91 100755 --- a/scripts/ensure-node.sh +++ b/scripts/ensure-node.sh @@ -4,7 +4,7 @@ # The Windows executor ships with nvm-windows 1.1.7, which has compatibility issues with node 16.14.2. # When 1.1.7 is detected, we manually update to nvm-windows 1.1.9, which includes a fix for 16.14.2 support. if [[ $PLATFORM == 'windows' && $(echo `nvm version`) == '1.1.7' ]]; then - curl -L -O https://github.com/coreybutler/nvm-windows/releases/download/1.1.9/nvm-noinstall.zip && tar -xvf nvm-noinstall.zip -C C:/ProgramData/nvm + curl -L -O https://github.com/coreybutler/nvm-windows/releases/download/1.1.11/nvm-noinstall.zip && tar -xvf nvm-noinstall.zip -C C:/ProgramData/nvm fi node_version=$(cat .node-version) diff --git a/scripts/verify-mocha-results.js b/scripts/verify-mocha-results.js index ed6b5810be2e..35be807e5a2d 100644 --- a/scripts/verify-mocha-results.js +++ b/scripts/verify-mocha-results.js @@ -32,7 +32,7 @@ console.log(`Looking for reports in ${REPORTS_PATH}`) // https://circleci.com/blog/keep-environment-variables-private-with-secret-masking/ function isWhitelistedEnv (key, value) { return ['true', 'false', 'TRUE', 'FALSE'].includes(value) - || ['nodejs_version', 'CF_DOMAIN'].includes(key) + || ['nodejs_version', 'CF_DOMAIN', 'SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES'].includes(key) || value.length < 4 } diff --git a/system-tests/__snapshots__/protocol_spec.js b/system-tests/__snapshots__/protocol_spec.js index 6ac6f92bdbed..55525b94f4d1 100644 --- a/system-tests/__snapshots__/protocol_spec.js +++ b/system-tests/__snapshots__/protocol_spec.js @@ -4832,7 +4832,7 @@ exports['e2e events'] = ` "timestamp": "Any.Number", "elementsToHighlight": [ { - "selector": "h1" + "selector": "h1:nth-child(1)" } ] } @@ -4864,7 +4864,7 @@ exports['e2e events'] = ` "timestamp": "Any.Number", "elementsToHighlight": [ { - "selector": "h1" + "selector": "h1:nth-child(1)" } ] }, @@ -4873,7 +4873,7 @@ exports['e2e events'] = ` "timestamp": "Any.Number", "elementsToHighlight": [ { - "selector": "h1" + "selector": "h1:nth-child(1)" } ] } @@ -6303,7 +6303,7 @@ exports['component events - experimentalSingleTabRunMode: true'] = ` "timestamp": "Any.Number", "elementsToHighlight": [ { - "selector": ":nth-child(1) > div" + "selector": "div:nth-child(1) > div:nth-child(1)" } ] } @@ -6334,7 +6334,7 @@ exports['component events - experimentalSingleTabRunMode: true'] = ` "timestamp": "Any.Number", "elementsToHighlight": [ { - "selector": ":nth-child(1) > div" + "selector": "div:nth-child(1) > div:nth-child(1)" } ] } @@ -6587,7 +6587,7 @@ exports['component events - experimentalSingleTabRunMode: true'] = ` "timestamp": "Any.Number", "elementsToHighlight": [ { - "selector": ":nth-child(1) > div" + "selector": "div:nth-child(1) > div:nth-child(1)" } ] } @@ -6618,7 +6618,7 @@ exports['component events - experimentalSingleTabRunMode: true'] = ` "timestamp": "Any.Number", "elementsToHighlight": [ { - "selector": ":nth-child(1) > div" + "selector": "div:nth-child(1) > div:nth-child(1)" } ] } @@ -8050,7 +8050,7 @@ exports['component events - experimentalSingleTabRunMode: false'] = ` "timestamp": "Any.Number", "elementsToHighlight": [ { - "selector": ":nth-child(1) > div" + "selector": "div:nth-child(1) > div:nth-child(1)" } ] } @@ -8081,7 +8081,7 @@ exports['component events - experimentalSingleTabRunMode: false'] = ` "timestamp": "Any.Number", "elementsToHighlight": [ { - "selector": ":nth-child(1) > div" + "selector": "div:nth-child(1) > div:nth-child(1)" } ] } @@ -8334,7 +8334,7 @@ exports['component events - experimentalSingleTabRunMode: false'] = ` "timestamp": "Any.Number", "elementsToHighlight": [ { - "selector": ":nth-child(1) > div" + "selector": "div:nth-child(1) > div:nth-child(1)" } ] } @@ -8365,7 +8365,7 @@ exports['component events - experimentalSingleTabRunMode: false'] = ` "timestamp": "Any.Number", "elementsToHighlight": [ { - "selector": ":nth-child(1) > div" + "selector": "div:nth-child(1) > div:nth-child(1)" } ] } diff --git a/yarn.lock b/yarn.lock index e691cf9810cc..71a84a04a786 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4438,6 +4438,11 @@ lodash "^4.17.15" tmp-promise "^3.0.2" +"@medv/finder@3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@medv/finder/-/finder-3.1.0.tgz#e157c68f166ade9f113a1314603365bf81dd8b8c" + integrity sha512-ojkXjR3K0Zz3jnCR80tqPL+0yvbZk/lEodb6RIVjLz7W8RVA2wrw8ym/CzCpXO9SYVUIKHFUpc7jvf8UKfIM3w== + "@microsoft/fetch-event-source@2.0.1": version "2.0.1" resolved "https://registry.yarnpkg.com/@microsoft/fetch-event-source/-/fetch-event-source-2.0.1.tgz#9ceecc94b49fbaa15666e38ae8587f64acce007d" @@ -12050,10 +12055,10 @@ cyclist@^1.0.1: resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk= -cypress-axe@0.14.0: - version "0.14.0" - resolved "https://registry.yarnpkg.com/cypress-axe/-/cypress-axe-0.14.0.tgz#5f5e70fb36b8cb3ba73a8ba01e9262ff1268d5e2" - integrity sha512-7Rdjnko0MjggCmndc1wECAkvQBIhuy+DRtjF7bd5YPZRFvubfMNvrxfqD8PWQmxm7MZE0ffS4Xr43V6ZmvLopg== +cypress-axe@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/cypress-axe/-/cypress-axe-1.5.0.tgz#95082734583da77b51ce9b7784e14a442016c7a1" + integrity sha512-Hy/owCjfj+25KMsecvDgo4fC/781ccL+e8p+UUYoadGVM2ogZF9XIKbiM6KI8Y3cEaSreymdD6ZzccbI2bY0lQ== cypress-each@^1.11.0: version "1.11.0" @@ -28604,10 +28609,10 @@ ts-log@^2.2.3: resolved "https://registry.yarnpkg.com/ts-log/-/ts-log-2.2.3.tgz#4da5640fe25a9fb52642cd32391c886721318efb" integrity sha512-XvB+OdKSJ708Dmf9ore4Uf/q62AYDTzFcAdxc8KNML1mmAWywRFVt/dn1KYJH8Agt5UJNujfM3znU5PxgAzA2w== -ts-node@^10.9.1: - version "10.9.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" - integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== +ts-node@^10.9.2: + version "10.9.2" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" + integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== dependencies: "@cspotcode/source-map-support" "^0.8.0" "@tsconfig/node10" "^1.0.7"