Analyzes WebDriverIO test files and migrates them to Playwright using AST-based transformations, including test structure analysis, selector conversion, command mapping, and Page Object Model refactoring.
MCP Server - Test Migration (WDIO to Playwright)
An MCP (Model Context Protocol) server that helps migrate test automation projects from WebDriverIO to Playwright test framework using AST-based transformations.
Features
This MCP server provides specialized tools for a complete migration workflow:
1. analyze_wdio_test
Analyzes WebDriverIO test files using AST parsing and extracts:
Import statements and dependencies
Test structure (describe blocks, test cases)
Selectors used (CSS, XPath, data-test-id, etc.)
WDIO commands and patterns
Assertions libraries
Hooks (before, after, etc.)
Page Object usage detection
Framework detection (WDIO, Playwright, or mixed)
Migration complexity assessment
Modern selector suggestions (getByTestId, getByRole, etc.)
2. migrate_to_playwright
Migrates WDIO tests to Playwright using AST transformation:
Converts WDIO syntax to Playwright syntax
Updates selectors to use Playwright locators
Suggests modern locators (getByTestId with
data-test-id)Replaces WDIO commands with Playwright equivalents
Uses latest Playwright v1.57 best practices
Removes unnecessary explicit waits (leverages auto-waiting)
Converts assertions to Playwright's expect
Preserves already-migrated code (supports partial migrations)
3. refactor_to_pom
Refactors migrated tests to use Page Object Model:
Extracts page interactions into page classes
Generates actual locator properties from test code
Creates reusable page object files
Applies Playwright POM patterns
Supports existing page objects
4. get_playwright_docs
Retrieves relevant Playwright documentation:
Selectors and locators (with data-test-id examples)
Assertions
Fixtures
Page Object Model
Auto-waiting behavior
Configuration
5. compare_frameworks
Provides side-by-side comparison:
50+ WDIO commands → Playwright equivalents
Syntax differences
Best practice recommendations
Related commands table
6. detect_project_state (NEW)
Analyzes project structure to detect:
Existing Playwright configuration
Existing WDIO configuration
Already migrated tests
Partially migrated tests
Existing page objects
Project directory structure
Recommendations for migration strategy
7. migrate_config
Migrates wdio.conf.js to playwright.config.ts:
Extracts baseUrl, specs, capabilities
Generates proper Playwright config
Sets
testIdAttribute: 'data-test-id'Merges with existing Playwright config if present
8. register_custom_commands (NEW)
Registers project-specific custom WDIO commands:
Add custom command → Playwright mappings
Commands are used in subsequent migrations
Persists during server session
9. generate_migration_report (NEW)
Generates comprehensive migration report as markdown:
Migration statistics (total, migrated, pending, failed)
Tags summary with Playwright grep commands
File-by-file status
Detailed test list with tags
Tag Migration
The tool automatically migrates test tags from WDIO to Playwright format:
WDIO (tags in description):
Playwright (tag annotations):
Run tests by tag: npx playwright test --grep @smoke
Installation
Usage
As MCP Server (stdio - Local)
Add to your MCP client configuration (e.g., Claude Desktop, GitHub Copilot):
Standalone (stdio)
HTTP Server (Remote/Docker)
Run the HTTP server for remote access:
The server will be available at http://localhost:3000
Docker Deployment
Build and run with Docker:
HTTP API Endpoints
When running in HTTP mode, the following endpoints are available:
Endpoint | Method | Description |
| GET | API documentation |
| GET | Health check |
| POST | MCP Streamable HTTP (recommended) |
| GET | MCP SSE stream for responses |
| DELETE | Close MCP session |
| GET | Legacy SSE connection |
| POST | Analyze WDIO test |
| POST | Migrate to Playwright |
| POST | Refactor to Page Object Model |
| POST | Compare WDIO/Playwright commands |
| GET | Get Playwright documentation |
| POST | Detect project state |
| POST | Migrate wdio.conf.js |
| POST | Register custom commands |
| POST | Generate migration report |
HTTP API Examples
Connecting MCP Clients to HTTP Server
For MCP clients that support Streamable HTTP transport (recommended):
For legacy clients using SSE transport:
Example Configuration Files
See the examples/ directory for ready-to-use configuration files:
mcp-config-local.json- Local stdio modemcp-config-http-local.json- Local HTTP/SSE modemcp-config-http-remote.json- Remote HTTP/SSE modemcp-config-docker-stdio.json- Docker with stdio
For detailed configuration options, see docs/client-configuration.md
Migration Workflow
Step 0: Detect Project State (Recommended)
Step 1: Analyze
Step 2: Migrate Config (if needed)
Step 3: Migrate Tests
Step 4: Refactor to POM
Step 5: Verify
Example
Original WDIO Test:
After Migration (Step 2):
After POM Refactoring (Step 3):
Key Migration Concepts
WDIO → Playwright Mapping
WDIO | Playwright |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Playwright Advantages
Auto-waiting: No need for explicit waits in most cases
Web-first assertions: Built-in retry logic
Modern selectors: getByRole, getByText, getByLabel, getByTestId
data-test-id support: Configure with
testIdAttribute: 'data-test-id'Better debugging: Playwright Inspector, trace viewer
Parallel execution: Built-in support
Multiple browsers: Chromium, Firefox, WebKit
AST-based migration: Accurate code transformation
Key Improvements in v2.0
AST-based parsing: Uses Babel parser for accurate code analysis and transformation
Complete command mappings: 50+ WDIO commands mapped to Playwright equivalents
Modern locator suggestions: Recommends getByTestId, getByRole, getByLabel
data-test-id support: Uses
data-test-idattribute (configurable)Partial migration support: Detects and preserves already-migrated code
Project state detection: Understands existing Playwright setup
Config migration: Converts wdio.conf.js to playwright.config.ts
Smart POM generation: Extracts actual selectors into page object classes
TypeScript output: Full TypeScript support with type annotations
Tag migration: Converts
[TAG],@tag,#tagto Playwright annotationsCustom commands: Register project-specific WDIO commands
Migration reports: Generate comprehensive markdown reports
Requirements
Node.js 18+
@modelcontextprotocol/sdk
@babel/parser, @babel/traverse, @babel/generator (for AST)
express (for HTTP server)
Project Structure
License
MIT
Author
Luca Donnaloia
Contributing
Contributions welcome! Please feel free to submit pull requests or open issues.
Roadmap
AST-based parsing and transformation
Complete command mappings (50+)
Modern locator suggestions
Project state detection
Config migration
Partial migration support
TypeScript output support
Custom WDIO commands handling
Migrate tests tag
[TAG],@tag,#tagto Playwright tag annotationsMigration report generation with tags summary
SOLID principles refactoring
WDIO services migration (custom services)
Visual comparison of test coverage by tags
Batch file processing