I use @playwrightweb or @Cypress_io to write 2 types of tests: 1


I use @playwrightweb or @Cypress_io to write 2 types of tests:

1. End-to-end tests
Goal: Load each page to assure the app works against the real APIs. Don't assert specific data. Be deliberately high-level. Think "smoke test".

2. Integration tests
Goal: Assure each feature works as expected and displays the right data in the right spot. Run the app against mock APIs via msw so it's reliable and fast. These tests are thorough and specific.
This distinction is important, because end-to-end tests are inherently brittle and slow. Why? Because they rely upon shared mutable state: A database.

So I prefer to focus on integration tests that mock the API. They run much faster, and are 100% reliable.

View original on X