← All posts
GUIDE

Cypress to Playwright Migration: A Step-by-Step Guide

Cypress to Playwright migration: a test suite moving from Cypress commands to Playwright tests running in parallel

Short answer: a Cypress to Playwright migration means rewriting your end-to-end tests from Cypress’s chained cy commands into Playwright’s async/await API, then moving CI, fixtures and network mocks across. Do it in phases: run both suites side by side, move the most valuable tests first, and switch off Cypress only when Playwright covers the same journeys and stays green.

Key takeaways

  • Migrate when you need what Cypress makes hard: free parallel runs across CI machines, multiple tabs or browsers in one test, or stable WebKit (Safari engine) coverage.
  • Most of the work is not syntax. It is replacing cy.intercept mocks, custom commands, fixtures and CI setup.
  • Fix or delete flaky Cypress tests first. Flaky tests stay flaky after a rewrite.
  • Run both suites in CI during the move, and retire Cypress tests only after their Playwright versions pass reliably.
  • Expect a few weeks for a suite of a couple of hundred tests with one engineer, longer with heavy custom commands.
QuestionCypress to Playwright migration at a glance
What changes?Test syntax, waiting model, network mocking, fixtures, CI config and reporting
Biggest winsBuilt-in sharding and parallel workers, Chromium, Firefox and WebKit, multi-tab and multi-origin tests, trace viewer
Biggest costsRewriting custom commands and mocks, retraining the team, running two suites for a while
Recommended approachPhased: highest-value journeys first, both suites in CI until coverage matches
Typical timelineRoughly 2–6 weeks for 100–300 tests (estimate; depends on custom commands and flakiness)
Do not migrate ifYour Cypress suite is stable, fast enough and covers the browsers you need

Why do teams migrate from Cypress to Playwright?

Teams rarely migrate because Cypress is broken. They migrate because their product or pipeline outgrew one of Cypress’s design choices. Cypress’s own trade-offs page explains that tests run inside the browser and that Cypress controls one browser at a time, with each test bound to a single superdomain unless you use cy.origin.

  • Parallel runs cost money or effort. Cypress runs tests in parallel across machines as recorded runs, which its parallelization guide ties to the --record flag and Cypress Cloud. Playwright runs test files in parallel worker processes by default and shards across machines with a built-in --shard flag.
  • Safari coverage matters. Cypress lists WebKit support as experimental. Playwright runs Chromium, Firefox and WebKit as standard.
  • Flows cross tabs, windows or domains. Payments, SSO logins and “open in new tab” flows need workarounds in Cypress. Playwright handles multiple pages, browser contexts and origins in one test.
  • Debugging CI failures is slow. Playwright’s trace viewer records DOM snapshots for every action plus network, console and errors, so you can replay a CI failure step by step.

The wider market has moved the same way. Checkly reported in June 2024 that Playwright had passed Cypress in npm downloads, which matters for hiring and for how quickly tools and answers appear for each framework.

When should you not migrate?

A migration costs engineer weeks and slows new test coverage while it runs. Stay on Cypress if:

  • Your suite is stable, runs fast enough in CI and nobody fights it each sprint.
  • Your users are on Chrome-family browsers and you do not need Safari coverage.
  • Your flows stay on one domain and one tab.
  • You rely heavily on Cypress component testing and have no capacity to move it as well.

If the real problem is flaky or slow tests, fixing them in Cypress may be cheaper than a rewrite. Our guide to flaky Playwright tests covers causes, such as shared test data and timing assumptions, that apply to Cypress too.

How do Cypress and Playwright differ?

