test-framework-migration-skill: Migrating E2E Tests Across Selenium, Playwright, Puppeteer, and Cypress

Introduction

When teams switch their testing stack, a common practice is to manually modify locators, waits, and assertions against official documentation, and then debug the CI pipeline one test at a time. Selenium’s WebDriverWait, Playwright’s auto-wait, and Cypress’s chained cy.should do not have a one-to-one correspondence, and lifecycle management (driver / page / launch) is often prone to omissions during modification. The following is an introduction to the test-framework-migration-skill provided by TestMu AI in the LambdaTest/agent-skills repository. It codifies the process of “Identify Source and Target Frameworks → Check Reference Table → Rewrite according to Mapping” into a fixed workflow executable by an Agent, and includes reference documentation for various migration directions.

What is this

The test-framework-migration-skill is designed for AI coding assistants (such as Cursor, Claude Code, GitHub Copilot, Gemini CLI, etc.) to migrate, convert, or port test scripts between four types of E2E frameworks: Selenium, Playwright, Puppeteer, and Cypress. The Skill metadata indicates that it is maintained by TestMu AI, version 1.0, licensed under MIT, categorized as e2e-testing, and supports languages including Java, Python, JavaScript, TypeScript, and C#.

Repository path:

https://github.com/LambdaTest/agent-skills/tree/main/test-framework-migration-skill

Once the Agent loads this Skill, it follows built-in steps to act as a “Senior QA Automation Architect.” Before generating migration code, it must read the corresponding reference/<source>-to-<target>.md file, and then apply API mappings, lifecycle adjustments, and pattern conversions.

Core Features

Supported Migration Directions

The Skill provides independent reference files for the following 10 sets of “Source → Target” combinations (covering the main switches between the four frameworks in both directions):

Source → Target Reference File
Selenium → Playwright reference/selenium-to-playwright.md
Playwright → Selenium reference/playwright-to-selenium.md
Selenium → Puppeteer reference/selenium-to-puppeteer.md
Puppeteer → Selenium reference/puppeteer-to-selenium.md
Puppeteer → Playwright reference/puppeteer-to-playwright.md
Playwright → Puppeteer reference/playwright-to-puppeteer.md
Cypress → Playwright reference/cypress-to-playwright.md
Playwright → Cypress reference/playwright-to-cypress.md
Selenium → Cypress reference/selenium-to-cypress.md
Cypress → Selenium reference/cypress-to-selenium.md

If the framework pair requested by the user is not in the table, the Agent should explain that it is unsupported and suggest the closest supported migration (the documentation example mentions that references for WebDriverIO can be added later).

