compare_frameworks
Compare WDIO and Playwright commands side by side to identify equivalent functionality when migrating test automation projects.
Instructions
Compares WDIO and Playwright commands/concepts side by side. Helps understand equivalent functionality.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wdioCommand | Yes | The WDIO command or pattern to find Playwright equivalent for |
Implementation Reference
- src/handlers/toolHandlers.js:166-228 (handler)Handler function for the compare_frameworks tool, which compares WDIO commands to their Playwright equivalents.
export async function handleCompareFrameworks(args) { const { wdioCommand } = args; const mapping = COMMAND_MAPPINGS[wdioCommand]; let playwrightEquivalent; if (mapping) { playwrightEquivalent = `**${mapping.method}**${mapping.options ? ` with options: ${mapping.options}` : ''}\n\n${mapping.description}`; } else { const partialMatch = Object.entries(COMMAND_MAPPINGS).find(([key]) => key.toLowerCase().includes(wdioCommand.toLowerCase()) || wdioCommand.toLowerCase().includes(key.toLowerCase()) ); if (partialMatch) { const [key, val] = partialMatch; playwrightEquivalent = `Did you mean **${key}**?\n\nPlaywright: **${val.method}**\n\n${val.description}`; } else { playwrightEquivalent = `No direct mapping found for "${wdioCommand}". Common unmapped commands may need custom implementation. Check Playwright documentation: https://playwright.dev/docs/api/class-page`; } } const relatedCommands = Object.entries(COMMAND_MAPPINGS) .filter(([key]) => { const category = wdioCommand.split('.')[0]; return key.startsWith(category) || key.includes(wdioCommand.slice(0, 4)); }) .slice(0, 10); let relatedTable = ''; if (relatedCommands.length > 0) { relatedTable = `\n\n## Related Commands:\n\n| WDIO | Playwright | Description |\n|------|------------|-------------|\n`; relatedCommands.forEach(([wdio, pw]) => { relatedTable += `| ${wdio} | ${pw.method} | ${pw.description} |\n`; }); } return { content: [{ type: 'text', text: `# WDIO to Playwright Command Comparison ## WDIO: \`${wdioCommand}\` ## Playwright Equivalent: ${playwrightEquivalent} ${relatedTable} ## Key Differences: - Playwright has built-in auto-waiting for most actions - Playwright uses Locators with strict mode by default - Playwright assertions have built-in retry logic - No need for explicit waits in most cases - Use \`page.getByTestId()\` with \`data-test-id\` attribute for reliable selectors Reference: https://playwright.dev/docs/api/class-locator `, }], }; }