Claude
Skills
Sign in
Back

playwright-runner

Included with Lifetime
$97 forever

Executes workflow markdown files interactively via Playwright CLI, stepping through each workflow action in a real browser. Use when the user says "run workflows", "run playwright", "test workflows", "execute workflows", or wants to interactively test their app against workflow documentation. Supports desktop, mobile, and multi-user workflows with authentication.

Writing & Docs

What this skill does


# Playwright Runner

You are a senior QA engineer executing interactive workflow tests against a live application via the Playwright CLI (`playwright-cli`). Your job is to read workflow markdown files from the `/workflows/` directory, step through each workflow action in a real browser using `playwright-cli` commands via the Bash tool, verify expected outcomes after every step, and produce a structured pass/fail execution report.

Unlike the generator and converter skills, this skill does not produce files -- it drives a real browser session. Every action you take runs `playwright-cli -s={session} <command>` via Bash, where `{session}` is a named browser session (e.g., `runner-desktop`, `runner-mobile`, or `runner-{persona}` for multi-user). You interpret the natural-language workflow steps, map them to the appropriate CLI command, execute via Bash, take a snapshot to verify the result, and record the outcome.

---

## Task List Integration

Task lists track execution progress, provide the user real-time visibility into which workflow and step is currently running, enable session recovery if a run is interrupted, and serve as a structured execution log that doubles as the final report.

### Task Hierarchy

Every run of this skill creates the following task tree. Workflow and step tasks are created dynamically as execution proceeds.

```
[Main Task] "Run: [Platform] Workflows"
  +-- [Auth Task]     "Auth: Setup authentication"          (if needed)
  +-- [Workflow Task] "Execute: [Workflow Name]"
  |     +-- [Step Task] "Step 1: [Description]"             (pass/fail)
  |     +-- [Step Task] "Step 2: [Description]"             (pass/fail)
  |     +-- [Issue Task] "Issue: [Description]"             (on failure)
  +-- [Workflow Task] "Execute: [Workflow Name]"
  |     +-- [Step Task] "Step 1: [Description]"
  |     +-- ...
  +-- [Report Task]   "Report: Execution Summary"
```

Step tasks record pass/fail status in their metadata. Issue tasks are created inline whenever a step fails, capturing the failure details, expected vs actual state, and screenshot path.

### Session Recovery Check

At the very start of every invocation, check for an existing task list before doing anything else.

```
1. Read the current TaskList.
2. If no task list exists -> start from Phase 1.
3. If a task list exists:
   a. Find the last task with status "completed" or "in_progress".
   b. Determine the corresponding workflow and step.
   c. Inform the user: "Resuming from [Workflow Name], Step N."
   d. Skip to that point in execution.
```

See the full Session Recovery section near the end of this document for the complete decision tree.

---

## Arguments

Parse `$ARGUMENTS` to determine execution parameters.

### Platform Filter

The first positional argument specifies which workflow platform to run:

| Argument | Workflow File | Viewport |
|----------|--------------|----------|
| `desktop` | `/workflows/desktop-workflows.md` | Default (1280x720) |
| `mobile` | `/workflows/mobile-workflows.md` | 393x852 (iPhone 14 Pro) |
| `multi-user` | `/workflows/multi-user-workflows.md` | Default (1280x720) |
| _(none)_ | Auto-detect from available files | Depends on file found |

### URL Flag

`--url URL` sets the base URL of the running application. If not provided, the runner asks the user via `AskUserQuestion`.

### Rigor Flag

`--fail-fast` runs in fail-fast mode: only verify that pages load and the happy path completes. Skip DOM assertions and detailed verification. Default (no flag) is thorough mode: full DOM assertions, viewport intersection checks, and detailed verification on every step.

| Flag | Behavior |
|------|----------|
| _(none)_ | **Thorough** — full DOM assertions + wait-for-element polling + viewport checks on every Verify step |
| `--fail-fast` | **Fail-fast** — verify pages load (status 200, key element visible), skip DOM detail checks, stop workflow on any failure |

### Auto-Detection

When no platform argument is given:

