migrate by alirezarezvani/claude-skills
npx skills add https://github.com/alirezarezvani/claude-skills --skill migrate通过逐文件转换,实现从 Cypress 或 Selenium 到 Playwright 的交互式迁移。
$ARGUMENTS 可以是:
"from cypress" — 迁移 Cypress 测试套件"from selenium" — 迁移 Selenium/WebDriver 测试使用 Explore 子代理进行扫描:
cypress/ 目录或 cypress.config.ts → Cypresspackage.json 依赖项中的 、 → Selenium广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
seleniumwebdriverselenium 导入的 .py 测试文件 → Selenium (Python)统计文件数量并进行分类:
迁移评估:
- 测试文件总数:X
- Cypress 自定义命令:Y
- Cypress 固定数据:Z
- 预估工作量:[小|中|大]
| 规模 | 文件数 | 方法 |
|---|---|---|
| 小 (1-10) | 顺序转换 | 直接转换 |
| 中 (11-30) | 每 5 个文件为一组分批处理 | 使用子代理 |
| 大 (31+) | 使用 /batch | 使用 /batch 进行并行转换 |
如果 Playwright 未配置,请先运行 /pw:init。
对每个文件应用相应的映射关系:
加载 cypress-mapping.md 以获取完整参考。
关键转换:
cy.visit(url) → page.goto(url)
cy.get(selector) → page.locator(selector) 或 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 导入或测试数据文件
Cypress 自定义命令 → Playwright 固定数据或辅助函数 Cypress 插件 → Playwright 配置或固定数据 before/beforeEach → test.beforeAll() / test.beforeEach()
加载 selenium-mapping.md 以获取完整参考。
关键转换:
driver.get(url) → page.goto(url)
driver.findElement(By.id('x')) → page.locator('#x') 或 page.getByTestId('x')
driver.findElement(By.css('.x')) → page.locator('.x') 或 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()
在转换过程中,将选择器升级为 Playwright 最佳实践:
#id → getByTestId() 或 getByRole().class → getByRole() 或 getByText()[data-testid] → getByTestId()test.extend() 转换为 Playwright 自定义固定数据转换每个文件后:
npx playwright test <converted-file> --reporter=list
在移动到下一个文件之前,修复任何编译或运行时错误。
所有文件转换完成后:
package.json 中移除 Cypress/Selenium 依赖项cypress.config.ts 等)删除任何内容前需询问用户。
每周安装次数
63
仓库
GitHub 星标数
3.6K
首次出现
6 天前
安全审计
安装于
codex59
github-copilot58
gemini-cli58
kimi-cli58
cursor58
opencode58
Interactive migration from Cypress or Selenium to Playwright with file-by-file conversion.
$ARGUMENTS can be:
"from cypress" — migrate Cypress test suite"from selenium" — migrate Selenium/WebDriver testsUse Explore subagent to scan:
cypress/ directory or cypress.config.ts → Cypressselenium, webdriver in package.json deps → Selenium.py test files with selenium imports → Selenium (Python)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 |
Run /pw:init first if Playwright isn't configured.
For each file, apply the appropriate mapping:
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()
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()
During conversion, upgrade selectors to Playwright best practices:
#id → getByTestId() or getByRole().class → getByRole() or getByText()[data-testid] → getByTestId()test.extend()After converting each file:
npx playwright test <converted-file> --reporter=list
Fix any compilation or runtime errors before moving to the next file.
After all files are converted:
package.jsoncypress.config.ts, etc.)Ask user before deleting anything.
Weekly Installs
63
Repository
GitHub Stars
3.6K
First Seen
6 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex59
github-copilot58
gemini-cli58
kimi-cli58
cursor58
opencode58
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
27,400 周安装