Network Stubbing
Intercepting and replacing network requests with controlled responses so tests run against predictable data.
What is Network Stubbing?
What is Network Stubbing?
Network stubbing intercepts the requests a page makes and substitutes controlled responses, letting tests run against predictable, deterministic data instead of a live backend. It removes flakiness from slow or unreliable services, makes hard-to-trigger scenarios—errors, empty states, edge-case payloads—easy to reproduce, and speeds up runs by skipping real network round-trips. Playwright's routing API makes stubbing straightforward inside a browser test, so recorded flows can validate exactly how the UI renders any response you dictate.