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.
Get 5 new use cases every morning. Free, one short email, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Disclaimer
Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked "Seen in the wild", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email [email protected] and we will look at it promptly. Full disclaimer page