New: Earn 20% as an AgentAlley affiliate. Share your link and earn on every sale you refer. Join now New: Earn 20% as an affiliate. Join now

Migrate from Cypress or Selenium to Playwright

Migrate to Playwright

by alirezarezvani · MIT license · ★ 26,349 on GitHub · updated Aug 30

Migrate to Playwright cover

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".

---
name: "migrate"
description: >-
  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".
---

# Migrate to Playwright

Interactive migration from Cypress or Selenium to Playwright with file-by-file conversion.

## Input

`$ARGUMENTS` can be:
- `"from cypress"` — migrate Cypress test suite
- `"from selenium"` — migrate Selenium/WebDriver tests
- A file path: convert a specific test file

Overview

Interactive migration from Cypress or Selenium to Playwright with file-by-file conversion.

What you get

  • Conversion summaryfiles converted, total tests migrated
  • Any tests that couldn't be auto-converted (manual intervention needed)
  • Updated CI config
  • Before/after comparison of test run results
Manual install (npx, ZIP)
Claude Codenpx skills add alirezarezvani/claude-skills --skill migrate -g -a claude-code
Claude Code (manual)mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/alirezarezvani/claude-skills/tar.gz/19392f7a0826 \ | tar -xz -C ~/.claude/skills --strip-components=4 claude-skills-19392f7a0826/engineering-team/playwright-pro/skills/migrate
Windows (PowerShell)New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/e035e09b57ea9ed2788a/migrate.zip" -OutFile "$env:TEMP\migrate.zip"; Expand-Archive "$env:TEMP\migrate.zip" -DestinationPath "$HOME\.claude\skills" -Force
Claude.ai / desktopDownload the ZIP and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md4.1 KB
  • cypress-mapping.md3.6 KB
  • selenium-mapping.md4.4 KB
Read the files here
alirezarezvani/19392f73 files
Shared references1SKILL.md reads these from elsewhere in the repo. Not in the ZIP.Get them on GitHub ↗
SKILL.md
Show the full text136 lines

Migrate to Playwright

Interactive migration from Cypress or Selenium to Playwright with file-by-file conversion.

Input

$ARGUMENTS can be:

  • "from cypress" — migrate Cypress test suite
  • "from selenium" — migrate Selenium/WebDriver tests
  • A file path: convert a specific test file
  • Empty: auto-detect source framework

Steps

1. Detect Source Framework

Use Explore subagent to scan:

  • cypress/ directory or cypress.config.ts → Cypress
  • selenium, webdriver in package.json deps → Selenium
  • .py test files with selenium imports → Selenium (Python)
2. Assess Migration Scope

Count files and categorize:

Migration Assessment:
- Total test files: X
- Cypress custom commands: Y
- Cypress fixtures: Z
- Estimated effort: [small|medium|large]
Size Files Approach
Small (1-10) Convert sequentially Direct conversion
Medium (11-30) Batch in groups of 5 Use sub-agents
Large (31+) Use /batch Parallel conversion with /batch
3. Set Up Playwright (If Not Present)

Run /pw:pw-init first if Playwright isn't configured.

4. Convert Files

For each file, apply the appropriate mapping:

Cypress → Playwright

Load cypress-mapping.md for complete reference.

Key translations:

cy.visit(url)           → page.goto(url)
cy.get(selector)        → page.locator(selector) or page.getByRole(...)
cy.contains(text)       → page.getByText(text)
cy.find(selector)       → locator.locator(selector)
cy.click()              → locator.click()
cy.type(text)           → locator.fill(text)
cy.should('be.visible') → expect(locator).toBeVisible()
cy.should('have.text')  → expect(locator).toHaveText(text)
cy.intercept()          → page.route()
cy.wait('@alias')       → page.waitForResponse()
cy.fixture()            → JSON import or test data file

Cypress custom commands → Playwright fixtures or helper functions Cypress plugins → Playwright config or fixtures before/beforeEach → test.beforeAll() / test.beforeEach()

Selenium → Playwright

Load selenium-mapping.md for complete reference.

Key translations:

driver.get(url)                    → page.goto(url)
driver.findElement(By.id('x'))     → page.locator('#x') or page.getByTestId('x')
driver.findElement(By.css('.x'))   → page.locator('.x') or page.getByRole(...)
element.click()                    → locator.click()
element.sendKeys(text)             → locator.fill(text)
element.getText()                  → locator.textContent()
WebDriverWait + ExpectedConditions → expect(locator).toBeVisible()
driver.switchTo().frame()          → page.frameLocator()
Actions                            → locator.hover(), locator.dragTo()
5. Upgrade Locators

During conversion, upgrade selectors to Playwright best practices:

  • #id → getByTestId() or getByRole()
  • .class → getByRole() or getByText()
  • [data-testid] → getByTestId()
  • XPath → role-based locators
6. Convert Custom Commands / Utilities
  • Cypress custom commands → Playwright custom fixtures via test.extend()
  • Selenium page objects → Playwright page objects (keep structure, update API)
  • Shared helpers → TypeScript utility functions
7. Verify Each Converted File

