# AI use cases for Agentic Playwright (idavidov13/agentic-playwright)

Repo: [idavidov13/agentic-playwright](https://github.com/idavidov13/agentic-playwright) | Use cases: 5 | Page: https://dedupedai.com/use-cases/idavidov13-agentic-playwright/

A Playwright and TypeScript test scaffold with page objects, API contracts, data factories, CI, and AI assistant rules that load automatically.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Get a green Playwright TypeScript suite in under 5 minutes: https://dedupedai.com/use-cases/idavidov13-agentic-playwright/green-playwright-suite-in-five-minutes/
- Have an AI assistant write tests that follow team rules: https://dedupedai.com/use-cases/idavidov13-agentic-playwright/ai-assistant-writes-rule-following-tests/
- Add API contract tests with Zod validation and fixtures: https://dedupedai.com/use-cases/idavidov13-agentic-playwright/api-contract-tests-with-zod/
- Map a web app's flows with playwright-cli before testing: https://dedupedai.com/use-cases/idavidov13-agentic-playwright/map-web-app-flows-with-playwright-cli/
- Block bad commits with lint and version drift checks: https://dedupedai.com/use-cases/idavidov13-agentic-playwright/block-bad-commits-with-drift-checks/

## How to get a green Playwright TypeScript suite in under 5 minutes with Agentic Playwright

Repo: [idavidov13/agentic-playwright](https://github.com/idavidov13/agentic-playwright) | Difficulty: Intermediate | Time: 15 minutes | Basis: From the README

Scaffold a running Playwright and TypeScript test project and see the smoke test pass before writing any code.

**Who it is for:** A QA engineer or developer starting a new end-to-end test project who wants a working baseline before adapting it to their own app.

**The problem:** Setting up a Playwright TypeScript project with page objects, fixtures, configuration, and a browser install takes time before any test can run.

**The outcome:** A scaffolded project with dependencies and a browser installed, and a passing smoke test run against the bundled demo application.

### Steps

1. Create an empty directory for the tests, or clone an empty git repo, and open a terminal in it.
2. Run `npm create agentic-playwright . -- --demo`.
3. Wait for the scaffold to install dependencies and a browser, then for the smoke test to run against the demo application.
4. Confirm the smoke test is green, then open the example files such as the page objects and login spec to see the patterns.
5. Replace the example pages and tests with your own application's pages and tests.

### Prompt to paste into your agent

```text
In the agentic-playwright repo, run `npm create agentic-playwright <target-folder> -- --demo` from an empty <target-folder>. Expected output: the scaffold installs dependencies and a browser and the smoke test passes against the demo app. Verify the smoke test result is green before making any changes.
```

### Caveat

The bundled files are examples only, so the README says they must be replaced with your real application's pages, tests, and data.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/idavidov13-agentic-playwright/green-playwright-suite-in-five-minutes/

## How to have an AI assistant write tests that follow team rules with Agentic Playwright

Repo: [idavidov13/agentic-playwright](https://github.com/idavidov13/agentic-playwright) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Use the bundled rules and write-time hook so Claude Code or Cursor produces tests in the project's required style.

**Who it is for:** A developer or QA lead who wants AI assistant output to match team conventions without re-explaining them in every prompt.

**The problem:** AI assistants tend to write tests with XPath, hard waits, any types, and inconsistent structure unless they are told the rules each time.

**The outcome:** A new test file using page objects, Given/When/Then steps, and web-first assertions, with the forbidden patterns blocked by the hook.

### Steps

1. Scaffold the project with `npm create agentic-playwright . -- --demo`, or use the Dev Container.
2. Open the project in Claude Code or Cursor so the rule files for that tool load automatically.
3. Ask the assistant for a test covering one feature of your application and let it follow the Constitution and skills.
4. Check that the output has no waitForTimeout, XPath, or any type, and that the hook blocks those patterns if the assistant tries to write them.
5. Run `npm test` to confirm the new test passes.

### Prompt to paste into your agent

```text
In the agentic-playwright repo, write a Playwright test for <feature-under-test> using the Constitution and skills under .claude/. Expected output: a spec with page objects, Given/When/Then steps, web-first assertions, and one tag. Verify the file has no waitForTimeout, XPath, or any type, and that `npm test` passes.
```

### Caveat

The README says the hook covers only mechanically detectable patterns, so you still need to review AI-written tests for correctness.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/idavidov13-agentic-playwright/ai-assistant-writes-rule-following-tests/

## How to add API contract tests with Zod validation and fixtures with Agentic Playwright

Repo: [idavidov13/agentic-playwright](https://github.com/idavidov13/agentic-playwright) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Write API tests using the apiRequest fixture, Zod schema checks, and setup and teardown helper fixtures.

**Who it is for:** A backend or QA engineer who needs to check that API responses match an expected contract as part of the same test suite.

**The problem:** API checks written by hand often lack schema validation and cleanup, so tests leave data behind or pass with malformed responses.

**The outcome:** API tests that call endpoints through the apiRequest fixture, validate responses with Zod schemas, and use helper fixtures for setup and teardown.

### Steps

1. Scaffold the project with `npm create agentic-playwright . -- --demo` if you have not already.
2. Read the API Testing section of the README to see how the apiRequest fixture and helper fixtures are used.
3. Ask the assistant to write an API test for <api-endpoint> using the apiRequest fixture and a Zod schema.
4. Run `npm test` and confirm the API test passes against your environment.

### Prompt to paste into your agent

```text
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.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/idavidov13-agentic-playwright/api-contract-tests-with-zod/

## How to map a web app's flows with playwright-cli before testing with Agentic Playwright

Repo: [idavidov13/agentic-playwright](https://github.com/idavidov13/agentic-playwright) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Use playwright-cli to explore a live app, trace its flows, and inspect storage before writing tests.

**Who it is for:** A QA engineer facing an unfamiliar web application who needs to learn its screens and flows before writing test cases.

**The problem:** Writing tests against an app you have not explored leads to guessed selectors and missed flows.

**The outcome:** A captured view of the app's UI, navigation, and storage state that you can use to plan page objects and test cases.

### Steps

1. Scaffold the project with `npm create agentic-playwright . -- --bare` if your app URL is not the demo app.
2. Ask the assistant to use playwright-cli to open <app-url> and walk through the main flows such as login and search.
3. Review the captured traces, screenshots, and storage details the exploration produced.
4. Use the findings to create page objects and test cases in the project.

### Prompt to paste into your agent

```text
In the agentic-playwright repo, use playwright-cli to explore <app-url> and capture the login and main navigation flows. Expected output: a summary of screens, selectors, and storage state that is usable for page objects. Verify the summary names the flows walked and that no test code was changed.
```

### Caveat

The README names playwright-cli as the default exploration path but does not give its exact command syntax, so check the playwright-cli skill's own documentation for usage.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/idavidov13-agentic-playwright/map-web-app-flows-with-playwright-cli/

## How to block bad commits with lint and version drift checks with Agentic Playwright

Repo: [idavidov13/agentic-playwright](https://github.com/idavidov13/agentic-playwright) | Difficulty: Advanced | Time: 30 minutes | Basis: From the README

Run the bundled lint, skill drift, and version checks so broken rules or mismatched versions never get committed.

**Who it is for:** A team lead or maintainer who keeps a shared test scaffold and wants consistent rules across contributors.

**The problem:** Rule files, skill references, and version numbers drift apart over time, and contributors may not notice until CI fails.

**The outcome:** Clear pass or fail results from the drift and version checks, run locally before a commit or in CI.

### Steps

1. Run `npm run check:skills-drift` to confirm Constitution rules stay anchored in their owning skill.
2. Run `npm run check:skills-references` to catch broken pointers and anchors across the rule trees.
3. Run `npm run check:version` to confirm VERSION, package.json, and the latest CHANGELOG heading match.
4. Run `npm run skills:verify` to re-hash the vendored skills and detect drift from the lock file.

### Prompt to paste into your agent

```text
In the agentic-playwright repo, run `npm run check:skills-drift`, `npm run check:skills-references`, `npm run check:version`, and `npm run skills:verify`. Expected output: each command exits with a clear pass or a non-zero drift error. Verify all four exit with status zero before reporting success.
```

### Caveat

The README says these checks run from the Husky pre-commit hook and CI, so they only guard commits in a repo where those hooks are installed.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/idavidov13-agentic-playwright/block-bad-commits-with-drift-checks/
