v16.2.0
Added 3
- Added the cy.getByRole() query, which finds elements by their ARIA role and optionally their accessible name, skipping elements hidden from the accessibility tree unless { hidden: true } is passed
- cy.getByRole() matches only native HTML elements for a role by default, and accepts { native: false } to also match elements with a role attribute
- cy.getByRole() yields every match and retries until its assertions pass, and its error lists the roles and accessible names on the page when nothing matches
Changed 5
- cy.go() now waits for the page to load, yields the window, and fails if the page does not load within the timeout behavior changed · inferred, marked in the notes below
- cy.get() now fails immediately when index 0 of a cy.intercept() alias is requested, such as cy.get('@getUsers.0'), instead of retrying until timeout
- Calling a subject-requiring query such as .eq(), .first(), .find(), or .shadow() directly off cy now fails immediately with an error naming the command and stating it must be chained
- Child commands called directly off cy, such as cy.click(), now show the same reworded error about needing to be chained
- TypeScript now types the object yielded by cy.location() as the plain object Cypress yields rather than window.location, and types searchParams signature changed · inferred, marked in the notes below
Fixed 10
- Fixed a regression in 16.0.0 where configured clientCertificates were not presented for requests issued in Chrome, Chromium, and Edge, causing mutual TLS origins to show a certificate prompt or hang
- Fixed a regression in 15.20.0 where a cookie changed by cy.request() or cy.setCookie() was sent with its earlier value on the next navigation of the application under test
- Fixed a regression in 15.0.0 where cy.go() finished before the navigated page loaded, causing intermittent failures in tests that went back or forward
- Fixed a regression in 15.0.0 where cy.go() yielded undefined instead of the window and ignored its timeout option and pageLoadTimeout
- Fixed a regression in 15.0.0 where stderr output from the config file could intermittently be missing from cypress run terminal output
- Fixed chapter markers in videos recorded during cypress run being placed later than the tests they label when the browser was slow to show its first frame, and videos reporting a longer length than their footage
- Fixed errors whose message cannot be overwritten, such as cross-origin or CSP DOMExceptions, being reported as a TypeError about a getter-only property instead of the actual error
- Fixed an issue where, after one request missed its browser pre-request, every later request with the same method and URL waited the full 2 second pre-request timeout
- Fixed an issue where cy.prompt and Studio could fail to load
- Fixed cypress run changing the browser that cypress open selects by default for a project to whichever browser the run used
Security 1
- Masked environment variable values on the Project settings page
2 changes to check, marked in the notes below
From Cypress
Features:
- Added the
cy.getByRole()query, which finds elements by their ARIA role and, optionally, their accessible name, for examplecy.getByRole('tab', { name: 'Billing' }). Elements hidden from the accessibility tree are skipped unless you pass{ hidden: true }. For a role that HTML has an element for, only that element matches by default, socy.getByRole('button')finds a<button>but not a<div role="button">. Pass{ native: false }to also match elements with aroleattribute. Likecy.get(), it yields every match and retries until its assertions pass. When nothing matches, the error lists the roles and accessible names on the page. Addressed in #34937.
Bugfixes:
- Fixed a regression in 16.0.0 where a configured
clientCertificatesentry was not presented for requests the browser issued in Chrome, Chromium, and Edge, so an origin requiring mutual TLS showed a certificate prompt incypress openand hung incypress run. Fixes #34807. - Fixed a regression in 15.20.0 where a cookie changed by
cy.request()orcy.setCookie()was sent to the server with its earlier value on the next navigation of the application under test, even thoughcy.getCookie()reported the new one. Fixes #34891. - Fixed a regression in 15.0.0 where
cy.go()finished before the page it navigated to had loaded. The next command could run against the page being navigated away from, so tests that went back or forward could fail intermittently.cy.go()also yieldedundefinedinstead of the window, and ignored itstimeoutoption andpageLoadTimeout.cy.go()now waits for the page to load, yields the window, and fails if the page does not load within the timeout. Fixes #32460. behavior changed · inferred - Fixed a regression in 15.0.0 where output written to stderr from your config file, such as
console.error()insetupNodeEvents, could intermittently be missing from the terminal output ofcypress runwhen written right after another line. Fixed in #35022. cy.get()now fails right away when you ask for index0of acy.intercept()alias, such ascy.get('@getUsers.0'). Previously, Cypress retried until the command timed out before it showed the error, even though retrying could never succeed. Fixed in #34936.- Fixed an issue where chapter markers in videos recorded during
cypress runin Chrome-based browsers, Electron, and Firefox were placed later than the tests they label when the browser was slow to show its first frame. In that case the video could also report a longer length than its footage and show a frozen final frame. Fixed in #35018. - Fixed an issue where an error whose
messagecannot be overwritten — such as theDOMExceptiona browser throws for a cross-origin access or a Content Security Policy violation — was reported asTypeError: setting getter-only property "message"from inside Cypress, hiding the error that actually failed the test. Fixes #34818. - Fixed an issue where, after one request missed its browser pre-request, every later request with the same method and URL waited the full 2 second pre-request timeout for the rest of the spec. Fixes #34966.
- Fixed an issue where
cy.promptand Studio could fail to load. Fixed in #35013. - Calling a query that needs a subject, such as
.eq(),.first(),.find(), or.shadow(), directly offcyinstead of chaining it off a command that yields a subject now fails right away with an error that names the command and explains that it must be chained. Previously, Cypress retried until the command timed out and then reported that the subject was not a DOM element, or, when the query was the first command in a test, failed withCannot read properties of undefined (reading 'get'). Child commands called directly offcy, such ascy.click(), show the same reworded error. Fixed in #35024. - Fixed an issue where
cypress runchanged the browser thatcypress openselects by default for a project to whichever browser the run used, such as the one passed with--browser. Fixed in #34924.
Misc:
- TypeScript now types the object yielded by
cy.location()as the plain object Cypress actually yields, instead of the browser'swindow.location.searchParamsis now typed, socy.location('searchParams')andloc.searchParams.get('q')no longer report a type error. Addressed in #34956. signature changed · inferred - Masked the environment variable values on the Project settings page. Addressed in #35004.
Dependency Updates:
- Upgraded
shell-quotefrom1.10.0to1.11.0to address a Command Injection vulnerability reported in security scans.shell-quoteis a transitive dependency oflaunch-editor. Addressed in #34960. - Upgraded
simple-gitfrom3.36.0to4.0.2to address a Command Injection vulnerability and two Arbitrary Command Injection vulnerabilities (SNYK-JS-SIMPLEGIT-20335524, SNYK-JS-SIMPLEGIT-20335540) reported in security scans. This also upgrades its@simple-git/argv-parserdependency from1.1.1to2.0.1, which addresses a Command Injection vulnerability reported in security scans. Addressed in #34960.