After converting each file:

npx playwright test <converted-file> --reporter=list

Fix any compilation or runtime errors before moving to the next file.

8. Clean Up

After all files are converted:

  • Remove Cypress/Selenium dependencies from package.json
  • Remove old config files (cypress.config.ts, etc.)
  • Update CI workflow to use Playwright
  • Update README with new test commands

Ask user before deleting anything.

Output

  • Conversion summary: files converted, total tests migrated
  • Any tests that couldn't be auto-converted (manual intervention needed)
  • Updated CI config
  • Before/after comparison of test run results
1---
2name: "migrate"
3description: >-
4 Migrate from Cypress or Selenium to Playwright. Use when user mentions
5 "cypress", "selenium", "migrate tests", "convert tests", "switch to
6 playwright", "move from cypress", or "replace selenium".
7---
8 
9# Migrate to Playwright
10 
11Interactive migration from Cypress or Selenium to Playwright with file-by-file conversion.
12 
13## Input
14 
15`$ARGUMENTS` can be:
16- `"from cypress"` — migrate Cypress test suite
17- `"from selenium"` — migrate Selenium/WebDriver tests
18- A file path: convert a specific test file
19- Empty: auto-detect source framework
20 
21## Steps
22 
23### 1. Detect Source Framework
24 
25Use `Explore` subagent to scan:
26- `cypress/` directory or `cypress.config.ts` → Cypress
27- `selenium`, `webdriver` in `package.json` deps → Selenium
28- `.py` test files with `selenium` imports → Selenium (Python)
29 
30### 2. Assess Migration Scope
31 
32Count files and categorize:
33 
34```
35Migration Assessment:
36- Total test files: X
37- Cypress custom commands: Y
38- Cypress fixtures: Z
39- Estimated effort: [small|medium|large]
40```
41 
42| Size | Files | Approach |
43|---|---|---|
44| Small (1-10) | Convert sequentially | Direct conversion |
45| Medium (11-30) | Batch in groups of 5 | Use sub-agents |
46| Large (31+) | Use `/batch` | Parallel conversion with `/batch` |
47 
48### 3. Set Up Playwright (If Not Present)
49 
50Run `/pw:pw-init` first if Playwright isn't configured.
51 
52### 4. Convert Files
53 
54For each file, apply the appropriate mapping:
55 
56#### Cypress → Playwright
57 
58Load `cypress-mapping.md` for complete reference.
59 
60Key translations:
61```
62cy.visit(url) → page.goto(url)
63cy.get(selector) → page.locator(selector) or page.getByRole(...)
64cy.contains(text) → page.getByText(text)
65cy.find(selector) → locator.locator(selector)
66cy.click() → locator.click()
67cy.type(text) → locator.fill(text)
68cy.should('be.visible') → expect(locator).toBeVisible()
69cy.should('have.text') → expect(locator).toHaveText(text)
70cy.intercept() → page.route()
71cy.wait('@alias') → page.waitForResponse()
72cy.fixture() → JSON import or test data file
73```
74 
75**Cypress custom commands** → Playwright fixtures or helper functions
76**Cypress plugins** → Playwright config or fixtures
77**`before`/`beforeEach`** → `test.beforeAll()` / `test.beforeEach()`
78 
79#### Selenium → Playwright
80 
81Load `selenium-mapping.md` for complete reference.
82 
83Key translations:
84```
85driver.get(url) → page.goto(url)
86driver.findElement(By.id('x')) → page.locator('#x') or page.getByTestId('x')
87driver.findElement(By.css('.x')) → page.locator('.x') or page.getByRole(...)
88element.click() → locator.click()
89element.sendKeys(text) → locator.fill(text)
90element.getText() → locator.textContent()
91WebDriverWait + ExpectedConditions → expect(locator).toBeVisible()
92driver.switchTo().frame() → page.frameLocator()
93Actions → locator.hover(), locator.dragTo()
94```
95 
96### 5. Upgrade Locators
97 
98During conversion, upgrade selectors to Playwright best practices:
99- `#id` → `getByTestId()` or `getByRole()`
100- `.class` → `getByRole()` or `getByText()`
101- `[data-testid]` → `getByTestId()`
102- XPath → role-based locators
103 
104### 6. Convert Custom Commands / Utilities
105 
106- Cypress custom commands → Playwright custom fixtures via `test.extend()`
107- Selenium page objects → Playwright page objects (keep structure, update API)
108- Shared helpers → TypeScript utility functions
109 
110### 7. Verify Each Converted File
111 
112After converting each file:
113 
114```bash
115npx playwright test <converted-file> --reporter=list
116```
117 
118Fix any compilation or runtime errors before moving to the next file.
119 
120### 8. Clean Up
121 
122After all files are converted:
123- Remove Cypress/Selenium dependencies from `package.json`
124- Remove old config files (`cypress.config.ts`, etc.)
125- Update CI workflow to use Playwright
126- Update README with new test commands
127 
128Ask user before deleting anything.
129 
130## Output
131 
132- Conversion summary: files converted, total tests migrated
133- Any tests that couldn't be auto-converted (manual intervention needed)
134- Updated CI config
135- Before/after comparison of test run results
136 
View all files on GitHub →