CypressPlaywright
Where tests runInside the browser, next to your appIn Node.js, driving the browser from outside
SyntaxChained cy commands, queued and retriedasync/await with auto-waiting actions and web-first assertions
BrowsersChrome-family, Firefox; WebKit experimentalChromium, Firefox and WebKit, plus branded Chrome and Edge
Tabs and originsOne browser at a time; cy.origin for other domainsMultiple pages, contexts and origins in one test
Parallel runsAcross machines as recorded runs (Cypress Cloud)Parallel workers by default; --shard across machines
Network mockingcy.interceptpage.route and route.fulfill
DebuggingInteractive runner with time travelTrace viewer, UI mode, codegen
LanguagesJavaScript and TypeScriptJavaScript/TypeScript, Python, Java and .NET

How do Cypress commands map to Playwright?

Most commands have a direct equivalent. The main mental shift is that Playwright actions are awaited and auto-wait for elements to be visible, stable, enabled and able to receive events, as described in its actionability docs. You stop writing cy.wait and chained .should checks for timing.

CypressPlaywright
cy.visit('/login')await page.goto('/login')
cy.get('[data-test=email]').type('a@b.com')await page.getByTestId('email').fill('a@b.com')
cy.contains('Sign in').click()await page.getByRole('button', { name: 'Sign in' }).click()
cy.get('.toast').should('be.visible')await expect(page.locator('.toast')).toBeVisible()
cy.url().should('include', '/dashboard')await expect(page).toHaveURL(/dashboard/)
cy.intercept('GET', '/api/user', { fixture: 'user.json' })await page.route('**/api/user', r => r.fulfill({ path: 'user.json' }))
cy.wait('@getUser')await page.waitForResponse('**/api/user')
Cypress.Commands.add('login', …)A fixture or helper function, or storageState for a saved login
beforeEach(() => cy.login())test.use({ storageState: 'auth.json' })
cy.request('POST', '/api/seed')await request.post('/api/seed')

Here is one small test before and after:

login.cy.js (Cypress)
describe('login', () => {
  it('signs in', () => {
    cy.visit('/login')
    cy.get('[data-test=email]').type('qa@example.com')
    cy.get('[data-test=password]').type('secret')
    cy.contains('Sign in').click()
    cy.url().should('include', '/dashboard')
  })
})
login.spec.ts (Playwright)
import { test, expect } from '@playwright/test'

test('signs in', async ({ page }) => {
  await page.goto('/login')
  await page.getByTestId('email').fill('qa@example.com')
  await page.getByTestId('password').fill('secret')
  await page.getByRole('button', { name: 'Sign in' }).click()
  await expect(page).toHaveURL(/dashboard/)
})

Playwright’s getByTestId reads data-testid by default. If your Cypress suite uses data-test or data-cy, set testIdAttribute in playwright.config so you can keep your existing attributes.

How do you migrate step by step?

A phased plan keeps coverage in CI the whole time:

  1. 1 Audit the Cypress suite.List every spec with its run time, flake rate and the journey it protects. Delete tests nobody would miss and note custom commands, plugins and cy.intercept mocks.
  2. 2 Stabilise before you move.Fix or quarantine flaky tests first. A flaky test rewritten in Playwright is still flaky, and you lose the ability to compare old and new results.
  3. 3 Set up Playwright alongside Cypress.Add @playwright/test, a playwright.config with your base URL, test ID attribute, projects for each browser, retries and trace on first retry. Keep both in the same repository.
  4. 4 Build the foundations.Replace login custom commands with a setup project that saves storageState, turn shared helpers into Playwright fixtures, and decide how you will mock or seed data.
  5. 5 Move high-value journeys first.Start with sign-up, login, checkout and billing. Port each test, run it 20–30 times locally and in CI to prove it is stable, then delete the Cypress version.
  6. 6 Run both suites in CI.Gate releases on Cypress plus the Playwright tests that are proven. Track how many journeys each suite covers.
  7. 7 Add what Cypress could not do.Turn on WebKit and Firefox projects, sharding across CI machines and multi-tab or cross-origin tests that you had skipped.
  8. 8 Retire Cypress.When Playwright covers every journey and stays green for a few weeks, remove Cypress, its plugins and its CI job.

