Skip to main content
Glama

๐ŸŽญ Playwright MCP - AI-Powered Test Automation (OrangeHRM)

Playwright TypeScript MCP OrangeHRM

A Proof of Concept project demonstrating AI-powered browser test automation using Playwright integrated with the Model Context Protocol (MCP). Tests are written in TypeScript using the Page Object Model (POM) design pattern, targeting the OrangeHRM demo application.


๐Ÿ“‹ Table of Contents


Related MCP server: MCP Playwright Server

๐ŸŽฏ Overview

This project showcases how AI + Playwright can automate browser testing using plain English prompts via the Model Context Protocol (MCP). Instead of writing every line of automation code manually, you describe what you want to test in natural language, and AI helps generate and execute the automation.

Key Concepts

Component

Role

Analogy

LLM (Large Language Model)

Understands requests & generates instructions

๐Ÿง  Brain

Agent

Executes tasks automatically

โšก Doer

MCP (Model Context Protocol)

Connects AI with real tools (browsers, APIs, etc.)

๐Ÿ”— Translator


๐Ÿ— Architecture

           Plain English Prompt
                    โ”‚
                    โ–ผ
        Large Language Model (LLM)
                    โ”‚
          Generates Instructions
                    โ”‚
                    โ–ผ
                AI Agent
                    โ”‚
         Executes the Instructions
                    โ”‚
                    โ–ผ
      Model Context Protocol (MCP)
                    โ”‚
     Connects to Real Applications
                    โ”‚
                    โ–ผ
          Playwright + Browser
                    โ”‚
                    โ–ผ
          Browser Automation

๐Ÿ’ป Tech Stack

Technology

Purpose

Playwright ^1.60

Browser automation framework

TypeScript

Programming language

MCP

AI-to-tool communication protocol

csv-parse

CSV parsing for data-driven tests

Node.js

Runtime environment


๐Ÿ“ Project Structure

โ”œโ”€โ”€ ๐Ÿ“‚ pages/                          # Page Object Model classes
โ”‚   โ”œโ”€โ”€ LoginPage.ts                   # Login page locators & actions
โ”‚   โ””โ”€โ”€ PimPage.ts                     # PIM module locators & actions
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ tests/                          # Test specifications
โ”‚   โ”œโ”€โ”€ example.spec.ts                # Sample Playwright test
โ”‚   โ”œโ”€โ”€ orangehrm-login-data-driven.spec.ts       # Data-driven login (inline)
โ”‚   โ”œโ”€โ”€ orangehrm-login-data-driven-csv.spec.ts   # Data-driven login (CSV)
โ”‚   โ”œโ”€โ”€ orangehrm-logout.spec.ts                  # Logout flow test
โ”‚   โ”œโ”€โ”€ orangehrm-admin-system-users.spec.ts      # Admin module test
โ”‚   โ”œโ”€โ”€ orangehrm-buzz-post.spec.ts               # Buzz social feed test
โ”‚   โ”œโ”€โ”€ pim-search.spec.ts                        # PIM employee search
โ”‚   โ””โ”€โ”€ add-employee.spec.ts                      # Add employee (POM)
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ test_data/                     # Test data files
โ”‚   โ””โ”€โ”€ loginData.csv                 # CSV test data for login
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ playwright-report/             # HTML test reports
โ”œโ”€โ”€ ๐Ÿ“‚ test-results/                  # Test execution artifacts
โ”‚
โ”œโ”€โ”€ ๐Ÿ“„ playwright.config.ts           # Playwright configuration
โ”œโ”€โ”€ ๐Ÿ“„ package.json                   # Dependencies & scripts
โ”œโ”€โ”€ ๐Ÿ“„ README.md                      # This file
โ”‚
โ”œโ”€โ”€ ๐Ÿ“„ Playwright_MCP_Guide.md        # Detailed MCP concepts guide
โ”œโ”€โ”€ ๐Ÿ“„ PlaywrightMCP_Vs_CLI.md        # MCP vs CLI comparison
โ”œโ”€โ”€ ๐Ÿ“„ playwright-context.md          # MCP test generator context
โ”œโ”€โ”€ ๐Ÿ“„ playwright-context-pom.md      # MCP POM test generator context
โ”œโ”€โ”€ ๐Ÿ“„ prompts.md                     # Sample AI prompts used
โ””โ”€โ”€ ๐Ÿ“„ notes.md                       # Architecture & concept notes

