-
Notifications
You must be signed in to change notification settings - Fork 831
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
[RFC] Rewrite all the tests with testing-library #1933
Comments
For tests that don't replay any user interaction I'd always suggest testing-library in a browser. It's reliable and faster if you have many tests (browser requires bundling which takes time but a browser is faster runs each test faster. There's a breakpoint when faster tests outweigh the upfront cost of bundling). If you don't have many tests and don't have an issue with diving deep into DOM specs, browser quirks and JSDOM then use JSDOM. To test user interactions there's no silver-bullet that I know of to decide when to run automated e2e test or stick testing-library and dispatching events manually. To me it comes down to past experiences: does the test break on unrelated changes? Do you still encounter bugs for that scenario even though you have written tests? What is the better debugging experience? etc. So I would trust pickers maintainers to make that judgement. |
After internal discussion, we will apply this strategy: We will use testing-library exclusively for all future pull requests. This will allows us to better assess the quality of this solution. After a couple of weeks, if we don't find any blocker, we will then migrate all the tests. Hopefully, this will allow Material-UI to simplify its stack (fewer tools). |
Done in https://next.material-ui.com/components/pickers. However, we had to skip ~50% of the tests as they are unreliable, fail in Safari, fail depending on the time of the day, etc. We will keep polishing them. It could be coming from flaws in the logic of the components or in how the tests are written. We have seen both so far. |
This is a follow-up on the discussion we have started in #1730 (comment) between @eps1lon, @dmtrKovalenko, and @oliviertassinari.
The arguments in favor we have explored so far:
The concerns against we have explored so far:
.only
or a filter.debug()
utils, 3. Assertion playground http://testing-playground.com/. In the event, it's not enough, I copy and paste the test case and run it in the documentation, to see how it behaves. Now, there is definitely a concern around getting used to the tooling, it takes time, which echos back to the value of point 3. and why it's important to share it between all the components.I believe the conclusion is that we should migrate all the tests to testing-library until we hit a roadblock
The text was updated successfully, but these errors were encountered: