Playwright / Quiz

Contract Guardrails in the Test Runner

Schema assertions with zod, toMatchObject's subset semantics, breaking vs additive changes, error-body contracts, and expect.soft for full-diff sweeps.

Difficulty
Hard
Format
Quiz
Points
200
Estimate
10 min

// MISSION BRIEF

Your Mission

Your E2E suite now seeds data through the API, which means the API contract is a dependency of every UI test. Guarding that contract inside the same Playwright suite is cheap, IF you know what breaking actually means and which assertion tools fit.

Six questions. Speed bonus active.

// FIRST CONTACT

Battle teaser

A contract check, as opposed to a status check, asserts:

  1. AThat the JSON is pretty-printed
  2. BThat the response arrives within an SLA
  3. COnly that the status is 200
  4. DThe response SHAPE: required fields present, types correct, enums within range, so schema drift fails fast instead of surfacing as a UI mystery three tests later
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

playwrightcontract-testingzodapi-testing