Test React code the way a user experiences it. Component tests render a component and interact with it through visible text, roles and labels. React Testing Library is the standard tool for this, usually run with Vitest or Jest. End-to-end tests drive a real browser through whole user journeys with a tool such as Playwright.
A sensible mix is many fast tests for logic and components, and a smaller number of end-to-end tests for critical flows such as sign-up and checkout. Async Server Components are generally easier to cover with end-to-end tests than with unit tests.



