Skip to content

abarrac/create-playwright-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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-project

The 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
└── .gitignore

Requirements

  • 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:ai

Available 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:

  1. Static code review — Claude reads the PR diff and posts a Markdown comment with Playwright best-practice feedback.
  2. E2E tests — Runs the full Playwright test suite on ubuntu-latest.
  3. 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, or ai: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 group
  • ai-tickets.json — Jira-compatible ticket drafts
  • ai-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-proyecto

La 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
└── .gitignore

Requisitos

  • 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:ai

Scripts 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:

  1. 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.
  2. Tests E2E — Ejecuta la suite completa de Playwright en ubuntu-latest.
  3. 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-review o ai: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 fallo
  • ai-tickets.json — borradores de tickets compatibles con Jira
  • ai-failures-grouped.json — fallos agrupados por causa raíz

Licencia

MIT

About

Playwright test project scaffolder with AI-powered reporting and GitHub Actions CI pipeline

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors