130 / 139 · 13 Browser Automation with Playwright · Migration and Comparison← prev⊞ allnext →☰ Read as one page
15.5Migrating from Cypress to Playwright
| Cypress Pattern | Playwright Equivalent |
|---|---|
cy.visit('/page') |
await page.goto('/page') |
cy.get('[data-cy="x"]') |
page.getByTestId('x') |
cy.contains('text') |
page.getByText('text') |
cy.intercept() |
page.route() |
cy.fixture('data.json') |
Custom fixture or import |
beforeEach() |
test.beforeEach() or fixtures |
| Cypress Cloud (parallel) | Built-in sharding |
Key Differences to Watch
- Cypress commands are automatically chained and retried; Playwright uses
async/awaitexplicitly - Cypress runs inside the browser (single-origin limitation); Playwright controls from outside (multi-origin supported)
- Cypress has no multi-tab support; Playwright handles tabs natively