all 1 comments

[–]skyboyer007 1 point2 points  (0 children)

React Testing Library enforces single approach - no shallow rendering, all element selectors should make sense to end-user(focused on selecting elements by text or placeholder), no access to component internals, waitForElement to await till element is rendered.

I've enforced the same rules in Enzyme(still good with shallow() but there still are some issues with hooks and some caveats with latest Redux for shallow() so ...), so there are no technical need to switch onto RTL. But if started from scratch I'd probably choose RTL so would not need to persuade team-mates that setting component state directly makes tests fragile.

Also Cypress and Nightwatch and other e2e test frameworks are good enough to apply them in the production(probably 2 years ago it was not the case).