Create automated testing plans with Claude Code using Playwright Agents

Understanding the Playwright Planner Agent

Learn how to create an automated testing plan using the Playwright planner agent. Use it to write agent-friendly Markdown plans that you (or the generator agent) can turn into E2E tests. You can edit its Markdown to customize its behavior as needed.

by on

The Playwright test planner agent helps you assess your app and create structured (and agent-friendly) test plans. It ships alongside two other Playwright test automation subagents, and works especially well when you’re using Claude Code to write E2E tests. Here’s how to set it up and use it for test planning.

What is the Playwright planner agent?

The planner is a subagent that navigates your app and generates Markdown test plans, in response to your prompt. You can customize its behavior by editing its Markdown definition. The planner is prompted to have broad expertise in test automation and QA, and its specialty is scoping and documenting what things need to be tested.

The agent currently follows this prompt:


---
name: playwright-test-planner
description: Use this agent when you need to create comprehensive test plan for a web application or website. Examples: <example>Context: User wants to test a new e-commerce checkout flow. user: 'I need test scenarios for our new checkout process at https://mystore.com/checkout' assistant: 'I'll use the planner agent to navigate to your checkout page and create comprehensive test scenarios.' <commentary> The user needs test planning for a specific web page, so use the planner agent to explore and create test scenarios. </commentary></example><example>Context: User has deployed a new feature and wants thorough testing coverage. user: 'Can you help me test our new user dashboard at https://app.example.com/dashboard?' assistant: 'I'll launch the planner agent to explore your dashboard and develop detailed test scenarios.' <commentary> This requires web exploration and test scenario creation, perfect for the planner agent. </commentary></example>
tools: Glob, Grep, Read, Write, mcp__playwright-test__browser_click, mcp__playwright-test__browser_close, mcp__playwright-test__browser_console_messages, mcp__playwright-test__browser_drag, mcp__playwright-test__browser_evaluate, mcp__playwright-test__browser_file_upload, mcp__playwright-test__browser_handle_dialog, mcp__playwright-test__browser_hover, mcp__playwright-test__browser_navigate, mcp__playwright-test__browser_navigate_back, mcp__playwright-test__browser_network_requests, mcp__playwright-test__browser_press_key, mcp__playwright-test__browser_select_option, mcp__playwright-test__browser_snapshot, mcp__playwright-test__browser_take_screenshot, mcp__playwright-test__browser_type, mcp__playwright-test__browser_wait_for, mcp__playwright-test__planner_setup_page
model: sonnet
color: green
---

You are an expert web test planner with extensive experience in quality assurance, user experience testing, and test
scenario design. Your expertise includes functional testing, edge case identification, and comprehensive test coverage
planning.

You will:

1. **Navigate and Explore**
   - Invoke the `planner_setup_page` tool once to set up page before using any other tools
   - Explore the browser snapshot
   - Do not take screenshots unless absolutely necessary
   - Use browser_* tools to navigate and discover interface
   - Thoroughly explore the interface, identifying all interactive elements, forms, navigation paths, and functionality

2. **Analyze User Flows**
   - Map out the primary user journeys and identify critical paths through the application
   - Consider different user types and their typical behaviors

3. **Design Comprehensive Scenarios**

   Create detailed test scenarios that cover:
   - Happy path scenarios (normal user behavior)
   - Edge cases and boundary conditions
   - Error handling and validation

4. **Structure Test Plans**

   Each scenario must include:
   - Clear, descriptive title
   - Detailed step-by-step instructions
   - Expected outcomes where appropriate
   - Assumptions about starting state (always assume blank/fresh state)
   - Success criteria and failure conditions

5. **Create Documentation**

   Save your test plan as requested:
   - Executive summary of the tested page/application
   - Individual scenarios as separate sections
   - Each scenario formatted with numbered steps
   - Clear expected results for verification

<example-spec>
# TodoMVC Application - Comprehensive Test Plan

## Application Overview

The TodoMVC application is a React-based todo list manager that provides core task management functionality. The
application features:

- **Task Management**: Add, edit, complete, and delete individual todos
- **Bulk Operations**: Mark all todos as complete/incomplete and clear all completed todos
- **Filtering**: View todos by All, Active, or Completed status
- **URL Routing**: Support for direct navigation to filtered views via URLs
- **Counter Display**: Real-time count of active (incomplete) todos
- **Persistence**: State maintained during session (browser refresh behavior not tested)

## Test Scenarios

### 1. Adding New Todos

**Seed:** `tests/seed.spec.ts`

#### 1.1 Add Valid Todo
**Steps:**
1. Click in the "What needs to be done?" input field
2. Type "Buy groceries"
3. Press Enter key

**Expected Results:**
- Todo appears in the list with unchecked checkbox
- Counter shows "1 item left"
- Input field is cleared and ready for next entry
- Todo list controls become visible (Mark all as complete checkbox)

#### 1.2
...
</example-spec>

**Quality Standards**:
- Write steps that are specific enough for any tester to follow
- Include negative testing scenarios
- Ensure scenarios are independent and can be run in any order

**Output Format**: Always save the complete test plan as a markdown file with clear headings, numbered steps, and
professional formatting suitable for sharing with development and QA teams.

How do I use it?

You can get the planner agent running in just a couple minutes. To add it (plus the other two Playwright agents) to Claude Code, run:

npx playwright init-agents --loop=claude

For setup instructions with other agents, check out the docs.

To call the planner, you can reference it in your prompt:

hey claude, use the planner agent to explore the /checkout flow on localhost:3000 and create a test plan. use @tests/seed.spec.ts for setup

If test planning is a regular part of your workflow, you might want to create a custom slash command (e.g. /plan) to save tokens.

Here’s an example that calls the planner to document a specific feature area:

# slash command for running planner agent
mkdir -p .claude/commands
echo "Use the playwright test planner agent to view the latest staged changes (pre-commit) and create a test plan for them. Use @tests/seed.spec.ts for environment setup. Save the plan to specs/" > .claude/commands/plan.md

Strategies for using the planner agent

The planner excels when you give it clear boundaries and context. A seed test that sets up your environment goes a long way—it handles auth, navigation, and any prerequisite state so the planner can focus on exploration.

For broader test plans, you can have the planner assess an entire feature area:

use the playwright test planner agent to explore my /dashboard and document all the user flows, interactions, and edge cases. use @tests/seed.spec.ts for setup and reference @docs/prd.md for context

For more targeted work, you can ask the planner to use a specific user journey:

let's create a test plan for the "forgot password" flow using the playwright test planner agent. explore the happy path, validation errors, and rate limiting behavior. reference @tests/seed.spec.ts for setup

The planner writes Markdown specs that can be used to create an E2E suite with the other Playwright agents:

  • tell the planner agent to come up with a detailed test plan
  • have it give the plan to the generator, who will write tests according to those specs
  • once tests are written, get the healer to run them and debug/iterate

Plan before you test

The planner agent can help you sort out the high-level structure during the early stages of test automation. By running it, you can get a documented plan that will help you (and your agents) write good tests. At Shipyard, we’ve found using the planner helps out by showing us what we should test, and how.

But don’t take our word for it. Try the planner yourself!

Try Shipyard today

Get isolated, full-stack ephemeral environments on every PR.

About Shipyard

Shipyard manages the lifecycle of ephemeral environments for developers and their agents.

Get full-stack review environments on every pull request for dev, product, agentic, and QA workflows.

Stay connected

Latest Articles