From e758c0ab846cfadd8d5d2a4e72e324b0d465ac4b Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sat, 29 Nov 2025 18:17:04 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 13 + README.md | 3 + plugin.lock.json | 252 ++++++++ skills/playwright-e2e-automation/CHANGELOG.md | 22 + skills/playwright-e2e-automation/README.md | 387 ++++++++++++ skills/playwright-e2e-automation/SKILL.md | 141 +++++ .../data/accessibility-checks.md | 414 ++++++++++++ .../data/common-ui-bugs.md | 557 ++++++++++++++++ .../data/error-patterns.yaml | 415 ++++++++++++ .../data/framework-detection-patterns.yaml | 430 +++++++++++++ .../data/framework-versions.yaml | 303 +++++++++ .../data/playwright-best-practices.md | 456 ++++++++++++++ .../react-vite/example-page-object.ts | 91 +++ .../examples/react-vite/example-test.spec.ts | 149 +++++ .../reports/fix-recommendations.example.md | 592 ++++++++++++++++++ .../reports/visual-analysis-report.example.md | 266 ++++++++ .../reference/ci-cd-integration.md | 134 ++++ .../reference/troubleshooting.md | 186 ++++++ .../scripts/README.md | 294 +++++++++ .../templates/configs/postcss-tailwind-v3.js | 16 + .../templates/configs/postcss-tailwind-v4.js | 24 + .../templates/css/tailwind-v3.css | 20 + .../templates/css/tailwind-v4.css | 38 ++ .../templates/css/vanilla.css | 171 +++++ .../templates/global-setup.template.ts | 127 ++++ .../templates/global-teardown.template.ts | 64 ++ .../templates/page-object.template.ts | 84 +++ .../templates/playwright.config.template.ts | 139 ++++ .../templates/screenshot-helper.template.ts | 236 +++++++ .../templates/test-spec.template.ts | 120 ++++ .../workflow/phase-1-discovery.md | 72 +++ .../workflow/phase-2-setup.md | 72 +++ .../workflow/phase-2.5-preflight.md | 113 ++++ .../workflow/phase-3-generation.md | 68 ++ .../workflow/phase-4-capture.md | 65 ++ .../workflow/phase-5-analysis.md | 67 ++ .../workflow/phase-6-regression.md | 77 +++ .../workflow/phase-7-fixes.md | 72 +++ .../workflow/phase-8-export.md | 82 +++ skills/tdd-automation/CHANGELOG.md | 14 + skills/tdd-automation/README.md | 340 ++++++++++ skills/tdd-automation/SKILL.md | 235 +++++++ skills/tdd-automation/examples/.gitkeep | 0 skills/tdd-automation/index.js | 417 ++++++++++++ skills/tdd-automation/reference/.gitkeep | 0 .../tdd-automation/scripts/generate-test.js | 198 ++++++ .../scripts/remove-tdd-section.js | 125 ++++ skills/tdd-automation/scripts/rollback-tdd.js | 141 +++++ skills/tdd-automation/scripts/validate-tdd.js | 300 +++++++++ skills/tdd-automation/templates/pre-commit.sh | 110 ++++ .../templates/tdd-auto-enforcer.sh | 78 +++ .../utils/detect-project-type.js | 163 +++++ skills/tdd-automation/utils/install-hooks.js | 305 +++++++++ .../tdd-automation/utils/merge-claude-md.js | 286 +++++++++ .../utils/update-package-json.js | 186 ++++++ .../utils/validate-claude-md.js | 267 ++++++++ 56 files changed, 9997 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 plugin.lock.json create mode 100644 skills/playwright-e2e-automation/CHANGELOG.md create mode 100644 skills/playwright-e2e-automation/README.md create mode 100644 skills/playwright-e2e-automation/SKILL.md create mode 100644 skills/playwright-e2e-automation/data/accessibility-checks.md create mode 100644 skills/playwright-e2e-automation/data/common-ui-bugs.md create mode 100644 skills/playwright-e2e-automation/data/error-patterns.yaml create mode 100644 skills/playwright-e2e-automation/data/framework-detection-patterns.yaml create mode 100644 skills/playwright-e2e-automation/data/framework-versions.yaml create mode 100644 skills/playwright-e2e-automation/data/playwright-best-practices.md create mode 100644 skills/playwright-e2e-automation/examples/react-vite/example-page-object.ts create mode 100644 skills/playwright-e2e-automation/examples/react-vite/example-test.spec.ts create mode 100644 skills/playwright-e2e-automation/examples/reports/fix-recommendations.example.md create mode 100644 skills/playwright-e2e-automation/examples/reports/visual-analysis-report.example.md create mode 100644 skills/playwright-e2e-automation/reference/ci-cd-integration.md create mode 100644 skills/playwright-e2e-automation/reference/troubleshooting.md create mode 100644 skills/playwright-e2e-automation/scripts/README.md create mode 100644 skills/playwright-e2e-automation/templates/configs/postcss-tailwind-v3.js create mode 100644 skills/playwright-e2e-automation/templates/configs/postcss-tailwind-v4.js create mode 100644 skills/playwright-e2e-automation/templates/css/tailwind-v3.css create mode 100644 skills/playwright-e2e-automation/templates/css/tailwind-v4.css create mode 100644 skills/playwright-e2e-automation/templates/css/vanilla.css create mode 100644 skills/playwright-e2e-automation/templates/global-setup.template.ts create mode 100644 skills/playwright-e2e-automation/templates/global-teardown.template.ts create mode 100644 skills/playwright-e2e-automation/templates/page-object.template.ts create mode 100644 skills/playwright-e2e-automation/templates/playwright.config.template.ts create mode 100644 skills/playwright-e2e-automation/templates/screenshot-helper.template.ts create mode 100644 skills/playwright-e2e-automation/templates/test-spec.template.ts create mode 100644 skills/playwright-e2e-automation/workflow/phase-1-discovery.md create mode 100644 skills/playwright-e2e-automation/workflow/phase-2-setup.md create mode 100644 skills/playwright-e2e-automation/workflow/phase-2.5-preflight.md create mode 100644 skills/playwright-e2e-automation/workflow/phase-3-generation.md create mode 100644 skills/playwright-e2e-automation/workflow/phase-4-capture.md create mode 100644 skills/playwright-e2e-automation/workflow/phase-5-analysis.md create mode 100644 skills/playwright-e2e-automation/workflow/phase-6-regression.md create mode 100644 skills/playwright-e2e-automation/workflow/phase-7-fixes.md create mode 100644 skills/playwright-e2e-automation/workflow/phase-8-export.md create mode 100644 skills/tdd-automation/CHANGELOG.md create mode 100644 skills/tdd-automation/README.md create mode 100644 skills/tdd-automation/SKILL.md create mode 100644 skills/tdd-automation/examples/.gitkeep create mode 100755 skills/tdd-automation/index.js create mode 100644 skills/tdd-automation/reference/.gitkeep create mode 100755 skills/tdd-automation/scripts/generate-test.js create mode 100755 skills/tdd-automation/scripts/remove-tdd-section.js create mode 100755 skills/tdd-automation/scripts/rollback-tdd.js create mode 100755 skills/tdd-automation/scripts/validate-tdd.js create mode 100755 skills/tdd-automation/templates/pre-commit.sh create mode 100755 skills/tdd-automation/templates/tdd-auto-enforcer.sh create mode 100644 skills/tdd-automation/utils/detect-project-type.js create mode 100644 skills/tdd-automation/utils/install-hooks.js create mode 100644 skills/tdd-automation/utils/merge-claude-md.js create mode 100644 skills/tdd-automation/utils/update-package-json.js create mode 100644 skills/tdd-automation/utils/validate-claude-md.js diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..ac8fe84 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,13 @@ +{ + "name": "testing-tools", + "description": "Automated testing frameworks and quality assurance tooling", + "version": "0.0.0-2025.11.28", + "author": { + "name": "Connor", + "email": "noreply@claudex.dev" + }, + "skills": [ + "./skills/playwright-e2e-automation", + "./skills/tdd-automation" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3ce95bf --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# testing-tools + +Automated testing frameworks and quality assurance tooling diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..bcc787d --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,252 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:cskiro/claudex:testing-tools", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "59d8d5a9413c2b77bbff9e4b086c829e43d7bc58", + "treeHash": "2dc0bfaee4f19cf1c633db815c08c030f987af6ed843b3fcbeac2f41ab17f9bb", + "generatedAt": "2025-11-28T10:15:53.396710Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "testing-tools", + "description": "Automated testing frameworks and quality assurance tooling" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "f57fbeb0403191907d95002e4d253b110e9b19a0719ab9ee636cca7c7df18f89" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "6565f6863caa8227078ea99c283e13cad386601dc40d25b128d34b8ccb147090" + }, + { + "path": "skills/tdd-automation/CHANGELOG.md", + "sha256": "d9f9efe4427863d22a2d03411ff895c0fac387d4fd45c56f726f23bf8a3b07b6" + }, + { + "path": "skills/tdd-automation/index.js", + "sha256": "90c4a1bbf4160ba42bb48817db81d772bd95fad38d00c5ca9ac30e63e5946f68" + }, + { + "path": "skills/tdd-automation/README.md", + "sha256": "cb63dad5b043467be51b1378fd656de13e6a79e48e64e8364df1d4d88f2ab84f" + }, + { + "path": "skills/tdd-automation/SKILL.md", + "sha256": "00939e4fd5d00c2ee7a25e707c70261dd770736c26fa77e122cb7f2de3b4e424" + }, + { + "path": "skills/tdd-automation/utils/merge-claude-md.js", + "sha256": "38c6ce20de4b25bc907bbfaf56b880f9b5929f52abca2ebb97fc9970945d8070" + }, + { + "path": "skills/tdd-automation/utils/update-package-json.js", + "sha256": "6446f58996930956eefb6ff0c22524e0a3a57d7c514c6327b0cd6843c53b3ea8" + }, + { + "path": "skills/tdd-automation/utils/detect-project-type.js", + "sha256": "24ef9590db105fc12142403b991c1115cf1c4e8e38da85d5c1ab961dbaf3b42b" + }, + { + "path": "skills/tdd-automation/utils/install-hooks.js", + "sha256": "25c2bfa2aa5fe0949a2c6617960913901291c4ae0e207e736a89d8ab796d941d" + }, + { + "path": "skills/tdd-automation/utils/validate-claude-md.js", + "sha256": "60d4189b8ac6de073cda7d03530f1afb7663551ea901121bfcee999102045aba" + }, + { + "path": "skills/tdd-automation/examples/.gitkeep", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "path": "skills/tdd-automation/scripts/remove-tdd-section.js", + "sha256": "e4a36075b01e97e4e792ae59275571112cf29f2222f292dfa60ea21a48bb4fc8" + }, + { + "path": "skills/tdd-automation/scripts/validate-tdd.js", + "sha256": "1c32502fbbb283d3bd4d22a02a06e0c2ccc3711e0ed3265aa872043cb4bdfe8b" + }, + { + "path": "skills/tdd-automation/scripts/generate-test.js", + "sha256": "2192171feb30235713e2d47a41b207e5ee3e333d61fda0235dcb1957def0aa0b" + }, + { + "path": "skills/tdd-automation/scripts/rollback-tdd.js", + "sha256": "ebb1cb0ffc8d7e7b6051b6c7ab2119c0452edf7632f5b6429559991daf12f0d4" + }, + { + "path": "skills/tdd-automation/templates/pre-commit.sh", + "sha256": "74f425ce3746e6e3689dee79c12a576bf655edcd056849027c5ba82a1ab1ce0a" + }, + { + "path": "skills/tdd-automation/templates/tdd-auto-enforcer.sh", + "sha256": "23771c535d8f973104a98376d326147e3253bf96d2c3edb089d3c10959982761" + }, + { + "path": "skills/tdd-automation/reference/.gitkeep", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "path": "skills/playwright-e2e-automation/CHANGELOG.md", + "sha256": "de35c47ba531aeffdc0ec4e31ee6ab24404cdc6cc73095df922a64a2ab1aa6c0" + }, + { + "path": "skills/playwright-e2e-automation/README.md", + "sha256": "5c4ce8a2a3c30a75926dd9df3990ff6a892b35bccd28ea6a884e301589b5e53e" + }, + { + "path": "skills/playwright-e2e-automation/SKILL.md", + "sha256": "95c51cd493687b67af40094614a07c09265e588b3ad334224f366b36b066dc75" + }, + { + "path": "skills/playwright-e2e-automation/examples/react-vite/example-test.spec.ts", + "sha256": "8c394a3bc1e4822153e9423b3d6b155981c7105a4354cee6368426ac63d8b24e" + }, + { + "path": "skills/playwright-e2e-automation/examples/react-vite/example-page-object.ts", + "sha256": "2fa7ca1a5b2e4030819d54663d4fbe644ac693ec3e8af6fee52961f585c89415" + }, + { + "path": "skills/playwright-e2e-automation/examples/reports/fix-recommendations.example.md", + "sha256": "58858f2209acd03cf96b01e6a8cee51f4e63a3738380aea0d73743c09feb7221" + }, + { + "path": "skills/playwright-e2e-automation/examples/reports/visual-analysis-report.example.md", + "sha256": "2d6ae998818c0b7711355753dc4edecb2dda80c5077d9764f6acf3acf0bb787d" + }, + { + "path": "skills/playwright-e2e-automation/workflow/phase-2-setup.md", + "sha256": "e26132ccd86c5f033dbc9babeeccc10362cae5d000dccd36117a590b44a26c2f" + }, + { + "path": "skills/playwright-e2e-automation/workflow/phase-8-export.md", + "sha256": "2c195085edb931dfe77e885b7a7797618b00a288cbd37337da85486a30512e1a" + }, + { + "path": "skills/playwright-e2e-automation/workflow/phase-6-regression.md", + "sha256": "b593116efded3aa9627d67c2d75f5a0f023df15b55214fbb188a67d278d25065" + }, + { + "path": "skills/playwright-e2e-automation/workflow/phase-7-fixes.md", + "sha256": "70d28e5a594739f8be69f8fc4ec2db6ada3ffebf26a399d1eb2bbea55cd8943d" + }, + { + "path": "skills/playwright-e2e-automation/workflow/phase-2.5-preflight.md", + "sha256": "4393f5fbf4d43c5a7dcce5708a4a294bd2687aecabd8fc7b195d0a95c36f0b79" + }, + { + "path": "skills/playwright-e2e-automation/workflow/phase-4-capture.md", + "sha256": "b70c817f68be0084e124f5cd25adec226e5bc17e082847c93e6dc3a3ae688497" + }, + { + "path": "skills/playwright-e2e-automation/workflow/phase-1-discovery.md", + "sha256": "2f118396ca808b57327fee8314a73f415ce821304f2d3bcacdc48f549984d400" + }, + { + "path": "skills/playwright-e2e-automation/workflow/phase-3-generation.md", + "sha256": "df8bc6957d137d07203d2159279386fadaec29fbc0b04e36b34e31de0e33df26" + }, + { + "path": "skills/playwright-e2e-automation/workflow/phase-5-analysis.md", + "sha256": "8ac791730d996918cb85b314003daaedee13b923844d54db9d786382f2303eeb" + }, + { + "path": "skills/playwright-e2e-automation/scripts/README.md", + "sha256": "94e9b2dfe339d6a2bd2efd4b752d87f3f1aa5ed8172e274bdf0eaa110c5c7026" + }, + { + "path": "skills/playwright-e2e-automation/templates/playwright.config.template.ts", + "sha256": "368e5e4449eecbe589f1a39b4c174f62a67e3f194544f2a88befb87fcb38e455" + }, + { + "path": "skills/playwright-e2e-automation/templates/test-spec.template.ts", + "sha256": "5ef5857248eb2d701d7d9cc504db0edff0285ed16062c2f742a180e030cf9746" + }, + { + "path": "skills/playwright-e2e-automation/templates/global-setup.template.ts", + "sha256": "1cf33e734671f33b127502bb5dea3bb97098a4e8625713e3e4d7a342a5ece75c" + }, + { + "path": "skills/playwright-e2e-automation/templates/global-teardown.template.ts", + "sha256": "f46fe5a8912bb7f657d0f8e8b2126b2404abdbd881c4ed54b6d2b8c19461d80f" + }, + { + "path": "skills/playwright-e2e-automation/templates/page-object.template.ts", + "sha256": "e0b67e6841818823a335cbff71eec1c8c61e301fa07dd4fa7d162836b19178f4" + }, + { + "path": "skills/playwright-e2e-automation/templates/screenshot-helper.template.ts", + "sha256": "34803983e5a29aa26e34bcf81eeddac634cf415fbec049645a897930c5d921d8" + }, + { + "path": "skills/playwright-e2e-automation/templates/css/vanilla.css", + "sha256": "b2168b3de50640e7f705e19d54f414d2d6d8a85f1bf38017eec5036e24785f78" + }, + { + "path": "skills/playwright-e2e-automation/templates/css/tailwind-v3.css", + "sha256": "8afe45f5f6ab2a62dd106cc385aae7376c9a875450f3b0599f7a9044f8b81b98" + }, + { + "path": "skills/playwright-e2e-automation/templates/css/tailwind-v4.css", + "sha256": "f06f1da8a4dcebafb41ab576d4ed9658f96c8a70791ae7e92cbe3f53b1962a93" + }, + { + "path": "skills/playwright-e2e-automation/templates/configs/postcss-tailwind-v3.js", + "sha256": "dd28449f67a88d120997e27864b6a1ca6277dc23e3f0fbefeee9b3ad2e068b9b" + }, + { + "path": "skills/playwright-e2e-automation/templates/configs/postcss-tailwind-v4.js", + "sha256": "0cb3d2cb69c8f4020e5f06f9763185d4be38b05ddc92c05d10746ea738e644e3" + }, + { + "path": "skills/playwright-e2e-automation/data/playwright-best-practices.md", + "sha256": "ab54c39d74de70e77b06f8a226a19283266a26850972e5eea8a30e1dd699d837" + }, + { + "path": "skills/playwright-e2e-automation/data/framework-detection-patterns.yaml", + "sha256": "c743ddeb7724ba4e5f938c361831d9859f86ed5d134b055b558204b6c09fd434" + }, + { + "path": "skills/playwright-e2e-automation/data/error-patterns.yaml", + "sha256": "85805085b6cd51dc3bf1884c52ef9707090530199d851a1190a05d61e6b07e7b" + }, + { + "path": "skills/playwright-e2e-automation/data/accessibility-checks.md", + "sha256": "967bd933ee183026ea27dcd9164d3ea00c21991e4ae8ad560ac6b569cd151c89" + }, + { + "path": "skills/playwright-e2e-automation/data/common-ui-bugs.md", + "sha256": "ccb66a51d6e1a7c5182e92a0a19634178bcbe2ee733f939f0399e91be48b5334" + }, + { + "path": "skills/playwright-e2e-automation/data/framework-versions.yaml", + "sha256": "abf39a2a28fbcd43e0d9675ec5d4dbab32328ce1d3ae8aaa2c268a4ea2fe3fa6" + }, + { + "path": "skills/playwright-e2e-automation/reference/ci-cd-integration.md", + "sha256": "7cbe26dada1adb3502c2a43fd3fe7924edf3671c5ef14f39aa17e1b53b602160" + }, + { + "path": "skills/playwright-e2e-automation/reference/troubleshooting.md", + "sha256": "d2e2e7cfdfbf9dd9feec023829aa693b0e4305ee7b03c5f930d2bb1e0340de50" + } + ], + "dirSha256": "2dc0bfaee4f19cf1c633db815c08c030f987af6ed843b3fcbeac2f41ab17f9bb" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/playwright-e2e-automation/CHANGELOG.md b/skills/playwright-e2e-automation/CHANGELOG.md new file mode 100644 index 0000000..d5189a7 --- /dev/null +++ b/skills/playwright-e2e-automation/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +## 0.3.0 + +- Refactored to Anthropic progressive disclosure pattern +- Updated description with "Use PROACTIVELY when..." format +- Removed version/author/category/tags from frontmatter + +## 0.2.0 + +- Added framework version detection (Tailwind v3/v4, React 17-19, Next.js 13-14) +- Added pre-flight health check (Phase 2.5) +- Added error pattern recovery database +- Fixed Tailwind CSS v4 compatibility + +## 0.1.0 + +- Initial release with zero-setup Playwright automation +- Multi-framework support: React/Vite, Next.js, Node.js, static +- LLM-powered visual analysis for UI bug detection +- Visual regression testing with baseline comparison +- Fix recommendations with file:line references diff --git a/skills/playwright-e2e-automation/README.md b/skills/playwright-e2e-automation/README.md new file mode 100644 index 0000000..f847f64 --- /dev/null +++ b/skills/playwright-e2e-automation/README.md @@ -0,0 +1,387 @@ +# Playwright E2E Automation + +> Automated Playwright e2e testing framework with LLM-powered visual debugging, screenshot analysis, and regression testing + +## Quick Start + +### Trigger Phrases + +Simply ask Claude Code: + +``` +"set up playwright testing for my app" +"help me debug UI issues with screenshots" +"create e2e tests with visual regression" +"analyze my app's UI with screenshots" +``` + +### What Happens + +This skill will automatically: + +1. **Detect your application** - Identifies React/Vite, Node.js, static sites, or full-stack apps +2. **Detect framework versions** (NEW) - Determines Tailwind v3 vs v4, React version, etc. +3. **Pre-flight validation** (NEW) - Checks app loads before running tests, catches config errors early +4. **Install Playwright** - Runs `npm init playwright@latest` with optimal configuration +5. **Generate test suite** - Creates screenshot-enabled tests with version-appropriate templates +6. **Capture screenshots** - Takes full-page screenshots at key interaction points +7. **Analyze visually** - Uses LLM vision to identify UI bugs, layout issues, accessibility problems +8. **Detect regressions** - Compares against baselines to find unexpected visual changes +9. **Generate fixes** - Produces actionable code recommendations with file:line references +10. **Export test suite** - Provides production-ready tests you can run independently + +**Total time**: ~5-8 minutes (one-time setup) +**New in v0.2.0**: Version detection and pre-flight validation prevent configuration errors + +## Features + +### Zero-Setup Automation + +No configuration required. The skill: + +- Detects your framework automatically (React, Vite, Next.js, Express, etc.) +- Installs Playwright and browsers without prompts +- Generates optimal configuration based on your app type +- Creates tests following best practices +- Runs everything end-to-end + +### Multi-Framework Support + +Works with: + +- **React/Vite** - Modern React apps with Vite dev server +- **Next.js** - Server-side rendered React applications +- **Node.js/Express** - Backend services with HTML responses +- **Static HTML/CSS/JS** - Traditional web applications +- **Full-stack** - Combined frontend + backend applications + +### Version-Aware Configuration (NEW in v0.2.0) + +The skill now detects installed framework versions and adapts automatically: + +**Tailwind CSS**: +- **v3.x**: Uses `@tailwind base; @tailwind components; @tailwind utilities;` syntax +- **v4.x**: Uses `@import "tailwindcss";` syntax and `@tailwindcss/postcss` plugin + +**React**: +- **v17**: Classic JSX transform (requires React import) +- **v18+**: Automatic JSX transform (no import needed) + +**Detection Process**: +1. Reads `package.json` dependencies +2. Matches versions against compatibility database +3. Selects appropriate templates (CSS, PostCSS config, etc.) +4. Warns about breaking changes or unknown versions + +**Pre-flight Validation**: +- Loads app in browser before running tests +- Monitors console for critical errors +- Matches errors against known patterns (Tailwind v4 syntax, PostCSS plugin, etc.) +- Provides specific fix steps with file:line references +- **Prevents cascade failures**: One config error won't fail all 10 tests + +**Example Error Detection**: +``` +❌ Pre-flight check failed: Tailwind CSS v4 syntax mismatch + +Root cause: CSS file uses @tailwind directives but v4 requires @import + +Fix: +1. Update src/index.css: + Change from: @tailwind base; @tailwind components; @tailwind utilities; + Change to: @import "tailwindcss"; + +2. Update postcss.config.js: + Change from: plugins: { tailwindcss: {} } + Change to: plugins: { '@tailwindcss/postcss': {} } + +3. Restart dev server: npm run dev +``` + +### LLM-Powered Visual Analysis + +Automatically identifies: + +- **UI Bugs** - Broken layouts, overlapping elements, cut-off text +- **Accessibility Issues** - Color contrast, missing labels, improper heading hierarchy +- **Responsive Problems** - Elements not scaling, overflow on mobile +- **Visual Regressions** - Unexpected changes from baseline screenshots +- **Missing Elements** - Expected UI components not rendered + +### Actionable Fix Recommendations + +Generates specific fixes with: + +- File paths and line numbers (`src/components/Button.tsx:45`) +- Current code snippets showing the issue +- Recommended code changes +- Explanation of why the fix works +- Priority level (critical, high, medium, low) + +### Production-Ready Test Suite + +Exports include: + +- Organized test files following best practices +- Page object models for maintainability +- Screenshot helpers and utilities +- npm scripts for test execution +- README with usage instructions +- CI/CD integration examples + +## Usage Examples + +### Example 1: Initial Setup for React App + +``` +User: "Set up Playwright testing for my Vite React app" + +Claude (via skill): +✅ Detected React + Vite application +✅ Installing Playwright... +✅ Generated playwright.config.ts with base URL http://localhost:5173 +✅ Created 5 test specs covering critical journeys +✅ Captured 23 screenshots across desktop, tablet, mobile viewports +✅ Visual analysis complete: Found 3 issues (1 high, 2 medium) +✅ Generated fix recommendations in fix-recommendations.md +✅ Test suite exported to tests/e2e/ + +Next steps: +- Review fix-recommendations.md +- Run tests: npm run test:e2e +- Update baselines after fixes: npm run test:e2e:update-snapshots +``` + +### Example 2: Visual Regression Detection + +``` +User: "Check for visual regressions after my recent changes" + +Claude (via skill): +✅ Running existing Playwright test suite... +✅ Captured 23 screenshots +✅ Comparing against baselines... + +⚠️ Found 4 visual changes: + - Home page hero section: Layout shift detected (12% difference) + - Navigation menu: New dropdown added (expected change) + - Contact form: Button text color changed (2% difference) + - Footer: Logo size increased (5% difference) + +📊 Visual regression report: screenshots/diffs/report.html + +Would you like to: +1. Accept these changes as new baseline +2. Review specific diffs +3. Get fix recommendations for unintended changes +``` + +### Example 3: Bug Investigation + +``` +User: "Users report the checkout button is cut off on mobile" + +Claude (via skill): +✅ Generating mobile viewport test... +✅ Captured screenshot: screenshots/current/checkout-mobile.png +✅ Visual analysis complete + +🐛 Issue confirmed: Button text truncated on 375px viewport + +Location: src/components/CheckoutButton.tsx:28 + +Current code: +```tsx + +``` + +Recommended fix: +```tsx + +``` + +Reasoning: Fixed padding and font size cause overflow on narrow screens. +Added responsive sizing and max-width constraint. + +Test added: tests/e2e/checkout-responsive.spec.ts +``` + +## What Gets Generated + +After running this skill, you'll have: + +``` +your-project/ +├── playwright.config.ts # Playwright configuration +├── tests/ +│ └── e2e/ +│ ├── setup/ +│ │ └── global-setup.ts # Dev server startup +│ ├── pages/ +│ │ └── *.page.ts # Page object models +│ ├── specs/ +│ │ └── *.spec.ts # Test specifications +│ └── utils/ +│ └── screenshot-helper.ts +├── screenshots/ +│ ├── baselines/ # Reference images +│ ├── current/ # Latest run +│ └── diffs/ # Visual comparisons +├── fix-recommendations.md # Generated fix suggestions +├── visual-analysis-report.md # LLM analysis results +└── package.json # Updated with test scripts +``` + +## Performance + +**Typical execution time** (React app with 5 critical journeys): + +- Application detection: ~5 seconds +- Playwright installation: ~2-3 minutes (one-time) +- Test generation: ~30 seconds +- Test execution: ~30-60 seconds +- Visual analysis: ~1-2 minutes +- Regression comparison: ~10 seconds +- Fix generation: ~30 seconds + +**Total**: ~5-8 minutes (excluding one-time Playwright install) + +## CI/CD Integration + +### GitHub Actions + +The skill generates GitHub Actions workflow examples. Basic setup: + +```yaml +name: Playwright E2E Tests + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + - run: npm ci + - run: npx playwright install --with-deps + - run: npm run test:e2e + - uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-screenshots + path: screenshots/ +``` + +### Baseline Management + +**In CI**: +- Store baselines in repository: `git add screenshots/baselines/` +- Tests fail if visual diffs exceed threshold +- Review artifacts before merging + +**Locally**: +- Update baselines: `npm run test:e2e:update-snapshots` +- Commit updated baselines after review + +## Advanced Usage + +### Custom Test Generation + +After initial setup, you can: + +1. **Add more tests** - Follow the pattern in generated specs +2. **Customize viewports** - Edit playwright.config.ts +3. **Add custom assertions** - Extend screenshot helpers +4. **Configure browsers** - Enable Firefox/WebKit in config +5. **Adjust thresholds** - Modify visual diff sensitivity + +### Visual Analysis Customization + +The skill's analysis focuses on: + +- WCAG 2.1 AA accessibility compliance (see `data/accessibility-checks.md`) +- Common UI bug patterns (see `data/common-ui-bugs.md`) +- Framework-specific best practices + +### Integration with Existing Tests + +This skill complements your existing test suite: + +- **Unit tests** (Vitest/Jest) - Test logic and calculations +- **Integration tests** - Test component interaction +- **E2E tests** (Playwright) - Test full user workflows + visual regression + +All three work together without conflicts. + +## Troubleshooting + +### "Application not detected" + +**Solution**: Specify manually +``` +"Set up Playwright for my [framework] app running on port [port]" +``` + +### "Dev server not running" + +**Solution**: The skill will attempt to start it automatically. If that fails: +```bash +npm run dev # Start your dev server first +``` +Then re-run the skill. + +### "Screenshot capture timeout" + +**Solution**: Increase timeout in playwright.config.ts: +```typescript +timeout: 60000, // 60 seconds instead of default 30 +``` + +### "Visual analysis found too many false positives" + +**Solution**: Adjust the visual diff threshold: +```typescript +expect(await page.screenshot()).toMatchSnapshot({ + maxDiffPixelRatio: 0.05, // Allow 5% difference +}); +``` + +## Requirements + +- **Node.js**: >=16.0.0 +- **npm**: >=7.0.0 +- **Disk space**: ~500MB for Playwright browsers (one-time) +- **Memory**: ~500MB during test execution + +## Best Practices + +1. **Baseline management** - Commit baselines to git, update deliberately +2. **Screenshot organization** - Use .gitignore for current/diffs, keep baselines +3. **Test critical paths** - Focus on user journeys that matter (80/20 rule) +4. **Run in CI** - Catch regressions before production +5. **Review diffs carefully** - Not all changes are bugs +6. **Use semantic selectors** - Prefer getByRole over CSS selectors +7. **Capture context** - Take screenshots before AND after interactions + +## Learn More + +- [Playwright Documentation](https://playwright.dev/) +- [Visual Regression Testing Guide](https://playwright.dev/docs/test-snapshots) +- [Accessibility Testing](https://playwright.dev/docs/accessibility-testing) +- [CI/CD Integration](https://playwright.dev/docs/ci) + +## Support + +Issues with this skill? Please report at: +- [Claude Code Issues](https://github.com/anthropics/claude-code/issues) + +--- + +**Created with**: skill-creator v0.1.0 +**Skill Version**: 0.1.0 +**Last Updated**: 2025-11-01 diff --git a/skills/playwright-e2e-automation/SKILL.md b/skills/playwright-e2e-automation/SKILL.md new file mode 100644 index 0000000..085ee59 --- /dev/null +++ b/skills/playwright-e2e-automation/SKILL.md @@ -0,0 +1,141 @@ +--- +name: playwright-e2e-automation +description: Use PROACTIVELY when setting up e2e testing, debugging UI issues, or creating regression test suites. Automated Playwright framework with LLM-powered visual analysis, screenshot capture, and fix recommendations with file:line references. Zero-setup for React/Vite, Node.js, static sites, and full-stack applications. Not for unit testing, API-only testing, or mobile native apps. +--- + +# Playwright E2E Automation + +## Overview + +This skill automates the complete Playwright e2e testing lifecycle with LLM-powered visual debugging. It detects your app type, installs Playwright, generates tests, captures screenshots, analyzes for UI bugs, and produces fix recommendations with file paths and line numbers. + +**Key Capabilities**: +- Zero-setup automation with multi-framework support +- Visual debugging with screenshot capture and LLM analysis +- Regression testing with baseline comparison +- Actionable fix recommendations with file:line references +- CI/CD ready test suite export + +## When to Use This Skill + +**Trigger Phrases**: +- "set up playwright testing for my app" +- "help me debug UI issues with screenshots" +- "create e2e tests with visual regression" +- "analyze my app's UI with screenshots" +- "generate playwright tests for [my app]" + +**Use Cases**: +- Setting up Playwright testing from scratch +- Debugging visual/UI bugs hard to describe in text +- Creating screenshot-based regression testing +- Generating e2e test suites for new applications +- Identifying accessibility issues through visual inspection + +**NOT for**: +- Unit testing or component testing (use Vitest/Jest) +- API-only testing without UI +- Performance/load testing +- Mobile native app testing (use Detox/Appium) + +## Response Style + +- **Automated**: Execute entire workflow with minimal user intervention +- **Informative**: Clear progress updates at each phase +- **Visual**: Always capture and analyze screenshots +- **Actionable**: Generate specific fixes with file paths and line numbers + +## Quick Decision Matrix + +| User Request | Action | Reference | +|--------------|--------|-----------| +| "set up playwright" | Full setup workflow | `workflow/phase-1-discovery.md` → `phase-2-setup.md` | +| "debug UI issues" | Capture + Analyze | `workflow/phase-4-capture.md` → `phase-5-analysis.md` | +| "check for regressions" | Compare baselines | `workflow/phase-6-regression.md` | +| "generate fix recommendations" | Analyze + Generate | `workflow/phase-7-fixes.md` | +| "export test suite" | Package for CI/CD | `workflow/phase-8-export.md` | + +## Workflow Overview + +### Phase 1: Application Discovery +Detect app type, framework versions, and optimal configuration. +→ **Details**: `workflow/phase-1-discovery.md` + +### Phase 2: Playwright Setup +Install Playwright and generate configuration. +→ **Details**: `workflow/phase-2-setup.md` + +### Phase 2.5: Pre-flight Health Check +Validate app loads correctly before full test suite. +→ **Details**: `workflow/phase-2.5-preflight.md` + +### Phase 3: Test Generation +Create screenshot-enabled tests for critical workflows. +→ **Details**: `workflow/phase-3-generation.md` + +### Phase 4: Screenshot Capture +Run tests and capture visual data. +→ **Details**: `workflow/phase-4-capture.md` + +### Phase 5: Visual Analysis +LLM-powered analysis to identify UI bugs. +→ **Details**: `workflow/phase-5-analysis.md` + +### Phase 6: Regression Detection +Compare screenshots against baselines. +→ **Details**: `workflow/phase-6-regression.md` + +### Phase 7: Fix Generation +Map issues to source code with actionable fixes. +→ **Details**: `workflow/phase-7-fixes.md` + +### Phase 8: Test Suite Export +Package production-ready test suite. +→ **Details**: `workflow/phase-8-export.md` + +## Important Reminders + +1. **Capture before AND after interactions** - Provides context for visual debugging +2. **Use semantic selectors** - Prefer getByRole, getByLabel over CSS selectors +3. **Baseline management is critical** - Keep in sync with intentional UI changes +4. **LLM analysis is supplementary** - Use alongside automated assertions +5. **Test critical paths first** - Focus on user journeys that matter most (80/20 rule) +6. **Screenshots are large** - Consider .gitignore for screenshots/, use CI artifacts +7. **Run tests in CI** - Catch visual regressions before production +8. **Update baselines deliberately** - Review diffs carefully before accepting + +## Limitations + +- Requires Node.js >= 16 +- Browser download needs ~500MB disk space +- Screenshot comparison requires consistent rendering (may vary across OS) +- LLM analysis adds ~5-10 seconds per screenshot +- Not suitable for testing behind VPNs without additional configuration + +## Reference Materials + +| Resource | Purpose | +|----------|---------| +| `workflow/*.md` | Detailed phase instructions | +| `reference/troubleshooting.md` | Common issues and fixes | +| `reference/ci-cd-integration.md` | GitHub Actions, GitLab CI examples | +| `data/framework-versions.yaml` | Version compatibility database | +| `data/error-patterns.yaml` | Known error patterns with recovery | +| `templates/` | Config and test templates | +| `examples/` | Sample setups for different frameworks | + +## Success Criteria + +- [ ] Playwright installed with browsers +- [ ] Configuration generated for app type +- [ ] Test suite created (3-5 critical journey tests) +- [ ] Screenshots captured and organized +- [ ] Visual analysis completed with issue categorization +- [ ] Regression comparison performed +- [ ] Fix recommendations generated +- [ ] Test suite exported with documentation +- [ ] All tests executable via `npm run test:e2e` + +--- + +**Total time**: ~5-8 minutes (excluding one-time Playwright install) diff --git a/skills/playwright-e2e-automation/data/accessibility-checks.md b/skills/playwright-e2e-automation/data/accessibility-checks.md new file mode 100644 index 0000000..ef348c1 --- /dev/null +++ b/skills/playwright-e2e-automation/data/accessibility-checks.md @@ -0,0 +1,414 @@ +# Accessibility Checks for Visual Analysis + +WCAG 2.1 AA compliance criteria for LLM-powered screenshot analysis. + +## Overview + +When analyzing screenshots, check for these accessibility violations. This guide follows WCAG 2.1 Level AA standards. + +## 1. Color Contrast + +### Minimum Contrast Ratios + +**Text:** +- Normal text (< 18pt or < 14pt bold): **4.5:1** +- Large text (≥ 18pt or ≥ 14pt bold): **3:1** + +**UI Components:** +- Form inputs, buttons, icons: **3:1** against background + +### Common Violations in Screenshots + +``` +❌ Light gray text on white background (2:1 ratio) +✅ Dark gray #595959 on white #FFFFFF (7:1 ratio) + +❌ Blue link #4A90E2 on light blue #E8F4FF (1.8:1 ratio) +✅ Blue link #0066CC on white #FFFFFF (8.2:1 ratio) + +❌ Gray placeholder text #CCCCCC on white (1.6:1 ratio) +✅ Gray placeholder text #757575 on white (4.6:1 ratio) +``` + +### Visual Indicators + +When analyzing screenshots, look for: +- Pale or faded text that's hard to read +- Low-contrast buttons that don't stand out +- Links that blend into surrounding text +- Disabled states that are barely distinguishable + +## 2. Text Size and Readability + +### Minimum Font Sizes + +- Body text: **16px** minimum (1rem) +- Small text acceptable: **14px** for secondary content +- Avoid: Text smaller than **12px** (fails WCAG) + +### Common Violations + +``` +❌ Body text at 12px - too small for many users +✅ Body text at 16px or larger + +❌ Mobile text at 10px - illegible on small screens +✅ Mobile text at 14px minimum + +❌ Long paragraphs with no line height spacing +✅ Line height 1.5x for body text (e.g., 16px text with 24px line height) +``` + +### Visual Indicators + +- Text that appears squished or compressed +- Long lines of text with minimal spacing +- Tiny labels on buttons or form fields + +## 3. Focus Indicators + +### Requirements + +All interactive elements must have **visible focus indicators**: +- Minimum **2px** outline or border +- Contrast ratio of **3:1** against background +- Clearly visible when tabbing through interface + +### Common Violations + +``` +❌ No visible outline when button is focused +✅ Blue 2px outline appears on focus + +❌ Focus outline same color as background (invisible) +✅ High-contrast focus outline (e.g., black on white) + +❌ Focus state only indicated by subtle background color change +✅ Focus state with outline + background color change +``` + +### Visual Indicators in Screenshots + +Look for: +- Focused element (if screenshot captures tab state) +- Absence of visible outline or border +- Focus indicator that's too subtle or low-contrast + +## 4. Form Labels and Instructions + +### Requirements + +- Every form input must have a visible **