agentleFS
ella79ella79/agentic-playwright-suite/.claude/skills/playwright-mcp/SKILL.md

playwright-mcp

Skill8 starsChanged 2 months agoMITView on GitHub

Drive the live application through Playwright's MCP servers for exploration, locator discovery, test generation, and failure diagnosis. Use when planning coverage, confirming an accessible name, generating a case, or investigating a failure.

5 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions5 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 5

    1. Hainrixz/editor-pro-max★ 259same name
    2. bmcszk/agent-skills★ 1same name
    3. weininghui/skills★ 1same name
    4. beelabstudio/ai★ 0same name
    5. BhavinM/my-claude-setup★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository4 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use the browser_verify_* tools for checks, so verifications survive into the generated test as assertions instead of being lost as …

    line 54
  2. Very specific:

    No accessible name and no data-qa is a finding worth recording: the page object will need a documented CSS fallback.

    line 63
  3. Distinctive:

    Search matches category names as well as product names.

    line 77

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Playwright MCP Skill

Outcome

Agents inspect the real application instead of guessing. Every locator that reaches a page object was confirmed against a live accessibility snapshot first.

Two Servers, Two Jobs

.mcp.json registers both. Pick by task, not by habit.

ServerCommandUse for
playwright-testnpx playwright run-test-mcp-serverPlanning, generating, and healing tests
playwrightnpx playwright-mcpAd-hoc exploration outside test authoring

Prefer playwright-test. It reads playwright.config.ts, so it already knows this project's baseURL, the data-qa test id attribute and the 1920x1080 viewport, so an agent resolves locators exactly as the suite will. It also exposes tools the general server has no equivalent for:

ToolPurpose
planner_setup_pageInitialise the page before any exploration. Call once, first
planner_save_planPersist the finished plan
generator_setup_pageSet up the page for the scenario being generated
generator_read_logRetrieve the recorded actions after walking a scenario
generator_write_testWrite the generated spec
browser_verify_text_visible, browser_verify_element_visible, browser_verify_valueRecord verifications as assertions rather than bare clicks

The agent definitions in .claude/agents/ are generated by npx playwright init-agents --loop=claude and carry the exact tool list for the installed Playwright version. Regenerate them after upgrading Playwright, then re-append the "Project rules for this repository" section each one ends with.

When Not To Use MCP

  • Not for running the suite. Tests run through yarn test:e2e and yarn test:vr. MCP explores and generates; it does not execute the suite.
  • Not as a recorder. A transcribed click sequence is not a test: it has no page objects, no intent, and assertions only where someone remembered them. Use what the session established, then write the spec properly.

Method

  1. planner_setup_page (or generator_setup_page) once, before anything else.
  2. browser_snapshot: the accessibility tree is the source of truth for locators. The role and the accessible name are what getByRole will match.
  3. Interact to reach each state the plan needs; snapshot again at every state worth asserting on.
  4. Use the browser_verify_* tools for checks, so verifications survive into the generated test as assertions instead of being lost as navigation.
  5. Record the confirmed accessible names in the plan.

Locator Discovery Rules

  • A real role and name in the snapshot means the locator is getByRole(role, { name }).
  • An element carrying data-qa is reachable through getByTestId, because testIdAttribute maps onto it in the project config and the authoring server picks that up.
  • No accessible name and no data-qa is a finding worth recording: the page object will need a documented CSS fallback.
  • Two elements sharing one accessible name is a scoping problem to solve in the page object, not a reason to reach for nth().

Known Traps In This Application

  • The consent banner renders inside a shadow DOM. Playwright locators pierce open shadow roots, so getByRole("button", { name: "Consent" }) resolves it, while document.querySelector from an evaluate call will not. Do not conclude the button is missing.
  • Third-party ad iframes inject after load and shift layout. The test fixture aborts those hosts, so a suite run and an MCP session can render differently. Check which one you are looking at.
  • /delete_account deletes immediately on GET. Do not navigate there while exploring with an account you still need.
  • Search matches category names as well as product names.

Vendor documentation

references/playwright-mcp-best-practices.md maps the official guidance onto the repository: the two servers, the flags that make a session match the suite, and what MCP is not for.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.