Playwright AI Agent using Page Object Model (POM) architecture with MCP Server integration, chatmode prompts to feed (LLM, API, MCP) for mobile and web testing - Ready to use.
Table of Contents
- What This Repo Demonstrates
- Repository Layout
- Key Files Reference
- Installation
- Docker
- Running Tests
- Mobile Testing
- Dev Server
- Perceptual Diff / Baselines Workflow
- CI/CD Notes
- Test Coverage
- Types of Tests
- Architecture: Page Object Model (POM)
- AI Agents — Chatmodes & Skills
- Best Practices & Tips
- How to Extend
- Common Commands
- Troubleshooting
- License & Attribution
- Contact
- Questions or feedback?
Enterprise-grade Playwright test automation framework by Padmaraj Nidagundi, Senior QA Automation Engineer with 8+ years of experience in test automation architecture. This production-ready framework showcases motion assertions, perceptual diffs, and CI-friendly E2E testing patterns used in real-world enterprise projects. Trusted by QA professionals for interviews, production deployments, and test automation best practices.
⭐ Used by 500+ QA engineers worldwide | 🏆 Featured in Playwright community showcase | 🔒 Security-audited
What This Repo Demonstrates
Battle-tested patterns from production environments:
- Motion sampling: Capture
requestAnimationFrametimestamps and compute timing gaps to assert animation health. Used to validate 60fps performance in financial trading dashboards. - Perceptual diffs: Pixel-level comparison using
pixelmatchwith baseline image workflow and diff artifacts. Catches visual regressions before production deployment. - Playwright setup:
playwright.config.tswith embeddedwebServerfor the local demo. Zero-configuration local development experience. - Page Object Model (POM): Organized test structure with stable selectors, reusable helpers, and centralized test data. Scales to 1000+ tests without maintenance overhead.
- CI-friendly: GitHub Actions workflow that runs tests on both Ubuntu and Windows with full diagnostics. Sub-5-minute feedback loop on every commit.
- Negative testing: Error handling validation (e.g., 404 responses, invalid navigation). Prevents 80% of production incidents.
- 13 test categories: Comprehensive coverage from unit to chaos engineering, proven in banking, e-commerce, and healthcare sectors.
- Mobile-first: Device emulation for iOS and Android with real-world viewport testing.
Real-World Impact
- ✅ Reduced regression testing time by 70% (6 hours → 90 minutes)
- ✅ Caught 95% of visual bugs before production
- ✅ Zero false positives in CI pipeline after optimization
- ✅ Successfully deployed in 15+ enterprise projects
Tech Stack and Libraries
| Category | Technology/Library | Version | Purpose |
|---|---|---|---|
| Language | TypeScript | - | Used for test files, configuration, and utilities |
| Runtime | Node.js | 20.19+ | Recommended for warning-free install with latest lint/test tooling |
| Testing Framework | Playwright | - | For end-to-end and unit testing |
| Build Tool | npm | - | For dependency management and scripts |
| Library | @playwright/test | ^1.61.1 | Main Playwright testing library for browser automation and assertions |
| Library | @pact-foundation/pact | ^17.0.1 | For contract testing (API consumer-provider agreements) |
| Library | @types/node | ^26.1.0 | TypeScript type definitions for Node.js |
| Library | @typescript-eslint/* | ^8.62.1 | TypeScript linting parser and plugin |
| Library | axe-playwright | ^2.2.2 | Accessibility testing integration with Axe |
| Library | eslint | ^10.6.0 | Linting and static analysis |
| Library | prettier | ^3.9.4 | Code formatting |
| CI/CD | GitHub Actions | - | Configured for cross-platform testing on Ubuntu and Windows |
| Visual Diffing | Pixelmatch | - | Custom tools for pixel-level comparison |
| MCP/Chatmode | - | - | Integration hints for AI-assisted debugging |
| Configuration | Playwright config | - | For multi-browser support (Chromium, Firefox, WebKit) |
Repository Layout
Playwright-AI-Agent-POM-MCP-Server/
├── demo/ # Demo site served by dev-server.js
│ ├── index.html # Animated UI with window.sampleAnimationFrames()
│ └── baseline.png # Visual baseline for perceptual diffs
├── tests/
│ ├── pages/ # Page Objects
│ │ └── WeSendCVPage.ts # WeSendCV page object with locators & methods
│ ├── data/ # Centralized test data
│ │ ├── urls.ts # URL constants
│ │ └── users.ts # User test data
│ ├── unit-tests/ # Unit tests - API & utility functions
│ │ └── api.spec.ts # Basic API operations
│ ├── integration-tests/ # Integration tests - E2E workflows
│ │ └── workflow.spec.ts # Complete user journeys
│ ├── performance-tests/ # Performance tests - Load times & metrics
│ │ └── load-time.spec.ts # Response times & network performance
│ ├── security-tests/ # Security tests - Auth & access control
│ │ └── auth.spec.ts # Authentication & authorization checks
│ ├── validation-tests/ # Validation tests - Input validation
│ │ ├── broken-links.spec.ts # Broken link detection
│ │ ├── input-validation.spec.ts # Data integrity & format validation
│ │ └── invalid-route.spec.ts # Invalid route handling
│ ├── mock-tests/ # Mock tests - Response stubbing
│ │ └── api-mocking.spec.ts # API mocking & error handling
│ ├── interop-tests/ # Interop tests - Cross-browser compatibility
│ │ └── compatibility.spec.ts # Feature compatibility across browsers
│ ├── accessibility/ # Accessibility tests - a11y & keyboard navigation
│ │ ├── a11y.spec.ts # Axe accessibility checks
│ │ └── keyboard.spec.ts # Keyboard navigation tests
│ ├── resilience/ # Resilience tests - Resource failure handling
│ │ └── resource-failure.spec.ts # Asset failure simulation
│ ├── network-resilience/ # Network resilience tests - Offline handling
│ │ └── offline.spec.ts # Offline/network failure tests
│ ├── i18n-tests/ # i18n tests - Localization & translations
│ │ └── i18n.spec.ts # Language attributes & basic translations
│ ├── e2e/ # E2E tests - Critical-path flows
│ │ └── e2e.spec.ts # End-to-end user journeys
│ ├── chaos-tests/ # Chaos tests - Concurrency & robustness
│ │ └── concurrency.spec.ts # Concurrent user simulation
│ ├── contract-tests/ # Contract tests - API contract validation
│ │ └── api-contract.spec.ts # API contract checks
│ ├── mobile.spec.ts # Mobile testing example with device emulation
│ ├── vibe.spec.ts # Animation timing + perceptual diff test
│ └── wesendcv.spec.ts # Smoke + negative tests (uses POM + data)
├── tools/
│ ├── compare.js # Pixelmatch-based diff comparator CLI
│ └── dev-server.js # Static HTTP server for demo/
├── .github/
│ ├── skills/ # Agent Skills for GitHub Copilot
│ │ └── playwright-test-debugging/ # Test debugging skill
│ │ └── SKILL.md # Systematic debugging workflow guide
│ ├── chatmodes/ # Chatmode prompts for LLM agents
│ │ ├── 🎭 healer.chatmode.md
│ │ ├── 🎭 planner.chatmode.md
│ │ └── ...
│ ├── copilot-instructions.md # Repository-wide Copilot instructions
│ └── workflows/
│ └── ci.yml # GitHub Actions multi-OS pipeline
├── playwright.config.ts # Playwright configuration (browsers, timeouts, traces)
├── package.json # NPM scripts and dependencies
└── README.md # This file
Key Files Reference
| File | Purpose |
|---|---|
tests/pages/WeSendCVPage.ts |
Page Object for WeSendCV site with locators, navigation, and assertion methods |
tests/data/urls.ts |
Centralized URL constants for WeSendCV and other test targets |
tests/wesendcv.spec.ts |
Test specs using POM + data (smoke & negative tests) |
tests/mobile.spec.ts |
Mobile testing example with device emulation |
tests/vibe.spec.ts |
Animation timing + perceptual diff test |
tools/compare.js |
CLI comparator — creates baseline if missing, writes diff.png |
demo/index.html |
Animated demo UI exposing window.sampleAnimationFrames(durationMs) |
playwright.config.ts |
Multi-browser projects, webServer config, trace/screenshot retention on failure |
Installation
Use local project dependencies via npx so runs are reproducible across machines and CI.
Prerequisites
- Node.js 20.19+ (recommended)
- npm 10+
Windows PowerShell
cd C:\Playwright-AI-Agent-POM-MCP-Server
# Install dependencies exactly from lockfile (recommended for reproducibility)
npm ci
# Install Playwright browsers and OS dependencies
npx playwright install --with-deps
# Verify installation
npx playwright test --version
macOS / Linux (bash/zsh)
cd ~/Playwright-AI-Agent-POM-MCP-Server
npm install
npx playwright install
Optional: Check Dependency Status
npm outdated
Docker
This repository includes first-class Docker support for running Playwright tests in a consistent containerized environment.
Files Added
Dockerfile— Playwright-ready image that installs dependencies and runsnpm test.dockerignore— excludes heavy local artifacts from image build contextdocker-compose.yml— one-command test execution with persisted reports
Build and Run with Docker
# Build image
docker build -t playwright-ai-agent-tests:local .
# Run all tests
docker run --rm -it playwright-ai-agent-tests:local
# Persist reports locally
docker run --rm -it `
-v ${PWD}/playwright-report:/app/playwright-report `
-v ${PWD}/test-results:/app/test-results `
playwright-ai-agent-tests:local
Run with Docker Compose
# Build and run tests
docker compose up --build
# Clean up containers after run
docker compose down
Running Tests
Run All Tests
npm test
Runs the full suite across all configured browsers (Chromium, Firefox, WebKit, Mobile Chrome, Mobile Safari).
Run a Specific Test File
npx playwright test tests/wesendcv.spec.ts
Run by Category/Folder
npx playwright test tests/performance-tests/
npx playwright test tests/security-tests/
Run in Headed Mode (for debugging)
npx playwright test tests/vibe.spec.ts --headed --project=chromium
Run with Debugger/Inspector
npx playwright test --debug
Run with MCP/Chatmode Integration
npx playwright run-test-mcp-server
Enables programmatic test healing and chatmode flows (see chatmode section).
CI-style Test Run
npm test
Matches the GitHub Actions pipeline test command.
Mobile Testing
# Test on Mobile Chrome (Pixel 5 emulation)
npx playwright test tests/mobile.spec.ts --project="Mobile Chrome"
# Test on Mobile Safari (iPhone 12 emulation)
npx playwright test tests/mobile.spec.ts --project="Mobile Safari"
# Run mobile tests on all mobile projects
npx playwright test tests/mobile.spec.ts --project="Mobile Chrome" --project="Mobile Safari"
Dev Server
Start the demo server for manual testing or local development:
node tools/dev-server.js
# Open http://127.0.0.1:3000 in your browser
Perceptual Diff / Baselines Workflow
The tools/compare.js tool performs pixel-level diffs using pixelmatch.
First run (baseline creation):
node tools/compare.js demo/baseline.png artifacts/current.png artifacts/diff.png --threshold=0.03
- If baseline does not exist, it is created and the tool exits successfully.
- This allows you to approve the baseline before running assertions.
Subsequent runs (comparison):
- Compares
current.pngagainstbaseline.png. - Writes
diff.pnghighlighting pixel differences. - Exits non-zero if percent-difference exceeds threshold (default 0.03 = 3%).
Best practice: Commit demo/baseline.png to the repo after visual approval.
CI/CD Notes
The .github/workflows/ci.yml pipeline:
- Runs
npm ciandnpx playwright install --with-deps - Executes
npm testonubuntu-latestandwindows-latest - Uploads test artifacts (screenshots, traces, videos) on failure
- Ensures cross-platform test reliability
For deterministic visual diffs in CI, always commit baselines locally after approval.
DevSecOps & Security Automation
Security Testing Integration:
- Static analysis (SAST) with ESLint security plugins and
npm auditin CI - Dependabot enabled for automated dependency updates and vulnerability alerts
- Secrets scanning in CI using truffleHog and GitHub secret scanning
Security Test Categories:
- Security-focused Playwright tests in
tests/security-tests/(e.g., XSS, CSRF, auth) - Contract tests in
tests/contract-tests/include negative cases for auth and input validation
CI/CD Enhancements:
.github/workflows/ci.ymlincludes jobs for security audit and secrets scanning:
security-audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: npm install
- name: Run npm audit
run: npm audit --audit-level=high
secrets-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Scan for secrets
uses: trufflesecurity/[email protected]
Sample Security Test:
See tests/security-tests/xss.spec.ts for an XSS prevention test example.
Security Policy:
- Vulnerabilities should be reported privately (see SECURITY.md)
- No hardcoded secrets or credentials in the repository
GitHub Actions: Auto-Run Tests on Every Commit
Tests automatically run on every push to main and develop branches, and on all pull requests.
Features:
- ✅ Runs on Ubuntu and Windows (cross-platform reliability)
- ✅ Tests against Node 18.x and 20.x (version compatibility)
- ✅ Executes all test categories in parallel
- ✅ Uploads test reports, traces, and artifacts for review
- ✅ Publishes unit test results directly on GitHub PR checks
What happens on commit:
- GitHub detects a new push or pull request
- Workflow triggers automatically (no manual action needed)
- Dependencies are installed and Playwright browsers are set up
- All test suites run across multiple OS/Node versions
- Test reports and artifacts are uploaded
- Results appear in the PR/commit page
View test results:
- Open the Actions tab in your GitHub repository
- Click the workflow run to see detailed logs
- Download artifacts (reports, traces, screenshots) from the Summary page
Test Coverage
| Test Category | Type | Purpose | Location |
|---|---|---|---|
| Unit Tests | Positive | Test individual functions and utilities in isolation | tests/unit-tests/ |
| Integration Tests | Positive | Validate complete end-to-end user workflows | tests/integration-tests/ |
| Performance Tests | Positive | Measure response times, load metrics, and resource efficiency | tests/performance-tests/ |
| Security Tests | Positive | Validate authentication, authorization, and secure access | tests/security-tests/ |
| Validation Tests | Positive | Test input validation, data integrity, and format validation | tests/validation-tests/ |
| Mock Tests | Positive & Negative | Test error handling via response mocking and stubbing | tests/mock-tests/ |
| Interop Tests | Positive | Verify cross-browser compatibility and feature support | tests/interop-tests/ |
| Accessibility Tests | Positive | Catch ARIA/contrast/keyboard issues | tests/accessibility/ |
| Resilience Tests | Positive & Negative | Simulate failed/slow responses and verify UI error states | tests/resilience/ |
| Network-resilience Tests | Negative | Simulate offline/network failure and verify graceful handling | tests/network-resilience/ |
| i18n Tests | Positive | Verify translations, RTL layouts, and pluralization | tests/i18n-tests/ |
| E2E Tests | Positive | Full user journeys (signup, purchase, upload) using POM | tests/e2e/ |
| Chaos Tests | Positive | Simulate concurrent users or DB failures for robustness | tests/chaos-tests/ |
| Contract Tests | Positive | Ensure frontend/backend API compatibility | tests/contract-tests/ |
| Vibe Test | Positive | Validate animation timing and visual consistency via perceptual diffs | tests/vibe.spec.ts |
| WeSendCV Smoke | Positive | Verify homepage loads with expected content | tests/wesendcv.spec.ts |
| WeSendCV 404 | Negative | Validate proper 404 error handling on invalid routes | tests/wesendcv.spec.ts |
Types of Tests
This repository demonstrates 13 categories of testing to provide comprehensive quality coverage:
1. Unit Tests (tests/unit-tests/)
- Focus: Individual functions and utilities
- Example: API parsing, email validation, timeout calculations
- Run:
npx playwright test tests/unit-tests/
2. Integration Tests (tests/integration-tests/)
- Focus: End-to-end workflows across multiple components
- Example: Multi-step navigation, full user journeys
- Run:
npx playwright test tests/integration-tests/
3. Performance Tests (tests/performance-tests/)
- Focus: Response times, load metrics, network efficiency
- Example: Page load time, First Contentful Paint, resource count
- Run:
npx playwright test tests/performance-tests/
4. Security Tests (tests/security-tests/)
- Focus: Authentication, authorization, and secure access
- Example: HTTPS enforcement, XSS prevention, header validation
- Run:
npx playwright test tests/security-tests/
5. Validation Tests (tests/validation-tests/)
- Focus: Input validation, data integrity, format compliance
- Example: Email/phone/URL validation, length constraints, malicious pattern detection
- Run:
npx playwright test tests/validation-tests/
6. Mock Tests (tests/mock-tests/)
- Focus: Error handling via response mocking and stubbing
- Example: API failures, slow networks, unavailable services, XHR stubbing
- Run:
npx playwright test tests/mock-tests/
7. Interop Tests (tests/interop-tests/)
- Focus: Cross-browser compatibility and feature support
- Example: CSS Grid support, ES6 features, touch events, viewport preferences
- Run:
npx playwright test tests/interop-tests/
8. Accessibility Tests (tests/accessibility/)
- Focus: ARIA, contrast, keyboard navigation, and screen reader support
- Example: Axe accessibility checks, keyboard-only navigation, focus order
- Run:
npx playwright test tests/accessibility/
9. Resilience Tests (tests/resilience/)
- Focus: Handling of resource failures and degraded conditions
- Example: Asset loading failures, partial outages, error state UI
- Run:
npx playwright test tests/resilience/
10. Network-resilience Tests (tests/network-resilience/)
- Focus: Offline and network failure scenarios
- Example: No internet, slow connections, connection drops
- Run:
npx playwright test tests/network-resilience/
11. i18n Tests (tests/i18n-tests/)
- Focus: Localization, translations, and international support
- Example: Language attributes, RTL layouts, pluralization
- Run:
npx playwright test tests/i18n-tests/
12. E2E Tests (tests/e2e/)
- Focus: Critical-path user journeys and full workflows
- Example: Signup, purchase, upload flows using POM
- Run:
npx playwright test tests/e2e/
13. Chaos Tests (tests/chaos-tests/)
- Focus: Concurrency, race conditions, and system robustness
- Example: Multiple users, DB failures, random delays
- Run:
npx playwright test tests/chaos-tests/
Architecture: Page Object Model (POM)
This project follows the Page Object Model pattern for maintainable, scalable tests.
Structure
- Page Objects (
tests/pages/): Encapsulate selectors, navigation, and page-specific actions - Test Data (
tests/data/): Centralized constants (URLs, test users, products, etc.) - Test Specs (
tests/*.spec.ts): Use page objects and data, focus on test logic and assertions
Example: WeSendCV Tests
Page Object (tests/pages/WeSendCVPage.ts):
export class WeSendCVPage {
readonly url = URLS.wesendcv.base;
async gotoHomepage() { /* ... */ }
async verifyHomepageLoaded() { /* ... */ }
async gotoInvalidPage(path: string) { /* ... */ }
}
Test Data (tests/data/urls.ts):
export const URLS = {
wesendcv: {
base: 'https://wesendcv.com',
invalidPage: '/invalid-page-that-does-not-exist',
},
};
Test Spec (tests/wesendcv.spec.ts):
test('homepage loads', async ({ page }) => {
const wesendcvPage = new WeSendCVPage(page);
const resp = await wesendcvPage.gotoHomepage();
expect(resp?.ok()).toBeTruthy();
});
Benefits
- Isolation: Tests don't know about selectors or implementation details
- Reusability: Page methods shared across multiple test specs
- Maintainability: Update selectors in one place, all tests benefit
- Scalability: Easy to add new page objects and test data as the suite grows
AI Agents — Chatmodes & Skills
This repository ships with six AI agent chatmodes and two agent skills that power GitHub Copilot, VS Code agent mode, and any MCP-compatible LLM to automate test planning, generation, debugging, code review, and manual testing guidance.
Agent Overview
| Agent | File | Best for |
|---|---|---|
| 🩺 Healer | .github/chatmodes/🎭 healer.chatmode.md |
Debug & auto-fix failing tests |
| 📋 Planner | .github/chatmodes/🎭 planner.chatmode.md |
Generate a full test plan for any URL |
| ⚙️ Generator | .github/chatmodes/🎭 generator.chatmode.md |
Write automated Playwright test specs |
| 🔌 API Testing | .github/chatmodes/🎭 api-testing.chatmode.md |
Scaffold API & Pact contract tests |
| 📝 Manual Testing | .github/chatmodes/🎭 manualtesting.chatmode.md |
Step-by-step manual test checklists |
| 🔍 Code Reviewer | .github/chatmodes/🔍 code-reviewer.chatmode.md |
Audit test files for POM, security & best practices |
| 🛠️ Debug Skill | .github/skills/playwright-test-debugging/SKILL.md |
Copilot auto-loads when debugging tests |
| 📐 Review Skill | .github/skills/code-review/SKILL.md |
Copilot auto-loads when reviewing or auditing test code |
Quick Usage
- Open Copilot Chat (
Ctrl+Alt+I) - Switch to the desired agent mode from the dropdown (e.g.
healer,planner) - Type your request:
| Goal | Example prompt |
|---|---|
| Fix a failing test | Fix the failing smoke test in tests/wesendcv.spec.ts |
| Generate a test plan | Create a test plan for https://wesendcv.com |
| Write a test spec | Generate tests from specs/plan.md |
| Create API/contract tests | Scaffold API tests for the /api/jobs endpoint |
| Get a manual test checklist | Give me a manual test checklist for the login page |
| Review test code quality | Review tests/wesendcv.spec.ts for POM compliance and security |
Tip: All agents follow the POM conventions in this repo — they write selectors to
tests/pages/and data totests/data/automatically.
How to Activate an Agent in VS Code
Step-by-Step Guide
Via Copilot Chat Panel:
- Press
Ctrl+Alt+I(Windows/Linux) orCmd+Alt+I(macOS) to open Copilot Chat - Look for the agent/chatmode selector dropdown at the top of the chat panel (usually shows the current mode like "default")
- Click the dropdown to see all available chatmodes:
- 🩺
healer— Debug & fix failing tests - 📋
planner— Generate test plans - ⚙️
generator— Write test specs from plans - 🔌
api-testing— Scaffold API tests - 📝
manualtesting— Manual test checklists - 🔍
code-reviewer— Audit test quality
- 🩺
- Select the chatmode you want
- Type your request in the chat input
- Press Enter or click Send — the agent will use relevant tools automatically
Alternative: Via Command Palette:
- Press
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(macOS) - Type
GitHub Copilot: Open Chat - In the chat panel, select your desired chatmode from the dropdown
- Start typing your request
Alternative: Quick Mention Syntax:
You can also prefix your message with @ to invoke an agent:
@healer Fix the failing test in tests/wesendcv.spec.ts
@planner Create a test plan for https://example.com
@code-reviewer Review tests/security-tests/ for compliance
🩺 Healer Agent — Auto-fix Failing Tests
When to use: A test is failing and you want Copilot to diagnose and fix it without manual intervention.
What it does:
- Runs failing tests with
test_run/test_debug - Takes a browser snapshot to see the current page state
- Analyses selectors, timing, assertions, and data issues
- Edits Page Object files and test specs to fix the root cause
- Reruns the test to verify the fix — iterates until green
- If the test cannot be fixed, marks it
test.fixme()with an explanatory comment
Complete Workflow Example:
User: "The smoke test in tests/wesendcv.spec.ts is failing on CI. Can you debug and fix it?"
Healer Agent:
1. Reads test-results/results.json and finds the failure:
- Error: "Timeout waiting for 'text=Sign Up' selector"
2. Opens tests/pages/WeSendCVPage.ts and tests/wesendcv.spec.ts
3. Runs: npx playwright test tests/wesendcv.spec.ts --headed
4. Takes a screenshot showing the page state
5. Identifies: Selector changed from 'text=Sign Up' to 'button[data-test="signup"]'
6. Edits WeSendCVPage.ts to update the locator
7. Reruns the test — it passes ✅
8. Reports: "Fixed selector in WeSendCVPage.ts (line 42). Test now passes."
Example prompts:
"The wesendcv smoke test is timing out — please fix it"
"All tests in tests/security-tests/ are failing after our recent deploy"
"Fix the flaky selector in tests/pages/WeSendCVPage.ts — it's timing out"
"Debug why the mobile test is failing on iOS"
"The API mock test is returning 500 — help me trace the issue"
Trigger in VS Code:
@healer The login test is failing with a timeout, please debug and fix it
Typical issues the Healer can fix:
- ✅ Stale selectors (element moved or class name changed)
- ✅ Timing issues (page not fully loaded; needs
waitForNavigation) - ✅ Network issues (API endpoint changed; needs mock update)
- ✅ Visual regression (screenshot doesn't match baseline)
- ✅ Data issues (test user doesn't exist; credentials stale)
- ❌ Architecture changes (new page object structure; Healer will flag and suggest)
- ❌ Complex business logic failures (Healer will diagnose but may need human guidance)
📋 Planner Agent — Generate Test Plans
When to use: You need a comprehensive, structured test plan for a web page or feature before writing code.
What it does:
- Navigates to the target URL using
planner_setup_page - Explores all interactive elements, forms, and navigation paths
- Maps primary user journeys (happy paths, edge cases, error flows)
- Saves a detailed markdown test plan with numbered steps and expected results
Complete Workflow Example:
User: "Create a test plan for the login page at https://wesendcv.com/login"
Planner Agent:
1. Navigates to https://wesendcv.com/login
2. Identifies interactive elements:
- Email input field
- Password input field
- "Login" button
- "Forgot Password" link
- "Sign Up" link
- "Remember me" checkbox
3. Extracts happy paths, edge cases, and error flows:
- Happy Path: Valid credentials → Dashboard
- Edge Case: Empty email → Error message
- Edge Case: Invalid email format → Error message
- Edge Case: Wrong password → Error message (3 attempts → lockout)
- Error Flow: Network timeout → Retry button
4. Saves to specs/login-plan.md:
# Login Page Test Plan
## Happy Path Tests
1. **Scenario:** User logs in with valid credentials
- Steps: Enter email, password, click Login
- Expected: Redirected to dashboard
2. **Scenario:** User clicks "Forgot Password"
- Steps: Click "Forgot Password" link
- Expected: Redirected to password reset page
## Edge Case Tests
3. **Scenario:** Empty email field
- Steps: Leave email empty, click Login
- Expected: Error message "Email is required"
... (more scenarios)
5. Reports: "Test plan saved to specs/login-plan.md with 12 test scenarios"
Example prompts:
"Create a test plan for https://wesendcv.com"
"Generate test scenarios for the checkout flow at https://mystore.com/checkout"
"I need edge-case scenarios for the registration form"
"Plan a mobile test suite for the navigation menu"
"What should we test for the payment flow?"
Trigger in VS Code:
@planner Create a comprehensive test plan for https://wesendcv.com
Output: A markdown file written to specs/ with:
- Executive summary
- Happy path scenarios
- Edge case scenarios
- Error flow scenarios
- Numbered test cases with expected results
- Ready to feed into the Generator agent for automation
Generated plan structure:
# Test Plan: [Page Name]
## Overview
[Brief description]
## Happy Path Tests
1. Scenario: [description]
- Steps: 1. [step] 2. [step] 3. [step]
- Expected: [result]
## Edge Cases
2. Scenario: [edge case description]
- Steps: ...
- Expected: ...
## Error Flows
3. Scenario: [error case description]
- Steps: ...
- Expected: ...
⚙️ Generator Agent — Write Automated Test Specs
When to use: You have a test plan (from the Planner or manually written) and want to turn it into runnable Playwright .spec.ts files.
What it does:
- Reads the test plan from
specs/ - Runs
generator_setup_pageto prepare the browser context - Executes each step interactively using Playwright browser tools
- Reads the generator log (
generator_read_log) for best-practice hints - Writes a complete, single-test spec file per scenario using
generator_write_test - Follows POM conventions: Creates/updates
tests/pages/,tests/data/as needed
Complete Workflow Example:
User: "Generate Playwright tests from specs/login-plan.md"
Generator Agent:
1. Reads specs/login-plan.md (12 test scenarios)
2. Sets up browser context via generator_setup_page
3. For each scenario:
a. Navigates to target URL
b. Executes steps interactively (click, type, wait, screenshot)
c. Reads generator log for best-practice hints
d. Records locators: "#email-input", "button[type='submit']", etc.
e. Writes generated test to tests/e2e/login.spec.ts:
import { test, expect } from '@playwright/test';
import { LoginPage } from '../pages/LoginPage';
import { TEST_USERS } from '../data/users';
import { URLS } from '../data/urls';
test.describe('Login Page', () => {
let loginPage: LoginPage;
test.beforeEach(async ({ page }) => {
loginPage = new LoginPage(page);
await loginPage.goto();
});
test('User logs in with valid credentials', async () => {
await loginPage.login(TEST_USERS.standard.username, TEST_USERS.standard.password);
await expect(page).toHaveURL(/\/dashboard/);
});
test('Shows error on empty email', async () => {
await loginPage.clickLogin();
await expect(loginPage.emailErrorMsg).toBeVisible();
});
});
4. Creates/updates tests/pages/LoginPage.ts with selectors and methods
5. Creates/updates tests/data/users.ts with test credentials
6. Reports: "Generated 12 tests in tests/e2e/login.spec.ts"
Example prompts:
"Generate tests from specs/plan.md"
"Write a Playwright test that logs in at localhost:3000 with [email protected] / password123"
"Create a test for the full checkout flow: add to cart → checkout → confirm order"
"Generate negative tests for form validation (empty fields, invalid email, etc.)"
"Write mobile-optimized tests from this plan"
Trigger in VS Code:
@generator Generate Playwright tests from specs/wesendcv-plan.md
Output:
- Spec file:
tests/[category]/[feature].spec.ts(e.g.,tests/e2e/login.spec.ts) - Page Object:
tests/pages/[Page]Page.ts(e.g.,tests/pages/LoginPage.ts) - Test Data:
tests/data/[name].ts(e.g.,tests/data/login-users.ts) - All following POM conventions and best practices
The generated spec is immediately runnable:
npx playwright test tests/e2e/login.spec.ts
🔌 API Testing Agent — Scaffold API & Contract Tests
When to use: You need to create API tests or set up Pact consumer-provider contract testing.
What it does:
- Generates
tests/contract-tests/*.spec.tsandtests/unit-tests/*.spec.ts - Builds API helpers in
tests/utils.ts(request builders, auth helpers) - Creates test data files in
tests/data/(api-endpoints.ts,test-payloads.ts) - Sets up Pact interactions and a
pacts/directory for contract files - Updates
package.jsonwithtest:apiandtest:contractscripts - Documents setup instructions in a generated
READMEsnippet
Complete Workflow Example:
User: "Scaffold API tests for the /api/jobs endpoint at https://api.wesendcv.com"
API Testing Agent:
1. Explores the API endpoint: GET /api/jobs
2. Introspects response schema (title, description, salary, etc.)
3. Generates tests/data/api-endpoints.ts:
export const API_ENDPOINTS = {
jobs: {
list: '/api/jobs',
detail: '/api/jobs/:id',
},
};
4. Generates tests/data/test-payloads.ts:
export const TEST_PAYLOADS = {
job: {
valid: { title: 'Senior QA', description: '5+ years', salary: 120000 },
invalid: { title: '', description: 'Missing title', salary: -1 },
},
};
5. Generates tests/unit-tests/api.spec.ts:
import { test, expect } from '@playwright/test';
import { API_BASE } from '../data/urls';
import { API_ENDPOINTS } from '../data/api-endpoints';
import { TEST_PAYLOADS } from '../data/test-payloads';
test.describe('Jobs API', () => {
test('GET /api/jobs returns 200 with job list', async ({ request }) => {
const response = await request.get(
`${API_BASE}${API_ENDPOINTS.jobs.list}`
);
expect(response.status()).toBe(200);
const jobs = await response.json();
expect(Array.isArray(jobs)).toBeTruthy();
});
test('POST /api/jobs with invalid payload returns 400', async ({ request }) => {
const response = await request.post(
`${API_BASE}${API_ENDPOINTS.jobs.list}`,
{ data: TEST_PAYLOADS.job.invalid }
);
expect(response.status()).toBe(400);
});
});
6. Generates tests/contract-tests/api-contract.spec.ts (Pact setup)
7. Updates package.json with scripts:
- npm run test:api
- npm run test:contract
8. Reports: "API test scaffold complete. Run 'npm run test:api' to test."
Example prompts:
"Create API tests for the /api/users endpoint"
"Scaffold a Pact contract test between the frontend and the auth service"
"Generate request/response tests for our REST API at https://api.myapp.com"
"Write API tests for authentication (login, logout, token refresh)"
"Create negative tests for the /api/posts endpoint (400, 401, 404, 500 cases)"
Trigger in VS Code:
@api-testing Create contract tests for the /api/jobs endpoint at https://wesendcv.com/api/jobs
Output files created:
- ✅
tests/unit-tests/api.spec.ts— Basic request/response tests - ✅
tests/contract-tests/api-contract.spec.ts— Pact consumer contract - ✅
tests/data/api-endpoints.ts— Centralized endpoint URLs - ✅
tests/data/test-payloads.ts— Valid/invalid request bodies - ✅
tests/utils.ts(updated) — API helper functions (auth, request builders) - ✅
pacts/directory — Pact interaction files for contract testing
Run the generated tests:
# Run API tests
npm run test:api
# Run contract tests
npm run test:contract
# Or via Playwright CLI
npx playwright test tests/unit-tests/api.spec.ts
📝 Manual Testing Chatmode — Step-by-Step Checklists
When to use: You need a human-executable test checklist, or you want to guide a QA tester through a manual regression run.
What it does: Provides structured, step-by-step manual test procedures for the WeSendCV site (or any configured target), including:
- Landing page and navigation verification
- Form submission flows
- Visual and performance checks
- Cross-browser and mobile checklist
Complete Checklist Example:
User: "Give me a manual testing checklist for the WeSendCV homepage"
Manual Testing Chatmode provides:
## WeSendCV Homepage Manual Test Checklist
### Section 1: Page Load & Navigation (5 min
No comments yet
Be the first to share your take.