Playwright·Cookbook Field Manual

Playwright · Field Manual

Tests that depend on your code, not the internet.

44 self-contained patterns for getting API mocking and test conventions right with Playwright. Every card is a complete recipe: prose, a live specimen you can poke at, and a runnable test.

44 cards 5 parts page.route() first
Part 01

Network Mocking

Make a test depend only on your code, never the internet.

Part 02

Locators & Structure

Find elements by what the user sees; keep selectors in one place.

Part 03

Reliability

Web-first waits, error guards, and screenshots that do not flake.

Part 04

Architecture, Auth & Data

Fixtures, storage-state auth, and parallel-safe test data at scale.

Part 05

Operations & Advanced

Visual diffs, tracing, sharded CI, devices, and the long tail.