agentleFS
Ron-daliRon-dali/vibe-coding-rules/web-testing/SKILL.md

web-testing

Skill4 starsChanged 5 months agoApache-2.0View on GitHub

Automated web application testing. Uses Playwright (browser interaction + DOM assertion) + tesseract.js (OCR screenshot text verification). Supports pipeline.json configuration for project URL, port, and DOM selectors.

  • 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

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

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 4

    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:

    After code change self-check passes

    line 19
  2. Distinctive:

    No JS runtime errors

    line 37
  3. Distinctive:

    Before running any test, check whether this project actually needs browser testing / 先判断项目是否需要浏览器测试:

    line 55
  4. Distinctive:

    Check test dependencies installed:

    line 70
  5. Very specific:

    Write test cases to {{pipeline.paths.tests}}smoke-test.cjs:

    line 76

“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 Automated Testing / Web自动化测试

Overview / 概述

自动化浏览器测试技能。使用 Playwright 进行浏览器交互与 DOM 断言,tesseract.js 做 OCR 截图文字验证。支持冒烟测试、全量测试、截图回归测试。

Automated browser testing Skill. Uses Playwright for browser interaction and DOM assertions, tesseract.js for OCR screenshot text verification. Supports smoke tests, full tests, and screenshot regression testing.

Trigger Conditions

  • After code change self-check passes
  • User asks to "test", "verify page"
  • Need to confirm UI rendering correctness
  • Screenshot regression testing

Configuration (read from pipeline.json)

ParameterPurposeExample
{{pipeline.project.testUrl}}Test target URLhttp://localhost:3000
{{pipeline.project.testPagePath}}Test page path/
{{pipeline.paths.tests}}Test script directorytests/auto/

Test Types / 测试类型

1. Smoke Test (fast, always run)

  • Page loads successfully
  • Key DOM elements exist
  • No JS runtime errors

2. Full Test (after major changes)

  • All interaction flows
  • Form submissions
  • Modal/overlay open/close
  • Async data loading
  • Screenshot comparison

3. OCR Verification (optional, requires tesseract.js)

  • Screenshot text recognition
  • Key copy verification
  • Multi-language support

Workflow

Step 0: Project Type Detection / 项目类型检测(V2.6)

Before running any test, check whether this project actually needs browser testing / 先判断项目是否需要浏览器测试:

  1. Check pipeline.json → project.type:
    • web / fullstack / spa / mini-program → Continue to Step 1
    • cli / backend-api / desktop / script → Skip this Skill: report "Web testing skipped — project type is {type}, no browser UI to test"
  2. No pipeline.json → check package.json for web frameworks:
    • Contains react/vue/angular/next/nuxt/express with a start or dev script → likely web → continue
    • Otherwise → skip with note: "No web project detected — web-testing skipped"
  3. Both files missing → check for .html files in project root:
    • Found → possible static web → continue with caution
    • Not found → skip

Why: Running Playwright on a CLI-only project wastes time and produces confusing errors. / 在纯CLI项目上跑Playwright浪费时间且报错混乱。

Step 1: Prepare

Check test dependencies installed:

npx playwright install chromium

Step 2: Create Test Script

Write test cases to {{pipeline.paths.tests}}smoke-test.cjs:

const { chromium } = require('playwright');
(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage();
  await page.goto('{{pipeline.project.testUrl}}{{pipeline.project.testPagePath}}');
  await page.waitForLoadState('networkidle');
  
  // DOM assertions
  const el = await page.$('{{pipeline.testing.domSelectors.mainContainer}}');
  if (!el) { console.error('FAIL: Main container not found'); process.exit(1); }
  
  console.log('OK: Page loaded successfully');
  await browser.close();
})().catch(e => { console.error('FAIL:', e.message); process.exit(1); });

Step 3: Execute

node {{pipeline.paths.tests}}smoke-test.cjs

Step 4: Report

Report test results: pass count / fail count, failed item screenshots and reasons.

Dependencies

npm install playwright
npx playwright install chromium
# OCR (optional)
npm install tesseract.js sharp

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.