playwright-testing

A set of patterns for Playwright, a tool that tests web browsers automatically. It covers end-to-end tests, which test complete user flows, as well as visual checks and continuous-integration setup.

In plain words
What is it for?
Use it when creating end-to-end tests, page objects, visual regression tests, browser configurations, or Playwright checks in CI.
Why use it?
It helps make browser tests more reliable across browsers and parallel test workers. It also addresses flaky tests, changing page content, network mocking, and failure traces.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/monkilabs/opencastle/playwright
Any agent
npx skills add monkilabs/opencastle --skill playwright
Clone the repo
git clone --depth 1 https://github.com/monkilabs/opencastle

Made for: Claude Code, Codex.

Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 574 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00058 $0.00574
Opus 5 $0.00029 $0.00287
Sonnet 5 $0.00012 $0.00115
Haiku 4.5 $0.00006 $0.00057

Measured 2d ago against content hash e6c87f3247af, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

playwright-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (config.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/orchestrator/plugins/playwright/SKILL.md · 42 lines

How it starts

The opening of the file, as written. The whole thing — 42 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Playwright Testing

Project test config and breakpoints: testing-config.md. Docs: https://playwright.dev/docs/intro

Layout: specs tests/e2e/{feature}/, page objects tests/pages/, fixtures tests/fixtures/.

Locator priority

getByRole(role, { name })getByLabel() for inputs → getByTestId() for containers → getByText()page.locator(css) only when no semantic alternative exists.

Gotchas

  • Page objects must hold no module-level/global state. Parallel workers share the process, so a singleton leaks state between tests and produces order-dependent failures.
  • trace: 'on-first-retry' costs nothing on green runs — enable it for flaky suites and attach the trace ID to failure tickets.
  • Visual diffs: snapshot only stable regions and mask dynamic content, otherwise every run diffs.
  • forbidOnly: !!process.env.CI prevents a stray test.only from silently shrinking the CI suite to one test.
  • webServer.reuseExistingServer: !process.env.CI — locally reuses your dev server; in CI it must start its own.
  • retries: 2 and workers: 1 in CI trade wall-clock for determinism.
  • Mock at the network layer: await page.route('/api/login', route => route.fulfill({ status: 200, body: ... })).

Commands

npx playwright test --ui                      # interactive iteration
npx playwright test auth.spec.ts              # single spec
npx playwright test --project=chromium        # one browser
npx playwright test --grep "login"            # filter by title
npx playwright test --debug                   # step through
npx playwright codegen http://localhost:3000  # record a spec
npx playwright show-report                    # HTML report (verify 0 failures)
npx playwright install                        # browsers — required on a fresh machine/CI

projects in playwright.config.ts map to devices[...] presets (Desktop Chrome, Desktop Firefox, Desktop Safari, iPhone 14).

Read the full file on GitHub · 42 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 42 lines · 58 tokens per session scan A e6c87f3247af

Subscribe to this mod's changes

playwright-testing is a skill published in the GitHub repository monkilabs/opencastle (61 stars, last pushed 4d ago), licensed MIT. It adds 58 tokens to every session and 574 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

run-history-skill-builder

Turn a completed task, browser flow, artifact pipeline, failure-recovery trace, or repeatedly refined workflow into a new reusable skill package or a reviewed skill-design plan. Use when the user asks to make a new skill from real run history, extract a reusable workflow from conversation/logs/files, summarize lessons…

dongshuyan/compass-skills · 95 tokens

demo-6-article-kg

Demo skill that web-fetches two Decoding AI knowledge-graph articles, has the agent itself distill them into a typed entity/relation graph, and renders an interactive dark-themed force-directed KG into one self-contained kg.html — no graph library, no CDN.

decodingai-magazine/building-a-coding-agent-from-scratch-course · 61 tokens

codegen-html

Scaffold and iterate on standalone Preact + HTM applications with zero build dependencies.

initializ/forge · 20 tokens

product-architect

Complete product development system with 64 agents and 35 frameworks. Use when the user wants to build a product, write a PRD, plan an MVP or roadmap, design an app, research a market or check whether a feature already exists or is novel, do competitive analysis, run a security audit, build a financial model, plan…

ankitjha67/product-architect · 211 tokens

design-audit

Audit a finished frontend change by measuring rendered rects and computed styles before using screenshots as human-checkable evidence.

wlsdks/ontology-atlas · 26 tokens

map-perf

Measure topology-map drag, pan, and zoom with a deterministic harness that proves it grabbed a real node instead of silently panning the background.

wlsdks/ontology-atlas · 32 tokens