agentsclimarketplace

Oa playwright cli

Skill martinvidec/oa-playwright-cli-skill/skills/oa-playwright-cli

Secure every UI feature with Playwright end-to-end tests, driven by the upstream playwright-cli tool. Use whenever a UI feature (new or changed) is being implemented and needs an automated end-to-end safety net, whenever a UI swimlane is missing test coverage, when Playwright tests fail and need debugging, or when Playwright tests must be wired into a project's build pipeline (Maven, Gradle, npm/pnpm, pytest). Produces per-swimlane E2E tests in the project's native language and integrates them into the existing build so they run on every CI invocation. Prefer this skill over ad-hoc browser automation whenever the goal is to leave behind a persisted, repeatable regression test rather than a one-shot interaction.From its SKILL.md

Install
npx -y skills add martinvidec/oa-playwright-cli-skill --skill oa-playwright-cli

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

12.7 KB, as published. Nobody here has run it

oa-playwright-cli

OpenAustria workflow skill for building and maintaining Playwright E2E coverage with maximum agent autonomy. Sits on top of the upstream playwright-cli tool and its bundled reference skill.

Mission

For every UI feature, leave behind a persisted Playwright test — not a one-shot browser interaction. The goal is to find end-to-end, as early as possible, whether a feature is correctly implemented, and to keep that check running automatically on every build. Each UI swimlane (a cohesive user-visible flow: login, create-todo, share-report, …) should end up covered by at least one test.

When to use this skill

Trigger this skill whenever any of these hold:

  • A new UI feature is being implemented or an existing one materially changed
  • A UI swimlane has no E2E test yet and needs one
  • A Playwright test is failing and needs to be diagnosed & fixed
  • Playwright tests exist but are not wired into the project's build
  • The user asks to "verify the feature end-to-end" or "cover this flow with a Playwright test"

Do not use for one-shot browser interactions where no test should be left behind. For those, drive playwright-cli directly without invoking this workflow.

Relationship to the upstream playwright-cli skill

Upstream ships a complete reference skill covering CLI mechanics — commands, sessions, snapshots, request mocking, tracing, video, test generation. That skill is installed via playwright-cli install --skills and becomes the Single Source of Truth for "how do I use the CLI". This skill does not duplicate that surface. Instead, it provides the OA-specific workflow on top: swimlane discovery, build integration per language, autonomy patterns, and failure debugging playbooks.

When a question is purely about CLI mechanics (e.g. "how do I take a screenshot of a single element?"), consult the upstream skill. When the question is workflow-shaped ("should this be one swimlane or two?", "how do I wire this into Maven?"), use this skill.

Core workflow

Follow these phases in order. Skip a phase only when its goal is already achieved.

Phase 1 — Preflight

Before writing any test, confirm the environment is ready. Run the preflight script:

bash scripts/preflight.sh

It reports four things:

  1. Whether node (>= 18) is available
  2. Whether playwright-cli is reachable (global, local via npx, or missing)
  3. Whether the upstream playwright-cli skill is installed in this project
  4. Which build system the project uses (Maven, Gradle, npm/pnpm/yarn, Python, Flutter)

The installation of playwright-cli and its upstream reference skill is never automatic. Always ask the user first via AskUserQuestion — see references/installation.md for the exact flow. The short version:

  1. If playwright-cli is missing: ask the user whether to install it globally, locally (as a project dev dependency), or skip.
  2. After successful CLI install: ask a second question whether to also run playwright-cli install --skills to drop the upstream reference skill into ./.claude/skills/playwright-cli/ (or ./.agents/skills/... with --skills=agents). This is project-local — every project that wants the upstream reference has to opt in once from its root.
  3. If node is missing: stop and surface the problem. Do not attempt to install Node.js itself — the user's Node version manager (nvm/asdf/fnm) is not this skill's concern.

Never merge the two install questions into one. They are distinct decisions.

Phase 2 — Swimlane discovery

A swimlane is one cohesive user-visible flow with a clear start, clear success criterion, and minimal overlap with other flows. "Login", "create a todo", "share a report", "delete account" are swimlanes. "Click the save button" is not — it is a step inside a swimlane.

Before writing tests:

  1. List the swimlanes the current feature touches. Prefer a small list (3–8 lanes for a typical app) over one giant list.
  2. For each lane, note: entry point (URL or preceding action), success criterion (what the user sees when it worked), key negative paths (what should fail loudly).
  3. Check which lanes already have tests. Only generate tests for uncovered ones or lanes where the feature change invalidated the existing test.

If you cannot identify swimlanes from the code alone, ask the user. Do not invent coverage — missing lanes is better than wrong lanes.

Full guide: references/swimlane-workflow.md

Phase 3 — Explore, harvest, crystallize

This is the core autonomy loop. For each uncovered swimlane:

Explore — drive the live app with playwright-cli to discover the real DOM, real locators, and real timing:

