Playwright / Quiz

Own the Wire

page.route, fulfill vs continue vs abort, handler ordering, and the registration race that lets real traffic sneak past your mock.

Difficulty
Medium
Format
Quiz
Points
150
Estimate
10 min

// MISSION BRIEF

Your Mission

The backend is down, the third-party API bills per call, and the error state you need to test happens once a month in production. Network interception makes all three problems disappear.

This quiz covers page.route mechanics: fulfill/continue/abort, glob matching, handler precedence, and capturing what the app actually sent.

Speed bonus active.

// FIRST CONTACT

Battle teaser

To make GET /api/products return canned JSON without touching a backend:

  1. Aawait page.mock('/api/products', fakeProducts)
  2. BEdit the app source before the test run
  3. COverride window.fetch in an init script, that is the supported way
  4. Dawait page.route('**/api/products', route => route.fulfill({ json: fakeProducts }))
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

playwrightnetwork-mockingapi-testingtypescripte2e-testing