Our guide to Playwright CI/CD pipeline integration covers sharding, reports and artifacts once the suite is in place.

What usually goes wrong in a migration?

PitfallWhat happensHow to avoid it
Line-by-line translationTests keep Cypress habits such as fixed waits and long chainsRewrite with Playwright locators, auto-waiting and web-first assertions
Migrating flaky testsThe new suite is red from day one and loses trustFix or delete flaky tests before porting them
Big-bang switchWeeks with partial coverage and no safety netRun both suites until Playwright covers the same journeys
Forgetting mocks and fixturesTests pass locally and fail in CI against real APIsMap every cy.intercept and fixture to page.route or seeded data
Login in every testSlow runs and rate-limited authLog in once in a setup project and reuse storageState
No ownerThe migration stalls at 60% while feature work winsGive one engineer or QA partner the migration as their main job

How long does a Cypress to Playwright migration take?

It depends less on test count than on custom commands, mocks and flakiness. As a rough estimate for one experienced engineer:

SuiteTypical effort (estimate)
Under 50 tests, few custom commands3–7 working days
100–300 tests, some custom commands and mocks2–6 weeks
300+ tests, heavy plugins, component tests2–3 months, usually phased by product area

AI coding assistants can draft the first translation of each file quickly, which shortens the typing part. Review every converted test anyway: assistants tend to copy Cypress habits, such as fixed waits, into Playwright code. Our guide to agentic testing covers how Playwright’s own test agents can help draft and repair tests under review.

Should you migrate in-house or with a QA partner?

In-house works when an engineer can spend most of their time on the migration for several weeks. A QA partner makes sense when feature work keeps winning, or when nobody on the team has run Playwright at scale. Either way, agree on what done means: the journeys covered, the browsers, the CI run time and the flake rate.

At QAFactory, a named QA engineer runs Playwright automation for your team: auditing the Cypress suite, porting the highest-value journeys first and keeping CI green while both suites run.

Planning a migration?

Get a 48-hour QA audit from $299 that sizes your Cypress suite and lists what to move first, or book a call.

Frequently asked questions

Is it worth migrating from Cypress to Playwright?

It is worth it when you need free parallel runs, WebKit or Safari coverage, or tests that span tabs, windows or domains. If your Cypress suite is stable and covers what you need, the migration may not pay back.

How long does a Cypress to Playwright migration take?

As a rough estimate, under 50 tests takes about a week, 100–300 tests takes 2–6 weeks, and larger suites with heavy plugins take a few months in phases. Custom commands, mocks and flaky tests drive the effort more than test count.

Can Cypress and Playwright run in the same project?

Yes. Keep them in separate folders with their own config and CI jobs, and run both until Playwright covers the same journeys.

Is there a tool that converts Cypress tests automatically?

Community converters and AI coding assistants can draft a first translation, but none produce reliable tests unattended. Review every converted test and replace fixed waits and long chains with Playwright locators and assertions.

What replaces cy.intercept in Playwright?

page.route intercepts requests, and route.fulfill returns a mocked response from an object or a file. page.waitForResponse replaces cy.wait on an aliased request.

What replaces Cypress custom commands?

Playwright fixtures and plain helper functions. Login commands are usually replaced by a setup project that saves storageState once and reuses it in every test.

Does Playwright need a paid service for parallel runs?

No. Playwright runs test files in parallel worker processes by default and shards across CI machines with the built-in --shard option.

Should we migrate Cypress component tests too?

Not at first. Move end-to-end tests first and plan component tests as a separate project: Playwright recently reworked its component testing to run against a story gallery served by your own dev server.

About this article: written by Lucia Martinez for QAFactory, which offers Playwright automation and is mentioned in this guide. Cypress and Playwright documentation and the Checkly article were checked against their pages on Dec 1, 2026. Timelines are estimates from typical projects, not measured benchmarks.

← Back to all posts Talk to a QA lead →