agentleFS
darrenCWJdarrenCWJ/agent-skills-scaffold/.claude/skills/web-testing/SKILL.md

web-testing

Skill0 starsChanged 4 months agoMITView on GitHub

Verify web deliverables in a real browser using Playwright — rendering, interaction, console errors, responsive layout, E2E flows. Use whenever the deliverable is a website, web app, HTML page, dashboard, or artifact that renders in a browser, and before claiming any UI "works", "renders", or "looks right". Static inspection of HTML/JSX is NOT verification of a web deliverable.

  • Installs packages

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer the MCP for exploratory checking.

    line 17
  2. Distinctive:

    Run all five — they catch different failures:

    line 21
  3. Very specific:

    Prefer role/text selectors (getByRole, text=) over brittle CSS chains.

    line 51
  4. Distinctive:

    No browser available in the environment?

    line 54

“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

Web testing (Playwright)

"The code looks right" and "the DOM contains the element" are not evidence for web work — only a real browser rendering, executing JS, and being interacted with is. Playwright is the default tool: headless, scriptable, multi-browser.

Setup (once per environment)

npm init -y && npm i -D playwright && npx playwright install chromium --with-deps

Python alternative: pip install playwright && playwright install chromium. A Playwright MCP server gives interactive browser control instead of scripts. On Claude Code this repo already registers it at project scope (.mcp.json) — nothing to install beyond Node.js; other harnesses register npx @playwright/mcp@latest through their own MCP mechanism (on Claude Code elsewhere: claude mcp add playwright -- npx @playwright/mcp@latest).

Prefer the MCP for exploratory checking; prefer scripts for repeatable verification (scripts become the regression suite).

The minimum gate for ANY web deliverable

Run all five — they catch different failures:

  1. It loads. Navigate; assert HTTP 200 and no uncaught page errors. Capture page.on('console') and page.on('pageerror') — a page can render while the console screams.
  2. It renders. Full-page screenshot; LOOK at it (read the image). Blank page, overlapping text, and unstyled HTML all "pass" DOM assertions.
  3. It works. Exercise the core interaction(s): click the button, submit the form, apply the filter — assert the observable result, not the absence of an exception.
  4. It survives sizes. Screenshot at ≥2 viewports (e.g. 1280×800 and 390×844). Mobile breakage is the most common silently-shipped defect.
  5. It fails visibly. One negative test: invalid input, empty state, or missing data — the page should degrade, not white-screen.

Script skeleton (Node)

const { chromium } = require('playwright');
(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage({ viewport: { width: 1280, height: 800 } });
  const errors = [];
  page.on('pageerror', e => errors.push(e.message));
  page.on('console', m => m.type() === 'error' && errors.push(m.text()));
  await page.goto('http://localhost:8000', { waitUntil: 'networkidle' });
  await page.screenshot({ path: 'shot-desktop.png', fullPage: true });
  // interactions + assertions here, e.g.:
  // await page.click('text=Submit'); await page.waitForSelector('.result');
  if (errors.length) { console.error('CONSOLE/PAGE ERRORS:', errors); process.exit(1); }
  await browser.close(); console.log('PASS');
})();

Serve local files first (python3 -m http.server 8000) — file:// skips CORS/fetch behavior that will differ in production.

Practices

  • Screenshots are evidence (verification skill): save them with the verification record; read them, don't just save them.
  • Prefer role/text selectors (getByRole, text=) over brittle CSS chains; they test what the user experiences.
  • Waits: use waitForSelector/networkidle, never fixed sleeps — sleeps are flaky AND slow.
  • E2E flows that matter get saved as tests/e2e/*.spec.js and run with npx playwright test — they join the project's verification path (orient skill).
  • No browser available in the environment? Say so explicitly and downgrade the claim: "HTML validates and parses; NOT verified in a browser" — never let a rendering claim ride on static checks.

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.