Playwright MCP
🎭 Playwright MCP - AIを活用したテスト自動化(OrangeHRM)
PlaywrightをModel Context Protocol(MCP)と統合し、AI駆動のブラウザテスト自動化を実証するProof of Conceptプロジェクトです。テストはTypeScriptで記述され、**Page Object Model(POM)**デザインパターンを使用し、OrangeHRMデモアプリケーションを対象としています。
📋 目次
Related MCP server: MCP Playwright Server
🎯 概要
このプロジェクトは、Model Context Protocol(MCP)を介して平易な英語のプロンプトでブラウザテストを自動化できることを示しています。自動化コードのすべての行を手動で書く代わりに、テストしたい内容を自然言語で記述すると、AIが自動化の生成と実行を支援します。
主要な概念
コンポーネント | 役割 | 例え |
LLM(大規模言語モデル) | リクエストを理解し、指示を生成 | 🧠 頭脳 |
エージェント | タスクを自動的に実行 | ⚡ 実行役 |
MCP(Model Context Protocol) | AIと実際のツール(ブラウザ、APIなど)を接続 | 🔗 翻訳者 |
🏗 アーキテクチャ
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💻 技術スタック
技術 | 目的 |
Playwright ^1.60 | ブラウザ自動化フレームワーク |
プログラミング言語 | |
AIとツール間の通信プロトコル | |
データ駆動テスト用のCSV解析 | |
Node.js | ランタイム環境 |
📁 プロジェクト構成
├── 📂 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🧪 テストシナリオ
テストファイル | 説明 | パターン |
| インラインデータによるログイン検証(有効+無効な資格情報) | データ駆動 |
| CSVデータソースを使用したログイン検証 | データ駆動(CSV) |
| ログイン、ログアウト、ログインページへのリダイレクトを検証 | リニア |
| Adminに移動し、System Usersページを検証 | リニア |
| Buzzフィードにメッセージを投稿し、表示されることを検証 | リニア |
| PIMモジュールで従業員を名前で検索 | リニア |
| Page Object Modelを使用して新しい従業員を追加 | POM |
| デフォルトのPlaywrightサンプルテスト | リニア |
🚀 はじめに
前提条件
Node.js(v18以降)
[npm](https://www.npmjs.com/)
インストール
# 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▶️ テストの実行
すべてのテストを実行
npx playwright test特定のテストファイルを実行
npx playwright test tests/orangehrm-login-data-driven.spec.tsUIモードでテストを実行
npx playwright test --uiHTMLレポートを表示
npx playwright show-reportデバッグモードで実行
npx playwright test --debug🧩 Page Object Model
このプロジェクトは、保守性と再利用性に優れたテストコードのための**Page Object Model(POM)**デザインパターンを使用しています。
例: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();
}
}例:PimPage.ts
export class PimPage {
async navigateToPim() {
/* ... */
}
async openAddEmployee() {
/* ... */
}
async addEmployee(firstName: string, lastName: string) {
/* ... */
}
}📊 データ駆動テスト
インラインデータ駆動
インラインで定義された複数の資格情報でログインをテストします:
ユーザー名 | パスワード | 期待される結果 |
Admin | admin123 | ダッシュボード |
fakeuser | fakepass | 無効な資格情報 |
ESSUser1 | ess123 | 無効な資格情報 |
CSVデータ駆動
テストはtest_data/loginData.csvからテストケースを読み取ります:
Username,Password,Expected
Admin,admin123,Dashboard
fakeuser,fakepass,Invalid credentials
ESSUser1,ess123,Invalid credentials🤖 Playwright MCP vs Playwright CLI
機能 | Playwright CLI | Playwright MCP |
目的 | Playwright用のコマンドラインツール | LLMとPlaywrightを結ぶAIブリッジ |
使用者 | 開発者とテスター | AIエージェント |
入力 | ターミナルコマンド | 自然言語プロンプト |
ブラウザ制御 | Playwrightスクリプトで直接 | AI + MCPサーバー経由 |
コーディングの必要性 | 必要 | 最小限のコーディング |
コード生成 | なし | あり(AI生成) |
テスト実行 | 可能 | 可能 |
アクセシビリティツリーの使用 | なし | あり |
AI自動化のサポート | なし | あり |
最適な用途 | 従来の自動化 | AI駆動の自動化 |
📚 リソース
📄 ライセンス
このプロジェクトは教育およびデモンストレーション目的のみです。
Playwright + MCP + AIで❤️を込めて構築
This server cannot be installed
Maintenance
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
- AlicenseNot gradedqualityDmaintenanceEnables 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,713Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables 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.10MIT
- FlicenseNot gradedqualityCmaintenanceEnables AI assistants to execute browser automation, perform QA tasks, and generate test code through natural language commands using Playwright.5
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to drive Playwright-based browser automation for UI testing, returning JSON/HTML reports with screenshots without server-side LLM or test scripts.MIT
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.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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