playwright-cli -s=<lane-name> open <entry-url> --persistent
playwright-cli -s=<lane-name> snapshot          # see element refs
playwright-cli -s=<lane-name> fill e3 "[email protected]"
playwright-cli -s=<lane-name> click e7
playwright-cli -s=<lane-name> snapshot          # verify success state

Harvest — every CLI action prints the equivalent Playwright TypeScript:

> playwright-cli fill e3 "[email protected]"
# Ran Playwright code:
# await page.getByRole('textbox', { name: 'Email' }).fill('[email protected]');

Collect these lines. They are your test body, already using semantic role-based locators that resist refactoring.

Crystallize — paste the harvested code into a test file in the project's native test language. Then add assertions manually (CLI harvests actions, not expectations). Every swimlane should end with at least one expect(...) call that captures the success criterion from Phase 2.

Prefer locators in this order (details in references/locator-strategy.md):

  1. getByRole with accessible name
  2. getByLabel for form fields
  3. getByTestId (requires data-testid in the app)
  4. getByText only for truly unique strings
  5. CSS selector only as last resort — brittle, flag it with a comment

Phase 4 — Build integration

A test that requires manual invocation does not protect anything. Every test this skill produces must run automatically on the project's normal build command. Pick the guide(s) that match the detected build system:

Rule of thumb per stack:

StackBindingRunnerBuild hook
Java / Mavencom.microsoft.playwright:playwrightJUnit 5 + Surefire/Failsafemvn verify
Java / Gradlesame Java bindingJUnit 5./gradlew check
Java / Spring BootJava binding + @SpringBootTestJUnit 5mvn verify / ./gradlew check
Node@playwright/testPlaywright Testnpm test / CI workflow
Pythonpytest-playwrightpytestpytest / tox / CI
Flutter Web@playwright/test against build/webPlaywright Testmake e2e / CI workflow
Flutter nativeintegration_test packageflutter testflutter test integration_test/ — not this skill

For Java stacks the tests are written in Java using Playwright-for-Java, not in TypeScript. The CLI-harvested TypeScript is used as a template — the locator calls translate almost 1:1. The Maven/Gradle/Spring-Boot reference files spell out this translation.

For Flutter Web, tests are written in TypeScript (no official Dart binding for Playwright). The Flutter reference file explains how to enable the semantics tree so role-based locators work, and how to wire the build into the Flutter project's existing command (Makefile, melos, or dart run entry point).

Phase 5 — Run & close the loop

After wiring the test in, run the full build the user would run on CI:

mvn verify                                          # Java/Maven (incl. Spring Boot)
./gradlew check                                     # Java/Gradle (incl. Spring Boot)
PLAYWRIGHT_HTML_OPEN=never npm test                 # Node
pytest                                              # Python
make e2e                                            # Flutter Web (or the project's entry)
flutter test integration_test/                      # Flutter native — NOT this skill

If the new test fails:

  1. Do not weaken the assertion to make it pass. Assertions encode the success criterion — weakening them makes the test worthless.
  2. Enter the debug loop: references/debugging-failures.md.
  3. The loop runs the test in a paused state, attaches playwright-cli to the live session, and uses CLI exploration to distinguish "wrong locator / wrong timing / wrong assumption" from "bug in the app".

If the test is flaky, apply the fixes in debugging-failures.md (wait for actionable state, avoid hard sleeps, scope locators). Do not mark a test as test.skip to silence flakiness — that is a coverage loss.

Autonomy principles

These are the rules that let Claude drive the whole loop without the user intervening on each step:

  1. Read the snapshot before acting. playwright-cli snapshot is cheap; guessing refs is not. Always re-snapshot after navigation or a state change.
  2. Prefer sessions per swimlane. Use -s=<lane-name> so parallel exploration of different flows does not collide.
  3. Harvest, don't retype. The CLI's emitted Playwright code is more reliable than anything written from memory. Copy it; translate it only if the target language differs.
  4. One swimlane, one test file (or class). Keeps failures localized and makes it obvious what is covered.
  5. Fail loudly on missing lanes. If the preflight detects a UI feature but Phase 2 cannot identify any swimlanes, stop and ask the user — do not silently produce zero tests.
  6. Treat flakiness as a bug. Debug it, do not retry-until-green.
  7. Leave traces on failure in CI. All build-integration references set tracing to record on first retry; do not disable this.

Quick command reference

Installed by the upstream skill — kept here only as a memory jog:

playwright-cli open <url> [--headed] [--persistent] [-s=<session>]
playwright-cli snapshot [--depth=N] [<ref>]       # element map with refs
playwright-cli click <ref>
playwright-cli fill <ref> <text> [--submit]
playwright-cli press <key>
playwright-cli eval "<js>" [<ref>]
playwright-cli screenshot [--filename=...]
playwright-cli tracing-start ; playwright-cli tracing-stop
playwright-cli attach <session>                   # debug loop
playwright-cli list ; playwright-cli close-all

For everything else, consult the upstream reference skill.

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.