So, react-testing-library
is used for unit/integration testing, and cypress
is used for e2e testing. However, both appear to do the same thing:
react-testing-library
- Facilitates mocking
- Tests as a user would
- Starts with the top-level component (not a hard and fast requirement, but if you don't you end up with a bunch of duplicate test cases in your sub-component testing)
- Instant feedback, fast
cypress
- Facilitates mocking
- Tests as a user would
- Starts with the top-level component (the page)
- Delayed feedback, slow, but provides extra tooling (video proof, stepping through tests, etc.)
Aside from the feedback cycle, they appear to be almost identical. Can somebody clarify what the differences are? Why would you want to use both?