-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v10.4.0 Component test React 18 warnings with mid sized apps #23169
Comments
possibly fixed by #23182? |
Yes, changing the import in // From
import {mount} from 'cypress/react'
// To
import {mount} from 'cypress/react18' Will clear the warnings, but there is currently an open issue for React 18 support. |
It will be fixed in the next release. |
This works. I upgraded React to v18 and Cypress to 10.4.0, and added the new React 18 hooks. But, headless local or CI execution is so slow that CI times out, and local is dreadful. There has to be something not right. Please make sure to try this in a large repo. You can reproduce through this PR muratkeremozcan/cypress-react-component-test-examples#280. Just toggle git clone https://github.com/muratkeremozcan/cypress-react-component-test-examples.git
yarn
yarn cy:run-ct The React 18 unmount issue is reproducible too, but that can be worked around with separate tests & files. The headless execution speed issue is the real blocker. |
Headless (well "run mode" where you run all specs) execution for Component Testing will improve significantly (up to ~50% on large code bases, improvement linear based on # of specs) with an experimental flag that is landing soon. FYI: You can also pass As for the experimental feature:
I will try the experimental flag on your code base now. You can even try it by installing one of these pre-release binaries: 293a0f4#comments. You need to enable the experiment. Example. Edit: wow this code base is taking forever to run! I'll get you some before/after numbers with the experimental flag. Give me a moment. export default defineConfig({
component: {
experimentalSingleTabRunMode: true // <= this is the flag to enable the single tab run mode
}
}) React 18 should be 💯 once the bug fix it out. |
Finishing running your project before/after: 205 specs Final numbers (run on my Macbook arm64)
Wow, unreal. I've tested other webpack repos which saw improvements around 2x. I am not sure what's going on with your project but this is definitely not the expected performance. Other projects I've tested and used running with CRA + webpack don't exhibit anything near the slowness you are experiencing. Either way, the |
Thanks a ton for giving it a try. On main, with React 17, the local run time is about 12 mins. In CI it is all right, under 4 mins with parallelization https://dashboard.cypress.io/projects/62pyqm/runs/933/specs. If the experimental feature fixes the issue occurence with React 18, and increases the speed 2-3 times, works for me. |
Great, I hope we can ship the experimental flag with 10.5. If it goes smoothly, we can make this the default in the future. 🤞 Keep your eyes on #23104 - just waiting for a few internal reviews. |
I tried If it works in this repo, it should work in most production apps. muratkeremozcan/cypress-react-component-test-examples#297 Edit: When I ran out of parallelization and had to run all the tests in one machine, tests that had to do with hovering using Kovalenko's plugin |
Hmm that's odd, I wonder why the CDP real-events are failing 🤔 Glad the experiment is helping - if it goes well over the next few weeks and no-one reports any bugs, it may become the default. Just to clarify - are you saying the real-events library is more flaky when using the single tab experiment? |
Current behavior
In a simple repo, like a fresh CRA, or small a-la-carte components as in 330+ cypress-react-component-test-examples v10.4.0 works as intented; there are no React 18 warnings in the console.
In mid sized or larger apps the React 18 console warnings may still persist.
Here are 2 apps where the issue is observed. Install and run any component test and view the console.
Repo 1: Kent Dodds' Epic React final app, with Cypress e2e and component tests:
git clone https://github.com/muratkeremozcan/bookshelf.git cd bookshelf npm i npm run cy:open-ct
Repo 2: React Hooks in Action book with Cypress e2e and component tests
Desired behavior
Regardless of the app size, there are no React 18 console warnings and we can use new React hooks in the tests.
Test code to reproduce
Linked above.
Cypress Version
10.4.0
Other
No response
The text was updated successfully, but these errors were encountered: