Skip to main content
Glama

🎭 Playwright MCP - AIを活用したテスト自動化(OrangeHRM)

Playwright TypeScript MCP OrangeHRM

PlaywrightModel 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

ブラウザ自動化フレームワーク

TypeScript

プログラミング言語

MCP

AIとツール間の通信プロトコル

csv-parse

データ駆動テスト用の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

🧪 テストシナリオ

テストファイル

説明

パターン

orangehrm-login-data-driven.spec.ts

インラインデータによるログイン検証(有効+無効な資格情報)

データ駆動

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

CSVデータソースを使用したログイン検証

データ駆動(CSV)

orangehrm-logout.spec.ts

ログイン、ログアウト、ログインページへのリダイレクトを検証

リニア

orangehrm-admin-system-users.spec.ts

Adminに移動し、System Usersページを検証

リニア

orangehrm-buzz-post.spec.ts

Buzzフィードにメッセージを投稿し、表示されることを検証

リニア

pim-search.spec.ts

PIMモジュールで従業員を名前で検索

リニア

add-employee.spec.ts

Page Object Modelを使用して新しい従業員を追加

POM

example.spec.ts

デフォルトのPlaywrightサンプルテスト

リニア


🚀 はじめに

前提条件

インストール

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

UIモードでテストを実行

npx playwright test --ui

HTMLレポートを表示

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で❤️を込めて構築

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