Details

Updated
Aug 30, 2026
License
MIT
Stars on the repo
★ 26,349
Checked
Source
alirezarezvani/claude-skills ↗
Creator
alirezarezvani · 363 listings
View creator

Similar skills

See all →
SkillExtract text, tables, metadataXberg Document Extractionxberg-io/xberg · by xberg-ioExtract text, tables, metadata, and images from 107 document formats (PDF, Office, images, HTML, email, archives, academic) using Xberg. Use when writing code that calls Xberg APIs in Python, Node.js/TypeScript, Rust, or CLI. Covers installation, extraction (sync/async), configuration (OCR, chunking, output format), batch processing, error handling, and plugins.★ 9.4k GitHub starsSkillMove code from one implementation to another functionCode migrationkucherenko/jscpd · by kucherenkoMove code from one implementation to another function by function, tests first and code second, and check two implementations of one app for parity, with jscpd --compare as the progress measure and a coverage map binding each function to its tests. Use when porting a library or app to another language or framework (Java to Kotlin, JavaScript to Rust, a Python library to TypeScript, an iOS app to Android), when asked what is left to port, or when comparing the Android and iOS versions of an app.★ 6.3k GitHub starsSkillManages Ahrefs API usage in Python using ahrefs-pythonOpenClaudia/openclaudia-skills · by OpenClaudiaManages Ahrefs API usage in Python using `ahrefs-python` library. Use when working with SEO / marketing related tasks or with data including backlinks, keywords, domain ratings, organic traffic, site audits, rank tracking, and brand monitoring. Covers `ahrefs-python` usage including AhrefsClient / AsyncAhrefsClient, typed request/response models, error handling, and all API sections.★ 705 GitHub starsMCPDocx LLM translatoradeudealfluence/adeu · by dealfluenceDocx ↔ LLM translator. Projects .docx office files to Markdown for editing. Projects edits back to OOXML as tracked changes (redlines). Python and Node.js implementations.★ 165 GitHub starsSkillCreate an Amazon-compliant white-background main imageAmazon White-Background Main Image · 亚马逊白底主图xianyu110/ecommerce-image-skills · by xianyu110Create an Amazon-compliant white-background main image (pure #FFFFFF background, product fills ≥85% of the frame, no text, props or watermark) from a product photo with GPT Image 2.5, then verify it with a Python check script. Use for Amazon/Walmart/eBay main images, 白底图, 白底主图, hero image, listing main photo.★ 92 GitHub starsMCPOfficial monorepo of SDKs, CLISendmux sdkSendmux/sendmux-sdk · by SendmuxOfficial monorepo of SDKs, CLI, and MCP servers for Sendmux email APIs across TypeScript, Python, Go, PHP, Rust, and Ruby.★ 65 GitHub stars

More from alirezarezvani

SkillResume a paused experiment/ar:ar-resume — Resume Experimentalirezarezvani/claude-skills · by alirezarezvaniResume a paused experiment. Checkout the experiment branch, read results history, continue iterating. Use when the user runs /ar:ar-resume or asks to pick up a previously started autoresearch experiment.★ 26.3k GitHub starsSkillShow experiment dashboard with results, active loops/ar:ar-status — Experiment Dashboardalirezarezvani/claude-skills · by alirezarezvaniShow experiment dashboard with results, active loops, and progress. Use when the user runs /ar:ar-status or asks how an autoresearch experiment is going.★ 26.3k GitHub starsSkillStart an autonomous experiment loop with user-selected/ar:loop — Autonomous Experiment Loopalirezarezvani/claude-skills · by alirezarezvaniStart an autonomous experiment loop with user-selected interval (10min, 1h, daily, weekly, monthly). Uses CronCreate for scheduling. Use when the user runs /ar:loop or asks to run an autoresearch experiment continuously on a schedule.★ 26.3k GitHub starsSkillRun a single experiment iteration/ar:run — Single Experiment Iterationalirezarezvani/claude-skills · by alirezarezvaniRun a single experiment iteration. Edit the target file, evaluate, keep or discard. Use when the user runs /ar:run or asks for one manual autoresearch iteration.★ 26.3k GitHub starsSkillSet up a new autoresearch experiment interactively/ar:setup — Create New Experimentalirezarezvani/claude-skills · by alirezarezvaniSet up a new autoresearch experiment interactively. Collects domain, target file, eval command, metric, direction, and evaluator. Use when the user runs /ar:setup or asks to start optimizing a file with the autoresearch loop.★ 26.3k GitHub starsSkill/cs:boardroom <brief/cs:boardroom — Multi-Role Boardroom Deliberationalirezarezvani/claude-skills · by alirezarezvani/cs:boardroom <brief> — 6-phase multi-role deliberation across the C-suite with Phase 2 isolation, critic pre-screen, and synthesis. Outputs a board memo. Use when a decision spans multiple executive domains — e.g. a pricing change touching finance, positioning, and product, or a raise-vs-cut runway call.★ 26.3k GitHub stars