analyze_wdio_test
Analyzes WebDriverIO test files to extract structure, selectors, and commands, identifying migration readiness for Playwright conversion.
Instructions
Analyzes a WebDriverIO test file using AST parsing and extracts detailed information about its structure, selectors, commands, and dependencies. Detects if test is already partially migrated to Playwright.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"testContent": "<testContent>"
},
"name": "analyze_wdio_test"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| testContent | Yes | The complete content of the WDIO test file to analyze | |
| filePath | No | Optional file path for context |
Implementation Reference
- src/handlers/toolHandlers.js:19-54 (handler)The handler function that analyzes WDIO test code, parsing the AST, detecting framework, and generating insights and recommendations.
export async function handleAnalyzeWdioTest(args) { const { testContent, filePath = 'unknown.js' } = args; const ast = parseCode(testContent); const framework = detectFramework(ast); const astInfo = extractAstInfo(ast); const selectorSuggestions = generateSelectorSuggestions(astInfo.selectors); const analysis = { filePath, framework, structure: { imports: astInfo.imports, describes: astInfo.describes, tests: astInfo.tests, hooks: astInfo.hooks, }, selectors: { found: astInfo.selectors, suggestions: selectorSuggestions, }, commands: astInfo.commands, assertions: astInfo.assertions, pageObjects: astInfo.pageObjectUsage, tags: astInfo.tags, complexity: calculateComplexity(astInfo), recommendations: generateRecommendations(framework, astInfo), }; return { content: [{ type: 'text', text: JSON.stringify(analysis, null, 2), }], }; }