Who it is forA backend or QA engineer who needs to check that API responses match an expected contract as part of the same test suite.
The problemAPI checks written by hand often lack schema validation and cleanup, so tests leave data behind or pass with malformed responses.
The outcomeAPI tests that call endpoints through the apiRequest fixture, validate responses with Zod schemas, and use helper fixtures for setup and teardown.
What you need first
- Node.js v22.x or later
- npm v10.x or later
- An empty directory or empty git repo for the test project
- A web application URL to test, or the --demo option to try the bundled demo app
Steps
- Scaffold the project with
npm create agentic-playwright . -- --demoif you have not already. - Read the API Testing section of the README to see how the apiRequest fixture and helper fixtures are used.
- Ask the assistant to write an API test for <api-endpoint> using the apiRequest fixture and a Zod schema.
- Run
npm testand confirm the API test passes against your environment.
Prompt for your agent
In the agentic-playwright repo, write an API test for <api-endpoint> using the apiRequest fixture and a Zod schema, with setup and teardown fixtures. Expected output: a passing API spec that validates the response shape. Verify that the schema is defined with Zod and that `npm test` passes.
Caveat. The README gives the fixture names but not endpoint details, so you must supply the real API URL and environment values in the env files.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for idavidov13/agentic-playwright and "Add API contract tests with Zod validation and fixtures"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer