vasilyu1983/ai-agents-public15 files

QA Testing Playwright

Builds and debugs Playwright E2E suites. Use when authoring browser tests, fixing flakes, or hardening Playwright CI and locator strategy.

Specification
Skill ID
vasilyu1983/ai-agents-public/qa-testing-playwright
Publisher
vasilyu1983
Repository
ai-agents-public
Installs
0
Files
15
Requires
Portable core. Works on Claude Code and Codex.
Synced
Sep 23, 2026
How to use it

Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.

vasilyu1983/ai-agents-public/qa-testing-playwrightInstalls these files
  • SKILL.md
  • agents/openai.yaml
  • assets/template-playwright-e2e-review-checklist.md
  • assets/template-playwright-fail-on-flaky-reporter.js
  • assets/template-playwright-preflight-checklist.md
  • data/sources.json
  • learnings.consolidated.md
  • learnings.md
  • references/api-testing-playwright.md
  • references/playwright-authentication.md
  • references/playwright-ci.md
  • references/playwright-mcp.md
  • references/playwright-patterns.md
  • references/playwright-preflight-sandbox.md
  • references/visual-regression-testing.md

What this skill tells the agent

QA Testing (Playwright)

High-signal, cost-aware E2E testing for web applications.

Core docs:

  • https://playwright.dev/docs/best-practices
  • https://playwright.dev/docs/locators
  • https://playwright.dev/docs/auth
  • https://playwright.dev/docs/api-testing
  • https://playwright.dev/docs/test-retries
  • https://playwright.dev/docs/test-snapshots
  • https://playwright.dev/docs/trace-viewer
  • https://playwright.dev/docs/test-sharding
  • https://playwright.dev/docs/ci
  • https://playwright.dev/docs/pom
  • https://playwright.dev/docs/test-agents
  • https://playwright.dev/docs/clock
  • https://playwright.dev/docs/getting-started-cli
  • https://playwright.dev/docs/release-notes (verify current version before pinning — as of 2026-07-11 it is 1.61.1)

Quick Reference

NeedGo to
Run the Playwright workflow## Workflow
Apply defaults and authoring rules## Defaults and ## Authoring Rules
Debug flaky or blocked runs## Debugging Checklist and ## Execution Preflight (High ROI)
Decide tool fit, selectors, flake triage order, sharding cost## Expert Judgment
Load templates and references## Navigation

Defaults

  • Keep E2E thin: protect critical user journeys only; push coverage down (unit/integration/contract).
  • Locator priority: getByRole → getByLabel/getByText → getByTestId (fallback).
  • Waiting: rely on Playwright auto-wait + web-first assertions; no sleeps/time-based waits.
  • Isolation: tests must run alone, in parallel, and in any order; eliminate shared mutable state.
  • Local execution posture: choose one server topology first (shared dev stack or Playwright-managed webServer), then triage with an exact spec or named batch plus --workers=1.
  • Flake posture: retries are a debugging tool; treat rerun-pass as a failure signal and fix root cause.
  • CI flakes: prefer built-in failOnFlakyTests; use a custom reporter only for older Playwright versions.
  • CI posture: smoke gate on PRs; shard/parallelize regression on schedule; always keep artifacts (trace/video/screenshot).
  • Oracle posture: assert the user outcome; do not wait on incidental network requests when the visible result can be verified directly.
  • AI posture: use Playwright codegen / test agents / MCP for scaffolding and exploration, then harden assertions and fixtures manually.
  • Browser MCP: Playwright MCP for test generation + accessibility; Chrome DevTools MCP for performance / network / console debugging. See references/playwright-mcp.md.
  • CLI posture: for high-throughput coding agents, prefer @playwright/cli (shell commands) over Playwright MCP — roughly 4x fewer tokens per task (~27k vs ~114k tokens/task per third-party benchmarks; as of 2026-07-11, verify at https://playwright.dev/docs/getting-started-cli). Use MCP when persistent browser state and rich introspection are needed.
  • Local iteration posture: use npx playwright test --only-changed=main to run only tests affected by uncommitted/branch changes during authoring; it is a heuristic over the import graph, so always run the full suite (or the deploy-gate replay) before merging — never treat --only-changed green as release-ready signal.

Quick Start

CommandPurpose
npm init playwright@latestInitialize Playwright
npx playwright testRun all tests
npx playwright test --grep @smokeRun smoke tests
npx playwright test --project=chromiumRun a single project
npx playwright test --uiDebug with UI mode
npx playwright test --debugStep through a test
npx playwright codegenRecord a flow and bootstrap a test
npx playwright init-agents --loop=claudeInitialize test agents for Claude Code
npx playwright test --fail-on-flaky-testsFail CI if any test is flaky
npx playwright show-trace trace.zipInspect trace artifacts
npx playwright show-reportInspect HTML report
npx playwright trace <trace.zip>Analyze trace from CLI (v1.59+)
npx playwright test --only-changed=mainRun only tests affected by changes since main (heuristic — always follow with a full run before release)

Local Execution Topology

Use this order by default:

  1. Start one shared local dev stack if the repo already provides it; prefer reusing it with --no-server over spawning a fresh app per rerun.
  2. Reproduce with one exact spec or one named batch and --workers=1.
  3. Fix and rerun the smallest affected scope.
  4. Run the deploy-gate replay only after the targeted scope is green.

Default suite tiers:

  • Smoke: PR gate and fastest signal.
  • Targeted batch/spec: local triage and deflake work.
  • Deploy-gate replay: dependency-chain or critical-journey replay for release confidence.

Avoid local full-suite reruns as the first move unless the job is explicitly “prove deploy readiness now.”

When to Use

  • E2E tests for web applications
  • Test user authentication flows
  • Verify form submissions
  • Test responsive designs
  • Automate browser interactions
  • Set up Playwright in CI/CD

When NOT to Use

ScenarioUse Instead
Unit testingJest, Vitest, pytest
API contractsqa-api-testing-contracts
Load testingk6, Locust, Artillery
Mobile nativeAppium
Pure business-logic or data-transform correctnessUnit tests — a browser adds latency and flake with zero extra confidence
Cross-team API contract driftConsumer-driven contract tests, not a UI click-path proxy
Component-level visual/interaction isolation at scaleStorybook + Chromatic/Percy, or Playwright component testing only if you accept experimental-API churn (see Defaults)
Thousands of input-combination fuzzingProperty-based testing at the unit layer; E2E cannot afford the runtime

Expert Judgment

When Playwright Is the Wrong Tool

Playwright (or any browser E2E tool) is the wrong choice when a faster, cheaper layer already proves the same risk:

  • If the bug class can be caught by a type system, unit test, or schema/contract check, push it down — E2E is the most expensive test layer per assertion (browser boot, network, rendering).
  • If the "user journey" is actually an internal API call with no meaningful UI branching, test the API directly (request fixture or a dedicated API-testing skill) and skip the browser.
  • If you are testing a third-party surface you do not control (payment provider hosted page, OAuth consent screen), do not chase it with E2E; mock the boundary and test your own integration contract instead — third-party UI changes make these tests flaky by design, not by mistake.
  • If the same risk is already covered by a component test or visual snapshot at a fraction of the cost, do not duplicate it in E2E "just to be safe" — duplicate coverage without duplicate risk is waste, not thoroughness.

Selector-Strategy Decision Rule

Pick the locator in this order, and stop at the first one that resolves unambiguously to exactly one element:

  1. getByRole with an accessible name — this is what a screen reader and a real user both key off, so it survives markup refactors.
  2. getByLabel / getByText — use when there is no meaningful role (plain text, decorative containers) but the visible copy is stable.
  3. getByTestId — use only when the element has no stable role/label (e.g., a canvas, a drag handle, a duplicate-name list item) or when semantic locators would force asserting on implementation detail (raw CSS class, generated ID).

Never fall back to raw CSS or XPath as a first resort — they are a signal that the markup itself may need an accessibility fix, not just a test workaround.

Flakiness Triage Order (Fastest Signal First)

Before touching a single assertion, classify the failure in this order — each step is strictly cheaper than the next, so do not skip ahead:

Use this skill in a project

Open any RiverX project, search the Skills panel for vasilyu1983/ai-agents-public/qa-testing-playwright, and install it in one click.

Use this skill