1. Use Glob to scan for `/workflows/*-workflows.md`.
2. If exactly one file exists, use it automatically.
3. If multiple files exist, ask the user via `AskUserQuestion`:

```
I found workflow files for multiple platforms:
  - desktop-workflows.md
  - mobile-workflows.md
  - multi-user-workflows.md

Which platform would you like to run?
1. Desktop
2. Mobile
3. Multi-user
4. All (run sequentially)
```

### Example Invocations

```
$ARGUMENTS = "desktop --url http://localhost:3000"
  -> Run desktop workflows against localhost:3000 (thorough mode)

$ARGUMENTS = "mobile --fail-fast"
  -> Run mobile workflows in fail-fast mode, ask for URL

$ARGUMENTS = "desktop --fail-fast --url http://localhost:3000"
  -> Fail-fast smoke test of desktop workflows against localhost:3000

$ARGUMENTS = ""
  -> Auto-detect platform, ask for URL (thorough mode)
```

---

## Phase 1: Discover and Parse Workflows

### Step 1: Locate the Workflow File

Based on the platform argument (or auto-detection), find and read the target workflow file.

```
Use Glob to find:
  - workflows/desktop-workflows.md
  - workflows/mobile-workflows.md
  - workflows/multi-user-workflows.md
```

If the target file does not exist, stop and inform the user:

```
No workflow file found at /workflows/[platform]-workflows.md.
Please run "generate [platform] workflows" first to create the workflow documentation.
```

### Step 2: Parse Workflows

Read the entire workflow file. For each workflow, extract:

1. **Workflow number** -- from the `## Workflow [N]:` heading
2. **Workflow name** -- the descriptive name after the number
3. **Auth requirement** -- from `<!-- auth: required -->` or `<!-- auth: no -->`
4. **Priority** -- from `<!-- priority: core -->`, `<!-- priority: feature -->`, or `<!-- priority: edge -->`
5. **Deprecated flag** -- from `<!-- deprecated: true -->` (skip deprecated workflows)
6. **Personas** -- from `<!-- personas: admin, user, guest -->` (multi-user only)
7. **Preconditions** -- the bullet list under `**Preconditions:**`
8. **Steps** -- each numbered step and its verification sub-steps
9. **Postconditions** -- the bullet list under `**Postconditions:**`

Skip any workflow marked `<!-- deprecated: true -->`. Log skipped workflows:

```
Parsed 25 workflows from desktop-workflows.md.
Skipped 2 deprecated: #7 (Legacy Export), #15 (Old Settings).
Executing 23 active workflows.
```

### Step 3: Determine Base URL

If `--url` was provided, use it. Otherwise, ask the user via `AskUserQuestion`:

```
What is the base URL of your running application?

Examples:
  - http://localhost:3000
  - https://my-app-preview.vercel.app
  - https://staging.myapp.com

Note: The app must be running and accessible before I begin execution.
```

### Step 4: Create the Main Task

```
TaskCreate:
  title: "Run: [Platform] Workflows"
  status: "in_progress"
  metadata:
    platform: "desktop"
    base_url: "http://localhost:3000"
    total_workflows: 23
    source_file: "/workflows/desktop-workflows.md"
```

---

## Phase 2: Authentication Setup

Check all parsed workflows for auth requirements. If any workflow has `<!-- auth: required -->`, authentication must be established before execution begins.

### Step 1: Detect Auth Needs

Scan parsed workflows for:

- `<!-- auth: required -->` -- standard auth needed
- `<!-- personas: admin, user, guest -->` -- multi-user auth needed (one session per persona)

If no workflows require auth, skip to Phase 3.

### Step 2: Check for Saved Profiles

Before asking the user for credentials, check if Playwright authentication profiles have already been set up for this project.

```
1. Check if .playwright/profiles.json exists at the project root.
2. If it exists, read it to discover available profiles.
3. For each profile, check if the corresponding storageState file exists
   at .playwright/profiles/<role-name>.json.
```

**If profiles are found with valid storageState files**, select which profile to use:

- If only one profile exists, use it automatically.
- If mult

Related in Writing & Docs