๐Ÿงช Test Scenarios

Test File

Description

Pattern

orangehrm-login-data-driven.spec.ts

Login validation with inline data (valid + invalid credentials)

Data-Driven

orangehrm-login-data-driven-csv.spec.ts

Login validation using CSV data source

Data-Driven (CSV)

orangehrm-logout.spec.ts

Login, logout, and verify redirect to login page

Linear

orangehrm-admin-system-users.spec.ts

Navigate to Admin โ†’ verify System Users page

Linear

orangehrm-buzz-post.spec.ts

Post a message on Buzz feed and verify it appears

Linear

pim-search.spec.ts

Search employees by name in PIM module

Linear

add-employee.spec.ts

Add a new employee using Page Object Model

POM

example.spec.ts

Default Playwright sample test

Linear


๐Ÿš€ Getting Started

Prerequisites

Installation

# Clone the repository
git clone https://github.com/pavanoltraining/POC_Playwright_MCP_orangehrm.git

# Navigate to the project directory
cd POC_Playwright_MCP_orangehrm

# Install dependencies
npm install

# Install Playwright browsers
npx playwright install chromium

โ–ถ๏ธ Running Tests

Run all tests

npx playwright test

Run a specific test file

npx playwright test tests/orangehrm-login-data-driven.spec.ts

Run tests in UI mode

npx playwright test --ui

View HTML report

npx playwright show-report

Run with debug mode

npx playwright test --debug

๐Ÿงฉ Page Object Model

The project uses the Page Object Model (POM) design pattern for maintainable and reusable test code.

Example: LoginPage.ts

export class LoginPage {
  readonly usernameInput = page.getByPlaceholder("Username");
  readonly passwordInput = page.getByPlaceholder("Password");
  readonly loginButton = page.getByRole("button", { name: "Login" });

  async login(username: string, password: string) {
    await this.usernameInput.fill(username);
    await this.passwordInput.fill(password);
    await this.loginButton.click();
  }
}

Example: PimPage.ts

export class PimPage {
  async navigateToPim() {
    /* ... */
  }
  async openAddEmployee() {
    /* ... */
  }
  async addEmployee(firstName: string, lastName: string) {
    /* ... */
  }
}

๐Ÿ“Š Data-Driven Testing

Inline Data-Driven

Tests login with multiple credentials defined inline:

Username

Password

Expected Result

Admin

admin123

Dashboard

fakeuser

fakepass

Invalid credentials

ESSUser1

ess123

Invalid credentials

CSV Data-Driven

Tests read test cases from test_data/loginData.csv:

Username,Password,Expected
Admin,admin123,Dashboard
fakeuser,fakepass,Invalid credentials
ESSUser1,ess123,Invalid credentials

๐Ÿค– Playwright MCP vs Playwright CLI

Feature

Playwright CLI

Playwright MCP

Purpose

Command-line tool for Playwright

AI bridge between LLM and Playwright

Used By

Developers & Testers

AI Agents

Input

Terminal commands

Natural language prompts

Browser Control

Directly through Playwright scripts

Through AI + MCP Server

Requires Coding

Yes

Minimal coding

Generates Code

No

Yes (AI-generated)

Executes Tests

Yes

Yes

Uses Accessibility Tree

No

Yes

Supports AI Automation

No

Yes

Best For

Traditional automation

AI-powered automation


๐Ÿ“š Resources


๐Ÿ“„ License

This project is for educational and demonstration purposes only.


Built with โค๏ธ using Playwright + MCP + AI

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

โ€“Maintainers
โ€“Response time
โ€“Release cycle
โ€“Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables browser automation and web page interaction through Playwright's accessibility tree, allowing LLMs to navigate, fill forms, click elements, and extract content without requiring vision models or screenshots.
    4,588,713
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to control web browsers through Playwright automation, providing 50+ tools for navigation, interaction, testing, accessibility audits, and visual testing across Chromium, Firefox, and WebKit.
    10
    MIT

View all related MCP servers

Related MCP Connectors

  • AI QA tester โ€” real browsers scan sites for bugs, SEO, perf, and accessibility issues via chat.

  • Browser-backed QA with evidence and fix-ready reports for coding agents.

  • AI-powered browser automation โ€” navigate, click, fill forms, and extract data from any website.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pavanoltraining/POC_Playwright_MCP_orangehrm'

If you have feedback or need assistance with the MCP directory API, please join our Discord server