/testing:true-dom-testerfrom Testing core
Generates and runs automated browser tests using Playwright CLI and the accessibility tree (DOM snapshot). Faster and cheaper than screenshot-based approaches. Uses semantic locators, real DOM structure, and optional Firecrawl for bot-protected pages.
Ships in Testing core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Generates production-ready Playwright tests by navigating the real DOM using the accessibility tree — not screenshots. This approach is:
getByRole, getByLabel) survive UI redesignsReference Files:
- accessibility-tree.md — What the DOM snapshot contains and how to read it
- test-patterns.md — Patterns for auth flows, forms, navigation, APIs
- firecrawl.md — Bypassing bot protection for external pages
- references/examples.md — Full worked examples with generated test files
| Approach | Speed | Cost | Resilience | Setup |
|---|---|---|---|---|
| This skill (DOM snapshot) | ⚡ Fast | 💚 Low | 💚 High | Simple |
| Screenshot / vision | 🐢 Slow | 🔴 High | 🟡 Medium | Complex |
| CSS selectors (manual) | ⚡ Fast | 💚 Low | 🔴 Fragile | Manual |
Instead of taking a screenshot and asking a vision model to identify buttons, this skill calls playwright-cli snapshot to get a structured text representation of every interactive element on the page — exactly what a screen reader would see.
# snapshot output example:
e1 [textbox "Email address"]
e2 [textbox "Password"]
e3 [checkbox "Remember me"]
e4 [button "Sign in"]
e5 [link "Forgot password?"]
Claude reads this tree directly and generates precise, semantic selectors.
/true-dom-tester generate https://myapp.com/login
/true-dom-tester generate http://localhost:3000/checkout --name checkout-flow
/true-dom-tester run
/true-dom-tester full https://myapp.com/signup --name signup-flow
playwright-cli open <url>
playwright-cli snapshot # Read the accessibility tree
playwright-cli network # Check API calls on page load (optional)
Read the snapshot. Identify:
Walk through the user flow step by step. Each playwright-cli action auto-generates the corresponding TypeScript line:
playwright-cli fill e1 "[email protected]"
# → await page.getByRole('textbox', { name: 'Email address' }).fill('[email protected]');
playwright-cli click e4
# → await page.getByRole('button', { name: 'Sign in' }).click();
playwright-cli snapshot # Take snapshot after each major action to verify state change
After each significant action, read the new snapshot and add assertions for:
toHaveURL)toBeVisible)toHaveText)toHaveCount)toHaveValue)Compile all generated code into a structured .spec.ts file:
import { test, expect } from '@playwright/test';
test.describe('Login Flow', () => {
test.beforeEach(async ({ page }) => {
await page.goto('https://myapp.com/login');
});
test('successful login redirects to dashboard', async ({ page }) => {
await page.getByRole('textbox', { name: 'Email address' }).fill('[email protected]');
await page.getByRole('textbox', { name: 'Password' }).fill('password123');
await page.getByRole('button', { name: 'Sign in' }).click();
await expect(page).toHaveURL(/.*dashboard/);
await expect(page.getByRole('heading', { name: 'Welcome' })).toBeVisible();
});
test('invalid credentials shows error message', async ({ page }) => {
await page.getByRole('textbox', { name: 'Email address' }).fill('[email protected]');
await page.getByRole('textbox', { name: 'Password' }).fill('wrongpass');
await page.getByRole('button', { name: 'Sign in' }).click();
await expect(page.getByRole('alert')).toBeVisible();
await expect(page.getByRole('alert')).toContainText('Invalid credentials');
});
});
npx playwright test tests/e2e/<name>.spec.ts
If tests fail: read the error, re-open the page, re-snapshot, fix selectors or assertions.
tests/
e2e/
<feature-name>.spec.ts # Main test file
auth/
login.spec.ts
signup.spec.ts
checkout/
checkout-flow.spec.ts
Always prefer locators in this order:
getByRole('button', { name: 'Submit' }) — ARIA role + accessible namegetByLabel('Email address') — form labelgetByPlaceholder('Enter email') — placeholder textgetByText('Sign in') — visible textgetByTestId('submit-btn') — data-testid attributelocator('#submit') — CSS selector (avoid unless nothing else works)Use Firecrawl (see references/firecrawl.md) when:
playwright-cli gets blocked or returns a captcha pageFor your own app (localhost or staging), Firecrawl is not needed — use playwright-cli directly.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub janszewczyk/claude-plugins --plugin testing2 skills in this plugin