π AI Playwright Test Lab
An end-to-end AI-powered test automation pipeline that:
βοΈ Generates Playwright tests from plain-English user stories
βοΈ Runs your Playwright suite
βοΈ Analyzes failed tests using AI, producing explanations, root causes, fix suggestions, and flakiness tips
βοΈ Builds a beautifully styled HTML dashboard of all AI results
βοΈ One-command workflow using
npm run ai:flowπΈ Demo Overview
This workflow turns simple input like:
stories/login.mdInto:
A generated Playwright test
A full run
AI failure analysis
A glowing, animated HTML dashboard like this:
ai-report.html (auto-opens):Plain English explanation
Root cause analysis
Suggested test fixes
Flakiness mitigation
Styled cards, badges, gradients, animations
π§ Tech Stack
Node.js + ES Modules
Playwright (
@playwright/test)OpenAI API (GPT-4.1)
Custom HTML reporting with external CSS
Dark-mode dashboard UI
π Project Structure
βοΈ Installation
π§ One-Command Workflow
Run this to:
Generate the test from your story
Run all Playwright tests
Analyze failures using AI
Build & open the HTML dashboard
π Individual Commands (Optional)
Generate tests from your stories
Creates Playwright test files under
tests/.Run the Playwright test suite
Saves
playwright-report.json.Analyze failures using AI (JSON only)
Saves structured output in
ai-analysis.json.Build + open the HTML dashboard
Auto-opens
ai-report.html in your browser.π€ How AI Analysis Works
After Playwright executes the tests, all failure metadata is passed to GPT-4.1:
Error message
Stack trace
Test title + project name
stdout/stderr logs
AI returns structured HTML with:
1. Plain-English Explanation
Why did this fail?
2. Probable Root Causes
2β3 likely technical problems.
3. Suggested Test Fixes
Specific Playwright code improvements.
4. Flakiness Mitigation
Ways to reduce intermittent failures.
π¨ HTML Dashboard Themes & Features
Dark-mode
Animated gradient highlight bars
Glowing hover transitions
Status badges
Collapsible AI analysis sections
External CSS for easy editing
Radial gradients & neon accent hues
π§ͺ Example AI Output (HTML)
π¦ Environment Variables
Set your OpenAI key using one of these methods:
Option 1: Export (recommended for quick setup)
Option 2: .env file (recommended for persistence)
Both methods work! If you use
export, it takes precedence over the .env file.π§ Roadmap & Enhancements
Multi-story batch generation
Test-to-story reverse engineering
Hit-map UI of frequent failures
CI pipeline integration
Slack/Teams bot that posts AI insights
Flaky test scoring over time
π¬ Contributing
Pull requests welcome!
Open issues for bugs, ideas, or UX/UI enhancements.
β Star the repo if you like it!
This project helps show how AI can supercharge real-world QA automation.
Let's build the future of testing. π₯
0 likes Β· 19 views Β· Dec 5, 2025
Developed an AI-driven test automation pipeline using Playwright and OpenAI.