MCP Test Automation Framework
Enables AI-powered web test automation with self-healing locators and automatic GitHub checkin.
README
🤖 MCP Test Automation Framework
SQA Test Automation powered by Claude/Deepseek AI with self-healing locators and auto GitHub checkin
🏗️ Architecture
mcp-automation/
├── src/
│ ├── mcp/ # MCP Server (connects AI to browser)
│ │ ├── mcp-server.ts # MCP tool definitions & handlers
│ │ └── index.ts
│ ├── core/ # Core modules
│ │ ├── browser-manager.ts # Playwright browser lifecycle
│ │ ├── config.ts # Settings loader
│ │ └── logger.ts # Logging utility
│ ├── healing/ # Self-Healing Engine
│ │ └── locator-healer.ts # Alternative locator strategies
│ ├── scripts/ # Utility scripts
│ │ └── git-auto-checkin.ts # Auto commit & push to GitHub
│ ├── tests/ # Test definitions
│ │ ├── types.ts
│ │ └── google-search.ts
│ ├── mcp-server-entry.ts # MCP server entry point
│ └── runner.ts # Direct test runner
├── config/
│ └── settings.json # Framework configuration
├── logs/ # Run logs & screenshots
├── .github/workflows/ # CI/CD pipeline
├── package.json
├── tsconfig.json
└── README.md
🔄 How It Works
1. AI (Claude/Deepseek) calls MCP tool
│
▼
2. Playwright executes browser action
│
▼
3. Element not found?
│
▼
4. Self-Healing Engine kicks in
┌─────────────────────────────┐
│ Tries: role → text → │
│ placeholder → label → testId│
│ → CSS → XPath → aria-label │
└─────────────────────────────┘
│
▼
5. Found? → Logs healing action, proceeds
Not found? → Screenshot, reports failure
│
▼
6. GitHub Auto Checkin
┌─────────────────────────────┐
│ Creates branch │
│ test-run/<name>-<timestamp> │
│ Stages & commits all files │
│ Pushes to remote │
└─────────────────────────────┘
🚀 Quick Start
1. Install dependencies
npm install
npx playwright install chromium
2. Configure
Edit config/settings.json:
- Set AI provider and API keys (via env vars)
- Configure browser options
- Set GitHub remote URL
3. Set API Keys (optional — for AI features)
set ANTHROPIC_API_KEY=sk-ant-... # For Claude
set DEEPSEEK_API_KEY=sk-... # For Deepseek
4. Run tests directly
npm run dev
5. Start MCP Server (for AI assistant connection)
npm run mcp-server
Then connect your AI assistant (Claude/Deepseek) to this MCP server.
🛠️ MCP Tools Available to AI
| Tool | Description |
|---|---|
navigate |
Navigate to a URL |
click |
Click an element (with self-healing) |
type / fill |
Type text into fields (with self-healing) |
get_text |
Get element text (with self-healing) |
wait_for_selector |
Wait for element to appear |
screenshot |
Capture page screenshot |
press_key |
Press keyboard keys |
run_test |
Execute a full test case |
auto_checkin |
Commit & push to GitHub |
get_healing_summary |
View self-healing stats |
🧪 Self-Healing
When a locator fails, the engine tries these strategies in order:
getByRole— Find by ARIA rolegetByText— Find by text contentgetByPlaceholder— Find by placeholder attributegetByLabel— Find by associated labelgetByTestId— Find bydata-testid- CSS selector — Try original selector as CSS
- CSS alternatives — e.g.,
textarea→input, attribute variations [aria-label]— Find by aria-label attribute
All healing actions are logged to logs/healing-log.json.
📤 GitHub Auto Checkin
After each test run, the framework automatically:
- Creates a new branch:
test-run/<test-name>-<timestamp> - Stages all changed files (tests, logs, screenshots)
- Commits with descriptive message
- Pushes to remote
🔧 Configuration
See config/settings.json for all options:
| Section | Key | Description |
|---|---|---|
ai |
provider |
"auto", "claude", or "deepseek" |
browser |
headless |
true/false for headed mode |
selfHealing |
enabled |
Enable/disable self-healing |
selfHealing |
maxRetries |
Max healing attempts per locator |
github |
autoCheckin |
Enable auto commit/push |
logging |
level |
"debug", "info", "warn", "error" |
📄 License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。