freeCodeCamp.org on YouTube · Open on YouTube
Professional practice · Competent · Lesson 33 of 98 · 1 h 4 min video, then about 5 hours of practice
End-to-end testing with Playwright
After this you can write browser tests that exercise the main user flows of your app and run them in CI.
Why it matters
End-to-end tests drive a real browser through your real app. They are slower and more brittle than unit tests, so write few of them, for the flows that would be embarrassing to break: sign up, the main create-and-view loop, and anything involving payment or permissions. Use role-based locators (`getByRole`) rather than CSS selectors, and never use fixed sleeps. Trap: trying to test everything end to end. Push detail down to unit tests.
How to use this resource
Current and practical, including how AI agents fit into testing workflows.
Go further
Go deeper