MCP Test Automation Framework

rabbiyamehmood/mcp-test
0 starsCommunity

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

Enables AI-powered web test automation with self-healing locators and automatic GitHub checkin.

README.md

πŸ€– 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:

  1. getByRole β€” Find by ARIA role
  2. getByText β€” Find by text content
  3. getByPlaceholder β€” Find by placeholder attribute
  4. getByLabel β€” Find by associated label
  5. getByTestId β€” Find by data-testid
  6. CSS selector β€” Try original selector as CSS
  7. CSS alternatives β€” e.g., textarea β†’ input, attribute variations
  8. [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:

  1. Creates a new branch: test-run/<test-name>-<timestamp>
  2. Stages all changed files (tests, logs, screenshots)
  3. Commits with descriptive message
  4. 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

Related MCP servers

Browse all β†’