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
- Fixed a regression from 16.1.0 where the Cypress browser extension could stop responding for the rest of a headed run in Chrome, Chromium, and Edge, causing @cypress/puppeteer to fail with Cannot communicate with the Cypress Chrome extension
- rightclick() no longer sends buttons: 2 on its pointerup and mouseup events, matching the buttons value a real right click reports on release
- trigger() now fails when passed an empty string as the event name, and related error messages show empty strings as '' and display the passed value instead of the literal text {{cmd}}
- Runs recorded to Cypress Cloud with Test Replay enabled now report the hooks that run around each test, so unchanged tests are no longer wrongly listed as Modified when a run switches between browsers that do and do not support Test Replay
Security 2
- cy.fixture() and the fixture property of cy.intercept() static responses now fail when the fixture path resolves outside the fixturesFolder behavior changed · inferred, marked in the notes below
- Node code in the config process, including setupNodeEvents, cy.task() handlers, and the plugins they load, now verifies TLS certificates the same way Node does behavior changed · inferred, marked in the notes below
3 changes to check, marked in the notes below
From Cypress
Performance:
- Tests that run with
testIsolationenabled now start slightly faster when the previous test did not load any pages, such as an API test that only usescy.request(). Fixed in #35089.
Bugfixes:
cy.contains()now works insidecy.document().within(). Missing content reports an assertion error instead ofTypeError: subject.each is not a function. Fixes #24178.- Responses compressed with
Content-Encoding: x-gzipare 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 passedencoding: false,0, or an empty string, instead of crashing Cypress withTypeError [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.pageLoadTimeoutnever fired, socypress runhad to be killed. SettingforceHttp1totrueis no longer needed to avoid it. Fixes #34794. - Fixed an issue where
cypress openwith both a--browserand 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 asbottom,right,bottomRight, and'100%'landed short by the width of the scrollbar, andcenteror'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/puppeteerto fail withCannot communicate with the Cypress Chrome extension. Fixed in #34958. cy.fixture()and thefixtureproperty of acy.intercept()static response now fail when the fixture path resolves outside thefixturesFolder. Fixed in #35072. behavior changed · inferred- Fixed an issue where
.rightclick()sentbuttons: 2on itspointerupandmouseupevents. A real right click reportsbuttons: 0on these events because the right button has just been released, so code that checksevent.buttonson 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 ascy.get('button').trigger(''). Previously, it dispatched an event whosetypewas 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 fromcy.readFile()andcy.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 withTypeError: Cannot read properties of undefined (reading 'selector'). The same error replaced the usualExpected to find contentmessage whency.contains()searched a page that has no<body>. Fixes #34994.- Fixed an issue where several
cypress runprocesses 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 whentrashAssetsBeforeRunsisfalse. Screenshots taken with theoverwriteoption, and videos whentrashAssetsBeforeRunsistrue, 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: Forbiddenor 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 advertiseshttp/1.1. Origins that serve both protocols are unaffected. Where such an origin previously answered with a403,cy.request()withfailOnStatusCode: falseyielded a response object and now reports a network error instead. Fixed in #34951. behavior changed · inferred - Fixed an issue where
cypress runcould 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.dommethods 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(), andgetFirstFixedOrStickyPositionParent(). Previously, passing the other form threw aTypeErroror returned a wrong result, such asisFocused()returningfalsefor a focused element. Fixed in #35155.
Misc:
- The
before:runevent'sdetails.configis now typed as the resolved plugin configuration, so TypeScript can access fields such asprojectRoot,configFile,testingType, andbrowserswithout a cast. Addresses #30420. Addressed in #35134. - The TypeScript types now accept a number as the expected value of the
attr,id,text, andvalueassertions, including thecontainandincludeforms oftextandvalue, such asexpect($el).to.have.attr('tabindex', 0)orexpect($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
matchassertion, such asexpect($el).to.match($other)orexpect($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
nullas the expected value of thedataassertion, such asexpect($el).to.have.data('count', 3). jQuery parses numeric, boolean, andnulldata-*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 ofnull. Cypress already yielded the status at runtime, so code that uses it as a string, such ascy.session('user', setup).then((status) => status.toUpperCase()), no longer reports a type error. Addressed in #35057. - The TypeScript documentation for the
validateoption ofcy.session()now lists the conditions that make a session invalid. It previously said that returningfalseinvalidates the session, but afalsereturn only does so when it comes from a Promise, or whenvalidatereturns nothing and its last Cypress command yieldsfalse. It also no longer shows a default offalse, becausevalidatehas no default. Addressed in #35057. …