Five-Step Workflow

  1. Identify Source Framework: Determine whether the code is Selenium, Playwright, Puppeteer, or Cypress based on user description or characteristics in the opened file (such as By.id, page.getByRole, cy.visit, puppeteer.launch); confirm with the user if information is insufficient.
  2. Identify Target Framework: Parse the target from phrases like “to Playwright / to Selenium”; if only the source framework is mentioned, ask for the migration target.
  3. Identify Language: Prompt regarding language changes based on the source and target combination (e.g., migrating from Selenium Java/Python/C# to Playwright usually requires rewriting to JS/TS); refer to the language matrix in reference/overview.md for details.
  4. Route to Reference: Always read the matching file from the table above before generating code.
  5. Apply Mapping: Convert locators, waits, actions, assertions, and setup/teardown according to the reference; if the user runs tests in the cloud, point to the target framework’s cloud documentation (TestMu) after migration.

Mapping example (from Skill description): By.id("x") can be converted to page.getByRole(...) or page.locator('#x').

Post-Generation Validation

After producing the migration code, the Skill requires checking against the Gotchas in the reference and executing the following validation checklist:

  1. Locators, actions, and assertions have been converted according to the mapping, with no residual source framework APIs.
  2. Lifecycle is consistent with the target framework.
  3. If the target is Playwright: Use auto-wait assertions (e.g., expect(locator).toBeVisible()) and avoid bare waitForTimeout.
  4. If the target is Cypress: Do not mix async/await with cy commands; maintain the chained syntax.
  5. If the target is Selenium: Use explicit WebDriverWait instead of Thread.sleep.

Further Reading and Sibling Skills

Requirement Location
Framework comparison, when to migrate reference/overview.md
Complete migration workflow, debugging tables, CI/CD checklists reference/playbook.md
POM and cloud integration for each framework playwright-skill, selenium-skill, puppeteer-skill, cypress-skill and their respective reference/cloud-integration.md in the same repository
TestMu Cloud capabilities (all frameworks) shared/testmu-cloud-reference.md

Installation and Enablement

This Skill is distributed with the agent-skills repository. The official README requires: Node.js and npm (latest stable versions) and an installed AI coding assistant; if executing tests on the TestMu AI cloud, a TestMu AI account username and access key are also required (environment variables LT_USERNAME, LT_ACCESS_KEY). For complete steps, see the TestMu AI Agent Skills documentation.

On a machine with Node.js installed, you can use agentskillsforall to install a single Skill from GitHub (consistent with the installation method for selenium-skill and playwright-skill in the same repository):

npx agentskillsforall add https://github.com/LambdaTest/agent-skills.git --skill test-framework-migration-skill

To browse all Skills in the repository:

npx agentskillsforall list https://github.com/LambdaTest/agent-skills.git

The README also provides a method to clone the repository and execute npx agentskillsforall add in that directory; assistants like Cursor can trigger the Skill via natural language after installation is complete, without needing additional configuration file names (depending on the specific assistant’s loading mechanism for Agent Skills).

Typical Usage

The Skill’s description declares common trigger words: migrate, convert, port, as well as selenium to playwright, playwright to selenium, puppeteer to playwright, cypress to playwright, rewrite tests in, switch from [framework] to [framework], etc. Assuming the assistant has enabled this Skill, you can directly describe the migration intent and attach the test files or snippets to be modified.

Examples (natural language, consistent with official trigger scenarios):

Migrate the currently open Selenium Java test cases to Playwright TypeScript, preserving the original assertion semantics.
Convert these Cypress tests to Playwright; files use cy.get and cy.visit.

If information is incomplete, the Agent will ask follow-up questions according to the Skill, such as: “Which framework are the current tests using (Selenium, Playwright, Puppeteer, or Cypress)?” or “Do you want to migrate to Playwright, Puppeteer, Cypress, or switch languages and continue using Selenium?”

Following the steps above, the Agent will first select reference/selenium-to-playwright.md (or the corresponding path), then rewrite locators and waiting strategies according to the mapping table, and perform a self-check against the Validation Workflow at the end.

Use Cases and Notes

Who it is for: Teams maintaining multiple E2E stacks or planning to migrate from Selenium / Cypress to Playwright (or vice versa); QA and developers who want to reduce the repetitive work of “checking API reference tables + manually modifying lifecycles.”

Language and Stack: The five languages and four framework combinations listed in the metadata are not symmetrical during migration—for example, when migrating from Selenium (Java/Python/C#) to Playwright, the Skill explicitly requires informing the user that the Playwright side is usually JavaScript/TypeScript. Refer to reference/overview.md for the specific matrix.

Limitations: Currently, it only covers the four frameworks mentioned above and 10 reference paths; it cannot replace full regression testing and CI integration on the target framework. After generating code, tests still need to be executed locally or in CI. Cloud execution requires self-configuration of TestMu credentials and the target framework’s cloud integration documentation.

Difference from pure chat-based code modification: This Skill enforces a process of “Read reference first → Map → Apply Gotchas/Validation,” and links the playbook with sibling framework skills, reducing the risk of missing wait strategies or assertion style changes.

Conclusion

The test-framework-migration-skill breaks down cross-framework migration into repeatable steps for detection, routing, and mapping, and constrains output quality using paired reference documents. If you are switching your test stack between Selenium, Playwright, Puppeteer, and Cypress, you can install it from the official directory and directly state the source and target frameworks in your conversation.

Official Address: https://github.com/LambdaTest/agent-skills/tree/main/test-framework-migration-skill

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye