Released 11/23/2020
Summary:
Cypress now offers full network stubbing support with the introduction of the cy.intercept()
command (previously cy.route2()
). With cy.intercept()
your tests can intercept, modify and wait on any type of HTTP request originating from your app.
Breaking Changes:
Please read our Migration Guide which explains the changes in more detail and how to change your code to migrate to Cypress 6.0.
- Cypress now always throws an error when asserting on an element that doesn't exist in the DOM (unless you're asserting that the element should
not.exist
). Assertions such asnot.visible
,not.contains
,not.have.class
, etc will now fail when used on non-existent DOM elements. Addresses #205. - DOM elements where the CSS style (or ancestors) are
opacity: 0
are no longer considered visible. However these are still considered actionable and "any action commands" interacting-with-elements#Actionability used to interact with the element will perform the action. This matches browser's implementation on how they regard elements withopacity: 0
. Addresses #4474. - The type yielded by
cy.wait(alias)
has changed in order to support use ofcy.intercept()
. Addressed in #9266. - The
experimentalNetworkStubbing
option has been removed and made the default behavior. You can safely removed this configuration option. Addressed in #9185. - When using
.type()
and.click()
on elements inside acontenteditable
element, the events are now properly triggered on the inside elements. This may cause unintended consequences if you were relying on the previous behavior. Addressed in #9066. - We removed several deprecation errors around APIs that were removed in versions of Cypress prior to 4.0.0. This will not cause any changes for anyone upgrading from a 4.0+ version of Cypress. For a full list of all APIs affected see #8946.
- We updated our HTTP status codes and reason phrases to match Node.js
http.STATUS_CODES
. If you have code that relies on a reason phrase, then this could affect you. Addressed in #8969. - JSON request and response bodies captured by
cy.intercept()
are now automatically parsed, removing the need to manually doJSON.parse
. Addressed in #9280.
Deprecations:
Deprecations still work as before but will be removed from Cypress in a future release. We encourage you to update your code now to remove uses of deprecations.
cy.server()
andcy.route()
have been deprecated. In a future release, support forcy.server()
andcy.route()
will be moved to a plugin. We encourage you to usecy.intercept()
instead. Addressed in #9185.experimentalFetchPolyfill
has been deprecated. We encourage you to usecy.intercept()
to intercept requests using the Fetch API instead.cy.route2()
was renamed tocy.intercept()
. We encourage you to update usages ofcy.route2()
to usecy.intercept()
. Addressed in #9182.
Features:
- The new
cy.intercept()
command can be used to manage the behavior of HTTP requests at the network layer. Addressed in #9182. - We now pass
—disable-dev-shm-usage
to the Chrome browser flags by default. This will write shared memory files into/tmp
instead of/dev/shm
. If you're passing this flag in yourplugins
file, you can now remove this code. Addresses #5336. - A warning is now displayed when passing invalid configuration keys through the CLI. Addresses #428.
- The
cypress version
command now also displays the current Electron and bundled Node versions. Addresses #9180. - The
cypress version
command now accepts a--component
flag that allows you to print the version of specific components of Cypress. ie Electron, Node, etc. Addresses #9214.
Bugfixes:
- We fixed a regression introduced in 3.5.0 that would cause
.type()
to not type the entire string when focus was called away from the target element. Fixes #9254. .type()
and.click()
now properly work on elements inside acontenteditable
element. Fixes #2717 and #7721.- We fixed a regression introduced in 5.6.0 that would cause the Test Runner to crashes and display a white page when switching tabs while tests are running. Fixes #9151.
- Fixed an issue where
Content-Length
forcy.route2
request bodies could be incorrectly recalculated. Fixes #9166.
Documentation Changes:
- Our Migration Guide has a new section for 6.0 migration.
- Many of our docs examples have been updated to use
cy.intercept()
in place ofcy.route()
including our Network Requests doc.
Misc:
- Added the type of
redirects
and changedredirectedToUrl
optional for Response types. Addresses #9275.
Dependency Updates