Migrate from Cypress or Selenium to Playwright. Use when user mentions "cypress", "selenium", "migrate tests", "convert tests", "switch to playwright", "move from cypress", or "replace selenium".
This skill guides an interactive, file-by-file migration of an existing end-to-end test suite from Cypress or Selenium/WebDriver to Playwright. It solves the tedious and error-prone problem of manually rewriting hundreds of tests across two different automation APIs by providing a structured detection, assessment, and conversion workflow along with two detailed translation reference tables (cypress-mapping.md and selenium-mapping.md).
The workflow first auto-detects the source framework (scanning for a cypress/ directory, cypress.config.ts, or selenium/webdriver dependencies in package.json or Python imports), then sizes the migration and picks an approach: direct sequential conversion for small suites, batched sub-agent conversion for medium ones, and parallel conversion for large ones. It optionally initializes Playwright, converts each file using command/action/assertion/network mappings (for example cy.visit to page.goto, driver.findElement to page.locator, explicit Selenium waits to Playwright web-first assertions), upgrades brittle CSS/ID/XPath selectors to role-based and getByTestId locators, translates Cypress custom commands into Playwright fixtures and Selenium page objects into Playwright page objects, verifies each converted file by running it, and finally cleans up old dependencies, config, and CI while asking before deleting anything.
It targets QA engineers, SDETs, and developers maintaining legacy Cypress or Selenium suites who want to adopt Playwright without a risky big-bang rewrite. Typical use cases include incremental suite modernization, one-off conversion of a single test file, and CI workflow updates.
Cypress and Selenium/WebDriver (including Python Selenium tests). It auto-detects the source by scanning for a cypress/ directory or config, and for selenium/webdriver in package.json or Python imports.
Most commands, actions, assertions, and network mocks are covered by the mapping tables, but the skill notes some tests need manual intervention and lists them in a conversion summary. It also verifies each converted file by running npx playwright test before moving on.
Only after all files are converted, and it explicitly asks the user before deleting any dependencies or config files.
Yes. It upgrades ID, class, and XPath selectors toward Playwright best practices such as getByRole and getByTestId as part of conversion.
No. If Playwright is not configured, the skill runs an init step (/pw:init) before converting files.
Quick Setup:
.claude/skills/Repository
alirezarezvani/claude-skills