Cypress v16.2.1

v16.2.1
Changed 2
  • Tests with testIsolation enabled start slightly faster when the previous test did not load any pages, such as an API test that only uses cy.request() behavior changed · inferred, marked in the notes below
  • When the component testing dev server fails to start, Cypress now explains that the dev server could not start, shows the dev server's error, and links to the dev server documentation instead of reporting a config file crash or showing no explanation
Fixed 10
  • cy.contains() now works inside cy.document().within(), and missing content reports an assertion error instead of TypeError: subject.each is not a function
  • Responses compressed with Content-Encoding: x-gzip are now decoded correctly when Cypress's HTTP proxy rewrites their contents, preventing compressed pages from being corrupted during script injection
  • cy.request() now fails with an invalid encoding error when passed encoding: false, 0, or an empty string, instead of crashing Cypress
  • Fixed a regression from 16.0.0 where in Chrome, Chromium, and Edge a spec hung forever at its first cy.visit() to another origin when its bundled file was larger than about 75 MB; forceHttp1 no longer needs to be set to true to avoid it
  • cypress open with both a --browser and a testing type flag no longer launches the browser twice the first time the major-version welcome screen is shown
  • scrollTo() and scrollIntoView() now reach the true end of scrollable elements with always-visible scrollbars, instead of stopping short by the scrollbar width
Security 2

3 changes to check, marked in the notes below

From Cypress

Performance:

  • Tests that run with testIsolation enabled now start slightly faster when the previous test did not load any pages, such as an API test that only uses cy.request(). Fixed in #35089.

Bugfixes:

  • cy.contains() now works inside cy.document().within(). Missing content reports an assertion error instead of TypeError: subject.each is not a function. Fixes #24178.
  • Responses compressed with Content-Encoding: x-gzip are now decoded correctly when Cypress's HTTP proxy rewrites their contents, preventing compressed pages from becoming corrupted during script injection. Fixes #34387.
  • cy.request() now fails with an invalid encoding error when passed encoding: false, 0, or an empty string, instead of crashing Cypress with TypeError [ERR_UNKNOWN_ENCODING]: Unknown encoding: false. Fixes #24192.
  • Fixed a regression in 16.0.0 where, in Chrome, Chromium, and Edge, a spec hung forever at its first cy.visit() to another origin when its bundled file was larger than about 75 MB, which a spec can reach by importing tens of megabytes of generated code. pageLoadTimeout never fired, so cypress run had to be killed. Setting forceHttp1 to true is no longer needed to avoid it. Fixes #34794.
  • Fixed an issue where cypress open with both a --browser and a testing type flag launched the browser twice the first time Cypress showed its major-version welcome screen — on first open after upgrading, or after clearing app data. Fixes #34868.
  • Fixed an issue where .scrollTo() and .scrollIntoView() stopped short of the end of a scrollable element with always-visible scrollbars. Positions such as bottom, right, bottomRight, and '100%' landed short by the width of the scrollbar, and center or '50%' landed off-center by half of it. Fixed in #34948.
  • Fixed a regression in 16.1.0 where, in Chrome, Chromium, and Edge run headed, the Cypress browser extension could stop responding for the rest of the run. This caused @cypress/puppeteer to fail with Cannot communicate with the Cypress Chrome extension. Fixed in #34958.
  • cy.fixture() and the fixture property of a cy.intercept() static response now fail when the fixture path resolves outside the fixturesFolder. Fixed in #35072. behavior changed · inferred
  • Fixed an issue where .rightclick() sent buttons: 2 on its pointerup and mouseup events. A real right click reports buttons: 0 on these events because the right button has just been released, so code that checks event.buttons on release now sees the same value it does in a browser. Fixed in #35042.
  • When the dev server for component testing fails to start, such as when your project installs a version of webpack or webpack-dev-server that Cypress does not support, Cypress now explains that the dev server could not start, shows the dev server's error, and links to the dev server documentation. Previously, webpack errors were reported as a crash of your config file, and other dev server errors were shown with no explanation. Fixed in #35081.
  • .trigger() now fails when passed an empty string as the event name, such as cy.get('button').trigger(''). Previously, it dispatched an event whose type was an empty string instead of failing, even though its error message says the event name must be a non-empty string. That error now shows the value that was passed, instead of the literal text {{cmd}}. It and the matching errors from cy.readFile() and cy.writeFile() now show an empty string as '', instead of leaving the value blank. Fixed in #35068.
  • Node code in the config process, such as setupNodeEvents, cy.task() handlers, and the plugins they load, now verifies TLS certificates the same way Node does. Fixed in #35093 and #35118. behavior changed · inferred
  • Fixed an issue where runs recorded to Cypress Cloud with Test Replay enabled did not report the hooks that run around each test. Tests whose code had not changed were then listed as Modified under Tests for review whenever a run switched between a browser that supports Test Replay and one that does not, such as from Electron to Firefox. Because hooks are now reported for these runs, tests in projects that record with Test Replay may be listed as Modified once, in the first run after upgrading. Fixes #35070.
  • Fixed a regression in 16.0.0 where a run whose tests all passed could exit with code 1 and print ServerBase#open must first be called before accessing 'this.null' if the browser made a request while Cypress was shutting down. Fixed in #34977.
  • cy.contains() now keeps retrying when it runs inside .within() and the element passed to .within() is briefly missing from the page, such as while a list re-renders. Previously, it failed right away with TypeError: Cannot read properties of undefined (reading 'selector'). The same error replaced the usual Expected to find content message when cy.contains() searched a page that has no <body>. Fixes #34994.
  • Fixed an issue where several cypress run processes sharing a project folder could save a screenshot under the same file name, so one silently overwrote the other and both runs reported the same file. Each screenshot now gets its own file, numbered (1), (2), and so on, as it already did within a single run. The same applies to videos when trashAssetsBeforeRuns is false. Screenshots taken with the overwrite option, and videos when trashAssetsBeforeRuns is true, still replace the existing file. Fixed in #34928.
  • Requests to an origin that serves only HTTP/2 now fail immediately at the TLS handshake instead of returning a misleading 403: Forbidden or hanging until they time out. Cypress advertised no protocol over ALPN when opening a TLS connection, leaving such an origin nothing to negotiate against; it now advertises http/1.1. Origins that serve both protocols are unaffected. Where such an origin previously answered with a 403, cy.request() with failOnStatusCode: false yielded a response object and now reports a network error instead. Fixed in #34951. behavior changed · inferred
  • Fixed an issue where cypress run could stop printing output and never finish when a test was retried after one of its hooks timed out on the previous attempt. Fixed in #34997.
  • These Cypress.dom methods now accept either a DOM element or a jQuery object, as their types already said: isFocused(), isScrollable(), isFocusable(), isDescendent(), getReasonIsHidden(), isTextLike(), isSelector(), getWindowByElement(), getFirstScrollableParent(), getFirstStickyPositionParent(), and getFirstFixedOrStickyPositionParent(). Previously, passing the other form threw a TypeError or returned a wrong result, such as isFocused() returning false for a focused element. Fixed in #35155.

Misc:

  • The before:run event's details.config is now typed as the resolved plugin configuration, so TypeScript can access fields such as projectRoot, configFile, testingType, and browsers without a cast. Addresses #30420. Addressed in #35134.
  • The TypeScript types now accept a number as the expected value of the attr, id, text, and value assertions, including the contain and include forms of text and value, such as expect($el).to.have.attr('tabindex', 0) or expect($el).to.have.text(123). Cypress already accepted numbers for these assertions at runtime, but TypeScript reported an error. Addresses #7314.
  • The TypeScript types now accept a DOM element, an array of elements, a jQuery object, or a predicate function in the match assertion, such as expect($el).to.match($other) or expect($el).to.match((index, el) => el.id === 'result'). Cypress already supported these at runtime, but TypeScript reported an error. Addressed in #35051.
  • The TypeScript types now accept a number, boolean, or null as the expected value of the data assertion, such as expect($el).to.have.data('count', 3). jQuery parses numeric, boolean, and null data-* attributes into those types, so a string could never match them, but TypeScript accepted only a string. Addressed in #35051.
  • TypeScript now types the value yielded by cy.session() as the session's status, 'created', 'restored', or 'recreated', instead of null. Cypress already yielded the status at runtime, so code that uses it as a string, such as cy.session('user', setup).then((status) => status.toUpperCase()), no longer reports a type error. Addressed in #35057.
  • The TypeScript documentation for the validate option of cy.session() now lists the conditions that make a session invalid. It previously said that returning false invalidates the session, but a false return only does so when it comes from a Promise, or when validate returns nothing and its last Cypress command yields false. It also no longer shows a default of false, because validate has no default. Addressed in #35057. …
View original

Upgraded? How did it go?

Discussion