create-playwright-ai
v1.0.0
Published
Scaffold a Playwright + AI reporting test project in seconds
Maintainers
Readme
create-playwright-ai
Scaffold a Playwright E2E test project with AI-powered reporting and a GitHub Actions CI pipeline — in seconds.
npm create playwright-ai@latest my-projectThe CLI will ask for a project name and your preferred language (English or Spanish). The prompts/ directory will be generated in the chosen language, so Claude's AI reports will be written in that language too.
What you get
my-project/
├── .github/
│ └── workflows/
│ └── ai-triage.yml # CI pipeline: static review + E2E + AI report
├── prompts/ # in your chosen language (en / es)
│ ├── ai-corrections.txt # prompt → suggested code fixes
│ ├── ai-group-failures.txt # prompt → group failures by root cause
│ ├── ai-summary.txt # prompt → business-friendly summary
│ └── ai-tickets.txt # prompt → Jira-ready ticket drafts
├── scripts/
│ └── report-ai.mjs # local AI report generator (uses Claude CLI)
├── src/
│ └── pages/
│ └── login.page.ts # Page Object Model example
├── tests/
│ └── login.spec.ts # login test suite (3 tests)
├── playwright.config.ts
├── tsconfig.json
└── .gitignoreRequirements
- Node.js 18 or higher
- Claude Code CLI installed and authenticated (for local AI reports)
Usage
# scaffold the project
npm create playwright-ai@latest my-project
# move into the folder
cd my-project
# install Playwright browsers
npx playwright install
# run the tests
npm run test
# run tests + generate AI report (requires Claude CLI)
npm run test:aiAvailable scripts
| Script | Description |
|--------|-------------|
| npm run test | Run all tests (headless) |
| npm run test:headed | Run tests with the browser visible |
| npm run test:ui | Open the Playwright interactive UI |
| npm run report:ai | Generate AI report from the last test run |
| npm run test:ai | Run tests and immediately generate the AI report |
GitHub Actions CI pipeline
The included workflow (ai-triage.yml) runs automatically on every pull request and has three jobs:
- Static code review — Claude reads the PR diff and posts a Markdown comment with Playwright best-practice feedback.
- E2E tests — Runs the full Playwright test suite on
ubuntu-latest. - AI quality report — If any test fails, Claude groups the failures, writes a business summary, generates Jira-ready ticket drafts, and posts everything as a PR comment. It also applies a risk label (
ai:critical-risk,ai:needs-review, orai:low-risk) to the PR automatically.
Required secret
Add this secret to your GitHub repository (Settings → Secrets → Actions):
| Secret | Description |
|--------|-------------|
| CLAUDE_CODE_OAUTH_TOKEN | Your Claude Code OAuth token |
Local AI report
After running your tests, execute npm run report:ai to generate these files inside playwright-report/:
ai-summary.txt— plain-text executive summary (business-friendly, ready to email)ai-corrections.md— suggested fixes per failure groupai-tickets.json— Jira-compatible ticket draftsai-failures-grouped.json— failures grouped by root cause
create-playwright-ai (Español)
Genera un proyecto de tests E2E con Playwright, informes con IA y un pipeline de CI en GitHub Actions — en segundos.
npm create playwright-ai@latest mi-proyectoLa CLI te pedirá el nombre del proyecto y tu idioma preferido (English o Español). El directorio prompts/ se generará en el idioma elegido, y los informes que genere Claude también estarán en ese idioma.
Qué incluye el proyecto generado
mi-proyecto/
├── .github/
│ └── workflows/
│ └── ai-triage.yml # pipeline CI: revisión estática + E2E + informe IA
├── prompts/ # en el idioma elegido (en / es)
│ ├── ai-corrections.txt # prompt → correcciones de código sugeridas
│ ├── ai-group-failures.txt # prompt → agrupa fallos por causa raíz
│ ├── ai-summary.txt # prompt → resumen ejecutivo para negocio
│ └── ai-tickets.txt # prompt → borradores de tickets para Jira
├── scripts/
│ └── report-ai.mjs # generador de informes IA en local (usa Claude CLI)
├── src/
│ └── pages/
│ └── login.page.ts # ejemplo de Page Object Model
├── tests/
│ └── login.spec.ts # suite de login (3 tests)
├── playwright.config.ts
├── tsconfig.json
└── .gitignoreRequisitos
- Node.js 18 o superior
- Claude Code CLI instalado y autenticado (para los informes IA en local)
Uso
# genera el proyecto
npm create playwright-ai@latest mi-proyecto
# entra en la carpeta
cd mi-proyecto
# instala los navegadores de Playwright
npx playwright install
# ejecuta los tests
npm run test
# ejecuta los tests y genera el informe IA (requiere Claude CLI)
npm run test:aiScripts disponibles
| Script | Descripción |
|--------|-------------|
| npm run test | Ejecuta todos los tests (sin navegador visible) |
| npm run test:headed | Ejecuta los tests con el navegador visible |
| npm run test:ui | Abre la interfaz interactiva de Playwright |
| npm run report:ai | Genera el informe IA a partir del último resultado |
| npm run test:ai | Ejecuta los tests y genera el informe IA inmediatamente |
Pipeline de GitHub Actions
El workflow incluido (ai-triage.yml) se ejecuta automáticamente en cada pull request y tiene tres jobs:
- Revisión estática del código — Claude lee el diff del PR y publica un comentario Markdown con feedback sobre buenas prácticas de Playwright.
- Tests E2E — Ejecuta la suite completa de Playwright en
ubuntu-latest. - Informe de calidad con IA — Si algún test falla, Claude agrupa los fallos, escribe un resumen de negocio, genera borradores de tickets para Jira y publica todo como comentario en la PR. Además aplica automáticamente una etiqueta de riesgo (
ai:critical-risk,ai:needs-reviewoai:low-risk).
Secret necesario
Añade este secret en tu repositorio de GitHub (Settings → Secrets → Actions):
| Secret | Descripción |
|--------|-------------|
| CLAUDE_CODE_OAUTH_TOKEN | Tu token OAuth de Claude Code |
Informe IA en local
Después de ejecutar tus tests, lanza npm run report:ai para generar estos archivos dentro de playwright-report/:
ai-summary.txt— resumen ejecutivo en texto plano (listo para enviar por email)ai-corrections.md— correcciones sugeridas por grupo de falloai-tickets.json— borradores de tickets compatibles con Jiraai-failures-grouped.json— fallos agrupados por causa raíz
Licencia
MIT
