freshcrate
Home > MCP Servers > Playwright-AI-Agent-POM-MCP-Server

Playwright-AI-Agent-POM-MCP-Server

Playwright AI Agent POM MCP ServerPlaywright AI Agent using Page Object Model (POM) architecture with MCP Server integration for automated web and mobile testing

Description

Playwright AI Agent POM MCP ServerPlaywright AI Agent using Page Object Model (POM) architecture with MCP Server integration for automated web and mobile testing

README

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

Build Status License NPM Version Playwright TypeScript Tests Coverage Downloads Stars Last Updated Ask DeepWiki

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

Padmaraj-nidagundi-Playwright-AI-Agent-POM-MCP-Server

What This Repo Demonstrates

Battle-tested patterns from production environments:

  • Motion sampling: Capture requestAnimationFrame timestamps and compute timing gaps to assert animation health. Used to validate 60fps performance in financial trading dashboards.
  • Perceptual diffs: Pixel-level comparison using pixelmatch with baseline image workflow and diff artifacts. Catches visual regressions before production deployment.
  • Playwright setup: playwright.config.ts with embedded webServer for 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 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)

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

Playwright CLI Usage and Skills Installation

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.

Install Playwright CLI

It is recommended to install the official Playwright CLI globally:

npm install -g @playwright/cli

Using the CLI

You 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.ts

Installing Agent Skills

To enable Copilot or agent workflows with repository-specific skills, use the following command:

playwright install --skills

This 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/cli for the latest features and compatibility.

Windows PowerShell

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

macOS / Linux (bash/zsh)

cd ~/Playwright-AI-Agent-POM-MCP-Server

npm install
npx playwright install

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 runs npm test
  • .dockerignore β€” excludes heavy local artifacts from image build context
  • docker-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 run test:ci

Matches the GitHub Actions pipeline configuration.

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.png against baseline.png.
  • Writes diff.png highlighting 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 ci and npx playwright install --with-deps
  • Executes npm run test:ci on ubuntu-latest and windows-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 audit in 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.yml includes 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.3

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:

  1. GitHub detects a new push or pull request
  2. Workflow triggers automatically (no manual action needed)
  3. Dependencies are installed and Playwright browsers are set up
  4. All test suites run across multiple OS/Node versions
  5. Test reports and artifacts are uploaded
  6. 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

Release History

VersionChangesUrgencyDate
0.0.0No release found β€” using repo HEADHigh4/21/2026

Similar Packages

c4-genai-suitec4 GenAI Suitev9.19.3
discord-opsAgency-grade Discord MCP server β€” multi-guild project routing, AI-native notifications, and DevOps workflows for Claude Code and other AI agentsv0.23.0
titan-agentTITAN β€” Autonomous AI agent framework with self-improvement, multi-agent orchestration, 36 LLM providers, 16 channel adapters, GPU VRAM management, mesh networking, LiveKit voice, TITAN-Soma homeostat4.13.0
taleThe Sovereign AI Platform​ β€” Local AI models, agents, skills, and automations β€” on your own infrastructure, connected to your datav0.2.53
keryxKeryx: The Fullstack TypeScript Framework for MCP and APIsv0.25.1