Good tests let you change code without fear; bad tests break on every refactor and still miss real bugs. This course teaches a practical testing strategy for modern frontends: fast unit tests with Vitest, component tests that behave like a user with Testing Library, and end-to-end tests in real browsers with Playwright. You will learn what to test, what to skip and how to keep the suite fast and reliable.

What you'll learn

  • A testing strategy that balances unit, component and end-to-end tests
  • Vitest setup, matchers, mocks, spies, fake timers and snapshot tests used sparingly
  • Testing Library queries by role and label, and why they lead to accessible code
  • Simulating user behaviour with user-event and testing async UI
  • Mocking network requests with Mock Service Worker instead of mocking fetch
  • Vitest browser mode for component tests in a real browser
  • Playwright: locators, auto-waiting, fixtures, tracing and the UI mode
  • Authentication, test data and isolating end-to-end tests from each other
  • Visual comparisons and basic accessibility checks in automated tests
  • Running tests in CI, sharding, retries and fixing flaky tests

Who it's for

  • Frontend developers who write few tests or find their tests brittle
  • Teams adding automated tests to an existing React, Vue or Svelte app
  • QA engineers moving from manual testing to code-based automation

Prerequisites

  • Comfortable with modern JavaScript or TypeScript
  • Experience with one component framework; examples use React (see React & TypeScript Fundamentals)
  • Basic Git and command-line use

Outcomes

By the end of this course you will be able to:

  1. Decide what to test at each level and explain the trade-offs to your team.
  2. Write component tests that survive refactors and check real user behaviour.
  3. Build a reliable Playwright suite for your app's critical user journeys.
  4. Run the whole suite in CI with useful reports when something fails.

Course outline

ModuleTopic
1Why test, and a strategy that fits your app
2Vitest fundamentals and configuration
3Mocks, spies, timers and test doubles
4Component testing with Testing Library
5User events, forms and async behaviour
6API mocking with Mock Service Worker
7Vitest browser mode and coverage
8Playwright basics: locators and assertions
9Playwright fixtures, auth and test data
10Visual and accessibility checks
11CI pipelines, sharding and flaky tests
12Project: a full test suite for a real app

FAQ

Why Vitest rather than Jest?

Vitest shares configuration with Vite, runs fast and has a largely Jest-compatible API. If your project uses Jest, most of what you learn transfers directly.

Should I aim for 100% coverage?

No. Coverage is a useful signal for finding untested areas, not a target. We focus on testing the behaviour that would hurt most if it broke.

Does the course cover running tests in GitHub Actions?

Yes, briefly. For a deeper look at pipelines, see CI/CD with GitHub Actions.

How do I join?

Get in touch and we'll share the current format, schedule and enrolment details.