cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.09k stars 3.19k forks source link

breaking: remove support for React 16 and 17 for Cypress Component Testing. Additionally, remove the `cypress/react18` testing harness and merge it upstream with `cypress/react` #30590

Closed AtofStryker closed 6 days ago

AtofStryker commented 1 week ago

Additional details

Updates cypress/react to be the cypress/react18 test harness and removes support for react 16 and 17 for component testing. Since the cypress/react18 test harness is merged upstream into cypress/react, the cypress/react18 harness is no longer shipped with the binary and the cypress/react18 package will be deprecated when we release cypress 14 (a part of the release checklist)

most of the system test updates to react 18 happened in #30614 to make this PR smaller. The only changes here should be to reference the merged upstream harness, cypress/react

Steps to test

How has the user experience changed?

Test examples in the react test harness have been updated to use functional components and hooks (except 1 until react class components are completely removed)

You can also test migration via the binary https://github.com/cypress-io/cypress/commit/34043f99d989800c14f340b71f12d9d245d29a0c

Updating cypress/react18 to cypress/react resolves the issue

Screenshot 2024-11-15 at 9 45 58 AM

When starting Component testing with the new cypress/react harness, an error throughs that react-dom/client cannot be found

Screenshot 2024-11-15 at 9 55 37 AM

downloading @cypress/react@8 and changing the mount function from cypress/react to @cypress/react allows the tests to run

Screenshot 2024-11-15 at 9 56 05 AM

PR Tasks

cypress[bot] commented 1 week ago

cypress    Run #58448

Run Properties:  status check passed Passed #58448  •  git commit 90da84a3b5: update tests / suggestions from code review [run ci]
Project cypress
Branch Review breaking/remove_react_16_17_merge_react18_harness_upstream
Run status status check passed Passed #58448
Run duration 16m 59s
Commit git commit 90da84a3b5: update tests / suggestions from code review [run ci]
Committer AtofStryker
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 28
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 764
View all changes introduced in this branch ↗︎
UI Coverage  66.27%
  Untested elements 26  
  Tested elements 55  
Accessibility  96.21%
  Failed rules  0 critical   4 serious   1 moderate   0 minor
  Failed elements 199