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

Expose React Root on cypress/react test harness for Cypress 14 #30622

Open AtofStryker opened 6 days ago

AtofStryker commented 6 days ago

What would you like?

cypress/react with Cypress 14 should support returning the root created by ReactDom.createRoot in the case users wish to call an unmount.

Why is this needed?

Since cypress/react supports React 18 (and up) with Cypress 14 and ReactDom.unmountComponentAtNode is deprecated in React 18 and removed in React 19, Cypress should return the root created from ReactDom.createRoot in the case users want to call an unmount. This can no longer be done strictly with getContainerEl()

Other

We likely need to hang onto getContainerEl() for a bit longer as users may not have migrated away from it, but we should deprecate this method in addition to this work as it will likely be removed once we fully support react 19 only