
testing-e2e-with-playwright
Run end-to-end browser tests using Playwright MCP. Use when testing web applications, validating use
Playwright E2E Testing Skill
Production-ready E2E testing using Playwright MCP for the Medellin Spark platform
<p align="center"> <strong>Simple ⢠Fast ⢠Reliable</strong><br> Test your entire user journey in minutes, not hours. </p>š Quick Start
Run your first test in 60 seconds:
# 1. Install Playwright MCP
npm install -g @playwright/mcp@latest
# 2. Start your dev server
pnpm dev
# 3. Run smoke test
npm run test:smoke
That's it! Your first E2E test is complete. š
š What You Get
This skill provides:
ā 3 Ready-to-Run Test Playbooks
- Smoke test (2 min) - Quick health check
- Auth flow (5 min) - Login/logout testing
- Full journey (10-15 min) - Complete pitch deck creation
ā Autonomous Agent
- Smart test orchestration
- Intelligent error handling
- Automatic screenshot capture
- Network & console monitoring
ā Production-Ready CI/CD
- GitHub Actions workflows
- Automated PR checks
- Daily health monitoring
- Test result artifacts
ā Complete Documentation
- SKILL.md - Core instructions
- RUNBOOK.md - Operations guide
- Examples - TypeScript reference implementations
- Playbooks - Step-by-step test scripts
šÆ Use Cases
Before Every Deployment:
npm run test:all # Verify everything works
After Code Changes:
npm run test:smoke # Quick sanity check
Testing New Features:
npm run test:pitch-deck # Full user journey
Debugging Issues:
# Run with browser visible (no --headless)
npx @playwright/mcp < playbooks/pitch-deck-wizard.md
š Project Structure
.claude/skills/playwright-e2e-skill/
āāā SKILL.md # Main skill instructions
āāā README.md # This file
āāā RUNBOOK.md # Operations & troubleshooting
āāā package.json # Dependencies & scripts
ā
āāā playbooks/ # Test scenarios
ā āāā smoke.md # 2-min health check
ā āāā auth.md # 5-min auth flow
ā āāā pitch-deck-wizard.md # 10-15 min full journey
ā
āāā examples/ # TypeScript examples
ā āāā basic-navigation.ts # Simple test pattern
ā āāā form-submission.ts # Form testing
ā āāā full-journey.ts # Complete user flow
ā
āāā .github/workflows/ # CI/CD automation
ā āāā e2e-tests.yml # GitHub Actions config
ā
āāā .claude/agents/ # Autonomous testing agent
āāā eventos-playwright-agent/
āāā agent.json # Agent manifest
āāā handler.ts # Test orchestration logic
āāā types.ts # TypeScript definitions
š ļø Installation
Prerequisites
- Node.js 20+
- pnpm or npm
- Chrome/Chromium browser
Setup
# 1. Install Playwright MCP globally
npm install -g @playwright/mcp@latest
# 2. Install Playwright browsers
npx playwright install chromium
# 3. Install project dependencies
cd .claude/skills/playwright-e2e-skill
npm install
# 4. Verify installation
npm run test:smoke
š Available Tests
1. Smoke Test (2 min)
What it tests:
- Homepage loads
- Navigation works
- No console errors
- API calls succeed
When to run: Before every deployment, after every code change
Command:
npm run test:smoke
Playbook: playbooks/smoke.md
2. Auth Flow (5 min)
What it tests:
- Login form works
- Authentication succeeds
- Protected routes accessible
- Session persists
- Logout works
When to run: After auth code changes, before production deploy
Command:
npm run test:auth
Playbook: playbooks/auth.md
3. Pitch Deck Wizard - Full Journey (10-15 min)
What it tests:
- Chat interface works
- AI responds correctly
- Progress tracking updates
- Deck generation completes
- All 10 slides render
- Export functionality works
When to run: Before releases, weekly regression testing
Command:
npm run test:pitch-deck
Playbook: playbooks/pitch-deck-wizard.md
š¬ Example Output
š Starting full pitch deck wizard journey...
š PHASE 1: Setup & Navigation
ā
Wizard loaded
š PHASE 2: AI Conversation & Data Collection
š¬ Sending message 1/6...
š¬ Sending message 2/6...
š¬ Sending message 3/6...
š¬ Sending message 4/6...
š¬ Sending message 5/6...
š¬ Sending message 6/6...
ā
Conversation: 6 exchanges
š PHASE 3: Deck Generation
ā³ Waiting for Generate Deck button...
š Generating deck...
ā³ Waiting for generation to complete...
ā
Deck generated
š PHASE 4: Slide Validation
š Detected 10 slide references
ā
Found slide: Problem
ā
Found slide: Solution
ā
Found slide: Product
ā
Found slide: Market
ā
Found slide: Business Model
ā
Found slide: Team
ā
Found slide: Traction
ā
Found slide: Ask
š Found 8/8 expected slide types
š Testing slide interaction...
ā
Slide interaction works
š PHASE 5: Final Verification
ā
No console errors
š” Network: 45 total, 12 API calls
ā
All API calls successful
============================================================
ā
FULL JOURNEY COMPLETE
============================================================
Phases: ā
Wizard loaded ā ā
Conversation: 6 exchanges ā ā
Deck generated ā ā
10 slides generated ā ā
Slide interaction works
Conversation exchanges: 6
Slides generated: 10
Screenshots: 7
Errors: 0
š§ Configuration
NPM Scripts
All scripts are defined in package.json:
{
"scripts": {
"test:smoke": "Quick 2-min health check",
"test:auth": "5-min authentication flow",
"test:pitch-deck": "10-15 min full journey with video",
"test:all": "Run all tests sequentially",
"test:ci": "Headless mode for CI/CD",
"examples:basic": "Run basic navigation example",
"examples:form": "Run form submission example",
"examples:full": "Run full journey example",
"clean": "Remove test artifacts",
"setup": "Install Playwright MCP"
}
}
Environment Variables
Create .env file (optional):
# Base URL for tests
PLAYWRIGHT_BASE_URL=http://localhost:8080
# Default timeout (ms)
PLAYWRIGHT_TIMEOUT=30000
# Headless mode
PLAYWRIGHT_HEADLESS=true
š¤ Using the Agent
The eventos-playwright-agent provides autonomous test execution:
Trigger phrases:
- "test the full user journey"
- "run e2e tests"
- "validate pitch deck wizard"
- "run smoke tests"
Example usage:
import { EventosPlaywrightAgent } from '.claude/agents/eventos-playwright-agent';
const agent = new EventosPlaywrightAgent({
baseUrl: 'http://localhost:8080',
timeout: 30000,
screenshotDir: './test-results'
});
// Run smoke test
const result = await agent.runSmokeTest(context);
// Run full journey
const journeyResult = await agent.runPitchDeckJourney(context);
// Generate report
const report = agent.generateReport([result, journeyResult]);
console.log(report);
šļø CI/CD Integration
GitHub Actions
Tests run automatically on:
- Push to main/develop ā Smoke tests
- Pull requests ā Smoke + Auth tests
- Daily at 6 AM UTC ā Smoke tests
- Manual trigger ā Choose which suite to run
See .github/workflows/e2e-tests.yml for configuration.
Manual CI Run
# Run CI-mode tests locally
npm run test:ci
š Learning Resources
Start here:
- SKILL.md - Core skill instructions and tool reference
- playbooks/smoke.md - Simplest test example
- examples/basic-navigation.ts - Code example
Go deeper: 4. playbooks/pitch-deck-wizard.md - Complex journey 5. RUNBOOK.md - Operations & troubleshooting 6. handler.ts - Agent implementation
š Troubleshooting
Tests failing? Check RUNBOOK.md for solutions to common issues:
- Browser already in use
- Dev server not running
- Flaky tests
- AI not responding
- RLS blocking data
- Slow execution
Quick fixes:
# Reset everything
pkill -f chromium
rm -rf test-results
npm run test:smoke
# View detailed logs
cat test-results/*.log
# Debug visually (no headless)
npx @playwright/mcp < playbooks/smoke.md
š Performance Benchmarks
| Test | Expected | Good | Acceptable |
|---|---|---|---|
| Smoke Test | <2 min | <1 min | <3 min |
| Auth Test | <5 min | <3 min | <7 min |
| Full Journey | <15 min | <10 min | <20 min |
š¤ Contributing
Adding a new test:
- Create playbook in
playbooks/my-test.md - Add npm script to
package.json - Test locally:
npm run test:my-test - Update this README
- Submit PR
Example playbook template:
# My Test Playbook
**Purpose**: Brief description
**Duration**: X minutes
**When to Run**: When to use this test
## Test Steps
### Step 1: Description
\`\`\`typescript
await browser_navigate({ url: "..." });
\`\`\`
### Step 2: Description
\`\`\`typescript
await browser_click({ element: "...", ref: "..." });
\`\`\`
š License
MIT - See project root for license details
š Support
Need help?
- Check SKILL.md for tool reference
- Check RUNBOOK.md for troubleshooting
- Review examples/ for code patterns
- Check playbooks/ for test scenarios
Found a bug?
- Capture screenshots from
test-results/ - Save console logs
- Document reproduction steps
- File GitHub issue with evidence
<p align="center"> <strong>Built with ā¤ļø for the Medellin Spark team</strong><br> <em>Simple, fast, and reliable E2E testing</em> </p>