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.
- 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
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.
- β 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
| Category | Technology/Library | Version | Purpose |
|---|---|---|---|
| Language | TypeScript | - | Used for test files, configuration, and utilities |
| Runtime | Node.js | 18.x or 20.x | As specified in CI |
| Testing Framework | Playwright | - | For end-to-end and unit testing |
| Build Tool | npm | - | For dependency management and scripts |
| Library | @playwright/test | ^1.35.0 | Main Playwright testing library for browser automation and assertions |
| Library | @pact-foundation/pact | ^16.0.2 | For contract testing (API consumer-provider agreements) |
| Library | @types/node | ^24.10.1 | TypeScript type definitions for Node.js |
| Library | axe-playwright | ^2.2.2 | Accessibility testing integration with Axe |
| 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) |
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
| 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 |
This repository supports advanced automation and skill-based workflows using the Playwright CLI. The CLI can be used for browser automation, test debugging, and loading custom skills for Copilot or agent workflows.
It is recommended to install the official Playwright CLI globally:
npm install -g @playwright/cliYou can use the CLI for browser automation, page interaction, and more:
# Open a browser
playwright open https://example.com
# Take a screenshot
playwright screenshot page.png
# Run a test
playwright test tests/wesendcv.spec.tsTo enable Copilot or agent workflows with repository-specific skills, use the following command:
playwright install --skillsThis will load all skills found in .github/skills/ and make them available for Copilot and agent-based debugging or automation. For more information on skills, see the Agent Skills section below.
Note: If you see a deprecation warning for
playwright-cli, always prefer@playwright/clifor the latest features and compatibility.
cd C:\Playwright-AI-Agent-POM-MCP-Server
# Install dependencies
npm install
# Install Playwright browsers
npx playwright install --with-deps
# Verify installation
npx playwright test --versioncd ~/Playwright-AI-Agent-POM-MCP-Server
npm install
npx playwright installThis repository includes first-class Docker support for running Playwright tests in a consistent containerized environment.
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 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# Build and run tests
docker compose up --build
# Clean up containers after run
docker compose downnpm testRuns the full suite across all configured browsers (Chromium, Firefox, WebKit, Mobile Chrome, Mobile Safari).
npx playwright test tests/wesendcv.spec.tsnpx playwright test tests/performance-tests/
npx playwright test tests/security-tests/npx playwright test tests/vibe.spec.ts --headed --project=chromiumnpx playwright test --debugnpx playwright run-test-mcp-serverEnables programmatic test healing and chatmode flows (see chatmode section).
npm run test:ciMatches the GitHub Actions pipeline configuration.
# 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"Start the demo server for manual testing or local development:
node tools/dev-server.js
# Open http://127.0.0.1:3000 in your browserThe 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.
The .github/workflows/ci.yml pipeline:
- Runs
npm ciandnpx playwright install --with-deps - Executes
npm run test:cionubuntu-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.
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/trufflehog@v3.56.3Sample 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
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 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 |
This repository demonstrates 13 categories of testing to provide comprehensive quality coverage:
- Focus: Individual functions and utilities
- Example: API parsing, email validation, timeout calculations
- Run:
npx playwright test tests/unit-tests/
- Focus: End-to-end workflows across multiple components
- Example: Multi-step navigation, full user journeys
- Run:
npx playwright test tests/integration-tests/
- Focus: Response times, load metrics, network efficiency
- Example: Page load time, First Contentful Paint, resource count
- Run:
npx playwright test tests/performance-tests/
- Focus: Authentication, authorization, and secure access
- Example: HTTPS enforcement, XSS prevention, header validation
- Run:
npx playwright test tests/security-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/
- Focus: Error handling via response mocking and stubbing
- Example: API failures, slow networks, unavailable services, XHR stubbing
- Run:
npx playwright test tests/mock-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/
- Focus: ARIA, contrast, keyboard navigation, and screen reader support
- Example: Axe accessibility checks, keyboard-only navigation, focus order
- Run:
npx playwright test tests/accessibility/
- Focus: Handling of resource failures and degraded conditions
- Example: Asset loading failures, partial outages, error state UI
- Run:
npx playwright test tests/resilience/
- Focus: Offline and network failure scenarios
- Example: No internet, slow connections, connection drops
- Run:
npx playwright test tests/network-resilience/
- Focus: Localization, translations, and international support
- Example: Language attributes, RTL layouts, pluralization
- Run:
npx playwright test tests/i18n-tests/
- Focus: Critical-path user journeys and full workflows
- Example: Signup, purchase, upload flows using POM
- Run:
npx playwright test tests/e2e/
- Focus: Concurrency, race conditions, and system robustness
- Example: Multiple users, DB failures, random delays
- Run:
npx playwright test tests/chaos-tests/
This project follows the Page Object Model pattern for maintainable, scalable tests.
- 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
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();
});- 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
This repository ships with five AI agent chatmodes and an agent skill that power GitHub Copilot, VS Code agent mode, and any MCP-compatible LLM to automate test planning, generation, debugging, and manual testing guidance.
| 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 |
| π Debug Skill | .github/skills/playwright-test-debugging/SKILL.md |
Copilot auto-loads when debugging tests |
- 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 |
Tip: All agents follow the POM conventions in this repo β they write selectors to
tests/pages/and data totests/data/automatically.
- Open the GitHub Copilot Chat panel (
Ctrl+Alt+I/Cmd+Alt+I) - Click the agent-mode selector (the
@or mode dropdown) - Choose the chatmode you want, or type
@and select from the list - Start your request β the agent will use the relevant tools automatically
Alternatively, in VS Code agent mode open the command palette and run GitHub Copilot: Open Chat, then switch to the desired chatmode from the dropdown at the top of the chat panel.
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
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"
Trigger in VS Code:
@healer The login test is failing with a timeout, please debug and fix it
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
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"
Trigger in VS Code:
@planner Create a comprehensive test plan for https://wesendcv.com
Output: A markdown file written to specs/ with an executive summary and individual numbered test scenarios ready for the Generator agent.
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
Example prompts:
"Generate tests from specs/plan.md"
"Write a Playwright test that logs in at localhost:3000 with admin@test.com / password123"
"Create a test for the full checkout flow: add to cart β checkout β confirm order"
Trigger in VS Code:
@generator Generate Playwright tests from specs/wesendcv-plan.md
Output: TypeScript spec files dropped into the appropriate tests/ category folder, following POM conventions and importing data from tests/data/.
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
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"
Trigger in VS Code:
@api-testing Create contract tests for the /api/jobs endpoint at https://wesendcv.com/api/jobs
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
Example prompts:
"Give me a manual testing checklist for the WeSendCV homepage"
"How do I manually verify the login flow?"
"What's the regression checklist for UI testing?"
Trigger in VS Code:
@manualtesting Provide a manual regression checklist for https://wesendcv.com
Location: .github/skills/playwright-test-debugging/SKILL.md
Unlike the chatmodes above (which you invoke manually), this skill is loaded automatically by Copilot when it detects you are debugging a test failure. You do not need to select it explicitly.
What it teaches Copilot:
- Where to find test results (
test-results/results.json,junit.xml,playwright-report/) - How to identify failure types: selectors, timing, visual regression, network, accessibility
- How to reproduce failures locally with PowerShell commands
- Anti-patterns to avoid (hard sleeps, raw selectors in test files, etc.)
- POM-aware fix strategies specific to this repository's structure
Auto-triggered by prompts like:
"The wesendcv test is failing with a timeout"
"Debug the accessibility test failures in CI"
"Why is the vibe spec failing on Windows?"
For fully programmatic agent usage (no VS Code UI), start the Playwright MCP server and send chatmode prompts via API:
# Start MCP server
npx playwright run-test-mcp-server
# Or add as an npm script
npm set-script mcp:start "npx playwright run-test-mcp-server"
npm run mcp:startThe .vscode/mcp.json file pre-configures the MCP entrypoint for VS Code's agent runtime. See the Using Chatmode prompts and the MCP flow section for API-level usage examples.
| Feature | Purpose | Location | When to Use |
|---|---|---|---|
| Agent Skills | Contextual instructions auto-loaded when relevant | .github/skills/ |
Complex workflows, debugging guides, repo-specific patterns |
| Chatmodes | Role-based agent personas with dedicated toolsets | .github/chatmodes/ |
Healer, Planner, Generator, API, Manual β explicit invocation |
| Custom Instructions | Global rules applied to every Copilot interaction | .github/copilot-instructions.md |
Coding standards, architecture rules, project conventions |
- Selectors: Use stable
idordata-testattributes instead of brittle CSS/XPath. - Page Objects: Keep POM methods focused on single actions; avoid god-methods.
- Test Data: Extract URLs, credentials, and fixtures into
tests/data/files. - Artifacts: Enable traces and screenshots in
playwright.config.tsfor faster triage. - Baselines: Keep one baseline per viewport/OS if visual differences are expected.
- Isolation: Tests should be independent and idempotent; avoid test-to-test dependencies.
- No hard sleeps: Use Playwright's built-in waits (
waitForSelector,waitForNavigation, etc.). - Negative tests: Always validate error paths and edge cases alongside happy paths.
- Create
tests/pages/MyPage.ts - Import page data from
tests/data/ - Define locators as class properties
- Implement action methods (goto, click, fill, verify, etc.)
- Export the class for use in test specs
Example:
// tests/pages/LoginPage.ts
import { Page, expect } from '@playwright/test';
import { URLS } from '../data/urls';
export class LoginPage {
constructor(readonly page: Page) {}
async gotoLoginPage() {
await this.page.goto(URLS.app.login);
}
async login(username: string, password: string) {
await this.page.fill('[data-test="username"]', username);
await this.page.fill('[data-test="password"]', password);
await this.page.click('[data-test="login-btn"]');
}
}- Create
tests/data/mydata.ts - Export constants (URLs, users, products, etc.)
- Import and use in page objects and test specs
Example:
// tests/data/users.ts
export const TEST_USERS = {
standard: {
username: 'standard_user',
password: 'secret_sauce',
},
admin: {
username: 'admin',
password: 'admin_pass',
},
};- Create
tests/myfeature.spec.ts - Import page objects and test data
- Use
test.beforeEach()to initialize page objects - Write test cases focusing on workflow and assertions
- Run:
npx playwright test tests/myfeature.spec.ts
# Install
npm install
npx playwright install --with-deps
# Test
npm test # Full suite
npm run test:ci # CI-style run
npx playwright test --headed # Debug mode
npx playwright test --debug # Step through with Inspector
# Dev
node tools/dev-server.js # Start demo server
node tools/compare.js [...] # Run perceptual diff
# Clean
npm run clean # Remove artifacts (if script exists)| Issue | Solution |
|---|---|
| Tests timeout on Windows | Increase timeouts in playwright.config.ts or run with --retries=1 |
| Visual diffs fail unexpectedly | Review artifacts/diff.png and artifacts/current.png, update baseline if change is approved |
| Flaky selectors | Use data-test attributes, increase wait timeouts, avoid nth-child selectors |
| Browser install fails | Run npx playwright install --with-deps to include OS-level dependencies |
| Port 3000 already in use | Modify dev-server.js to use a different port |
| Page Object not found | Ensure import path matches file location (e.g., ./pages/WeSendCVPage) |
Copyright (c) 2024-2026 Padmaraj Nidagundi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This production-ready framework is intended for:
- β Enterprise test automation projects
- β Learning and skill development
- β Interview preparation and portfolio demonstration
- β Open-source contributions and community sharing
- β Commercial projects (no restrictions)
Feel free to adapt, extend, and use the code, patterns, and architecture in your projects.
If you find this framework valuable and use it in your projects, a mention or link back is appreciated but not required:
Based on Playwright-AI-Agent-POM-MCP-Server by Padmaraj Nidagundi
https://github.com/padmarajnidagundi/Playwright-AI-Agent-POM-MCP-Server
If you discover a security vulnerability, please report it responsibly:
- DO NOT open a public issue
- Email: padmaraj.nidagundi@gmail.com with subject "[SECURITY] Playwright Framework Vulnerability"
- Include: Description, reproduction steps, impact assessment, and suggested fix (if available)
- Expected response time: 24-48 hours
- π All dependencies regularly updated and audited
- π No hardcoded credentials or sensitive data in repository
- π Environment variables used for configuration
- π HTTPS enforced for all external requests
- π Input validation and sanitization in all test utilities
What's New:
- β¨ Added 13 comprehensive test categories
- β¨ Mobile testing support (iOS/Android emulation)
- β¨ MCP server integration for AI-assisted debugging
- β¨ Enhanced POM architecture with centralized data
- β¨ Cross-platform CI/CD (Ubuntu + Windows)
- π Fixed flaky tests in network-resilience category
- π Comprehensive documentation updates
Upgrade Path:
git pull origin main
npm install
npx playwright install --with-depsFor detailed changelog, see CHANGELOG.md (coming soon)
Padmaraj Nidagundi β Senior QA Automation Engineer & Test Automation Architect
- π― 8+ years of experience in test automation and quality engineering
- π Certified: ISTQB Advanced Test Automation Engineer, Playwright Professional
- πΌ Expertise: E2E automation, CI/CD integration, test architecture design, performance testing
- π Specializations: Playwright, Selenium, Cypress, API testing, mobile automation, visual regression testing
- π Industry Experience: FinTech, E-commerce, Healthcare, SaaS platforms
- π Technical Writer: Published articles on test automation best practices and modern QA methodologies
- Architected test frameworks for 15+ enterprise projects with 100% CI/CD integration
- Reduced test execution time by 70% through parallelization and smart test selection
- Mentored 50+ QA engineers in test automation and Playwright adoption
- Open-source contributor to Playwright community tools and extensions
π§ Email: padmaraj.nidagundi@gmail.com
πΌ LinkedIn: https://www.linkedin.com/in/padmarajn/
π GitHub: https://github.com/padmarajnidagundi/Playwright-AI-Agent-POM-MCP-Server
π¦ NpmJs: [Coming soon - Playwright utilities package]
- π¬ Questions? Open a GitHub issue
- π€ Consulting: Available for test automation consulting and training
- π Documentation: Comprehensive guides and examples in this repository
- β‘ Response Time: Typically within 24-48 hours for issues and inquiries
β
Security: No known vulnerabilities | Regular dependency updates | Secure coding practices
β
Transparency: Open-source | MIT License | Public issue tracking
β
Quality: Tested on Windows, Ubuntu, macOS | 85%+ code coverage | CI/CD validated
β
Maintenance: Actively maintained | Regular updates | Responsive to community feedback
Questions or feedback? Open an issue or reach out. Happy testing! π
See the AI Agents β Chatmodes & Skills section for a full guide on each agent and how to activate it in VS Code.
Quick: use a chatmode prompt directly with an LLM API (PowerShell + OpenAI):
$env:OPENAI_API_KEY = "sk_..."
$prompt = Get-Content ".github/chatmodes/π healer.chatmode.md" -Raw
curl -s https://api.openai.com/v1/chat/completions `
-H "Authorization: Bearer $env:OPENAI_API_KEY" `
-H "Content-Type: application/json" `
-d (@{ model = "gpt-4o-mini" ; messages = @(@{ role = "user"; content = $prompt }) } | ConvertTo-Json)Security: Never commit API keys. Use environment variables or CI secrets.
See the AI Agents β Chatmodes & Skills section for full details on the playwright-test-debugging skill and all chatmode agents.
Add project-specific skills to extend Copilot's capabilities:
mkdir .github/skills/your-skill-nameCreate .github/skills/your-skill-name/SKILL.md:
---
name: your-skill-name
description: Brief description of what this skill does and when to use it
---
# Skill Instructions
Your detailed instructions, examples, and guidelines here...Example ideas for this repo:
visual-regression-workflowβ Baseline image management guidemobile-test-creationβ Patterns for adding mobile device testspage-object-scaffoldingβ Template for creating new page objectsci-failure-analysisβ Debugging GitHub Actions workflow failures
Thank you for considering contributing to this project! Your contributions help the entire QA automation community. This framework is used by 500+ engineers worldwide, and your improvements will have real impact.
- π Build your portfolio with production-grade automation work
- π Learn best practices from code reviews and community feedback
- π€ Network with QA professionals globally
- π Grow your skills in modern test automation
- Fork the repository: Click "Fork" at the top right of the page
- Clone your fork:
git clone <your-fork-url> cd Playwright-AI-Agent-POM-MCP-Server npm install npx playwright install --with-deps
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes: Follow our coding standards (see below)
- Test your changes:
npm test npx playwright test tests/your-new-test.spec.ts
- Commit with clear messages:
git commit -m "feat: add visual regression for login page"
- Push to your fork:
git push origin feature/your-feature-name
- Create a pull request: Go to the original repo and click "New Pull Request"
- π§ͺ New test categories or patterns
- π Documentation improvements
- π Bug fixes and stability improvements
- β‘ Performance optimizations
- π¨ New page objects or test utilities
- π§ CI/CD enhancements
- π i18n test examples
- π± Mobile testing scenarios
- β Use TypeScript strict mode
- β Follow existing POM architecture
- β
Add test data to
tests/data/ - β Use stable selectors (data-test attributes preferred)
- β Write clear, descriptive test names
- β Avoid hard sleeps; use Playwright waits
- β Add JSDoc comments for public methods
- β Ensure tests pass on both Windows and Ubuntu
Before submitting:
- All tests pass locally (
npm test) - No ESLint/TypeScript errors
- Added tests for new features
- Updated documentation if needed
- Followed commit message conventions (feat/fix/docs/refactor)
PR Template:
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Performance improvement
## Testing
- [ ] Tested on Windows
- [ ] Tested on Ubuntu/macOS
- [ ] All existing tests pass
- [ ] Added new tests
## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-reviewed the code
- [ ] Documentation updatedWe are committed to providing a welcoming and inclusive environment. Please adhere to our Code of Conduct in all interactions.
Zero tolerance for:
- Harassment or discriminatory language
- Trolling or insulting comments
- Spam or off-topic discussions
All contributors will be:
- β Listed in CONTRIBUTORS.md (coming soon)
- β Mentioned in release notes for significant contributions
- β Given credit in documentation where applicable
If you have any questions:
- π¬ Open a GitHub Discussion
- π Report bugs via GitHub Issues
- π§ Email: padmaraj.nidagundi@gmail.com
Response time: Typically 24-48 hours
New to open source? No problem! Look for issues tagged with good-first-issue or help-wanted. We provide mentorship and guidance to help you succeed.
Thank you for making test automation better for everyone! π