What are the key differences between Cypress and Playwright?
Cypress runs inside the browser, in the same run loop as the app, while Playwright drives the browser from outside through a protocol. Most differences follow from that. Cypress has a command queue without await, one tab, state clearing in the same browser and parallelism across machines. Playwright has ordinary Promises, any number of tabs, a new BrowserContext per test, several languages and, in Playwright Test for JS/TS, built-in workers.
Cypress · Comparison
Everyone says "Cypress and Playwright are similar", but an interview asks for the real difference. What is it?
An interviewer asks: "How do Cypress and Playwright differ?". The answer "Playwright is newer and faster" explains nothing. This lesson gives one reason from which most differences follow, and a table you can return to.
How it works and why. Cypress runs in the browser, in the same run loop as the app, with a Node process beside it for files, screenshots and part of the network. Playwright drives the browser from outside: the test lives in Node and commands go through a protocol (CDP for Chromium, patched protocols for Firefox and WebKit). Almost everything else follows from that.
Where the test lives
Figure 1. Cypress being close to the app gives convenient debugging and trust in the DOM, while Playwright being outside gives flexibility: many tabs, contexts and languages.
A test in the same run loop as the app means a command queue without await and one tab. A test in Node means ordinary Promises, the ability to open any number of pages and separate isolated contexts. The table sums up the consequences:
Cypress
Playwright
Where the test runs
In the browser
Outside, through a protocol
Code style
Command queue, no await
async/await
Waiting
Retried queries and should, 4 s
Auto-waiting actions, expect 5 s
Isolation
State cleared in one browser
A new BrowserContext per test
Tabs
One (new tabs through the @cypress/puppeteer plugin), origins through cy.origin
Any number
Parallelism
Across machines: Cloud or your own spec split
Workers and sharding in Playwright Test (JS/TS)
Browsers
Chromium-based, Firefox, WebKit experimental
Chromium, Firefox, WebKit
Network
cy.intercept
page.route
Debugging
Test Runner with time-travel
Trace Viewer, UI mode
Languages
JS, TS
JS/TS, Python, Java, .NET
Example: the same login. The difference is visible even in a simple scenario. Both tools wait for elements and retry checks on their own, but in a different style:
In Cypress there is no await, because commands stand in a queue. In Playwright every line returns a Promise, and every test gets a fresh BrowserContext, isolated from the others with no extra code. In Cypress isolation comes from clearing cookies, localStorage and sessionStorage before each test.
When to choose which. The choice depends on project constraints, not on a tool ranking:
Situation
Easier fit
Why
Several tabs or WebKit
Playwright
Test is outside, one API for three engines
Team on Python, Java or .NET
Playwright
Versions for these languages exist
Parallelism with no external service
Playwright
Workers and sharding in Playwright Test (JS/TS)
JS/TS and debugging next to the app
Cypress
The test runs in the same browser as the app
A large Cypress suite already exists
Cypress
Migration has a cost, not only a gain
If none of the first three situations is yours and the team writes JS/TS, both tools cover a typical UI regression, and what decides is the team's habit and the code that already exists.
Limits and alternatives. The table gives a direction, not a verdict. Cypress also has cy.session for caching a login, cy.origin for several origins and cy.intercept, which in Cypress 16 works on the browser's native network in Chrome, Chromium and Edge and through a proxy in Firefox and WebKit. Playwright also has UI mode with time-travel, so in debugging the difference is the style, not whether the feature exists. The remaining differences change with versions, so timeout numbers and the WebKit status are worth checking in the current documentation.
Typical mistakes.
Answering "Playwright is faster" without a reason: speed depends on parallelisation and CI load, not only on the tool.
Saying "Cypress has no parallelism": it has, but across machines, through Cypress Cloud or your own spec split.
Believing Cypress cannot do several origins: it can through cy.origin, but within one tab.
Comparing tools by an outdated table: versions change browser and network support.
Check yourself
Which one architectural difference explains why Cypress has one tab and Playwright any number?
Answer
Cypress runs the test in the browser, in one run loop with the app, so it is tied to one tab. Playwright drives the browser from outside through a protocol, so it can open any number of pages and contexts.
Why does Playwright not need manual state cleanup between tests?
Answer
Every test gets a fresh BrowserContext: separate cookies, storages and sessions. In Cypress the state is cleared between tests inside one browser.
Related lessons: “When would you choose Cypress over Playwright?”, “How would you migrate a project from Cypress to Playwright?”, “Cypress architecture and a comparison”, “How is the Cypress architecture built under the hood?”, “How do you parallelise Cypress tests?”.
In the interview.Junior: The root difference: Cypress runs inside the browser and Playwright drives it from outside. Everything else follows from that. Cypress has a command queue instead of async/await, one tab, parallelism across machines and network interception through cy.intercept. Playwright has ordinary Promises, several tabs and domains, isolated contexts, several languages and, in Playwright Test for JS/TS, built-in workers. Middle/Senior: I do not judge tools by a table but by the project constraints: whether we need several tabs or Safari, which language the team uses, how we parallelise on CI. For UI tests focused on development and debugging Cypress is good, and for complex scenarios and flexible infrastructure Playwright is more convenient.
When would you choose Cypress over Playwright?
A tool is chosen by constraints, not by fashion: the scenarios, the team, the existing suite and the browsers needed. Cypress fits a single-page app on one origin when frontend developers write the tests and like the Test Runner with time-travel. A large stable Cypress suite is not rewritten without a concrete pain. Several tabs or users at once, a non-JavaScript test language or a need for WebKit are arguments for Playwright.
Cypress · Comparison
You are asked which tool you would take, and the right answer is not "the trendier one". How do you justify it?
The question "When would you choose Cypress?" checks whether you can choose a tool for constraints rather than by sympathy. A weak answer is a slogan. A good one names criteria and what changes them.
How it works and why. The choice consists of four questions: what the app and the scenarios are (several tabs, several users, several origins), who writes the tests (frontend developers or a separate QA team, JS or another language), what already exists (a test suite, infrastructure, a trained team) and which browsers are needed. Cypress answers the first group well when the app is a single-page app on one origin, and the second when tests are written together with developers who find the interactive Test Runner with time-travel convenient. Playwright wins when scenarios go beyond one tab or JS.
When each fits
Cypress
When it fits
A single-page app on one origin, tests written by a frontend team that likes time-travel and the component tests built into Cypress.
Playwright
When it fits
Several tabs or users, WebKit, a non-JS team, a need for sharding and parallelism with no extra service.
Figure 1. Both options are neutral: this is not "good and bad" but different project profiles.
The most important factor is often not technical but historical: what already exists on the project. A large stable Cypress suite with people who know it has a value that a rewrite rarely pays back. For a new project without such a legacy Playwright is usually the default today, but Cypress stays a fitting choice for teams that value its developer experience.
Example: five situations.
Situation
Choice
Why
800 Cypress tests exist, the team knows them
Keep Cypress
A rewrite costs more than it gains
New project, SPA, frontend developers
Cypress or Playwright
Team experience decides
A scenario with two users in different tabs
Playwright
Cypress has one tab
A Safari-like engine is needed
Playwright
WebKit in Cypress is experimental
QA writes in Python or Java
Playwright
Cypress is JS/TS only
Note the second row: it has no single answer. A good candidate does not invent one here but names what will decide it: team experience and what the CI already does.
Limits and alternatives. Both tools keep changing: what was a limitation a year ago (network, browsers, parallelism) may have changed. So in an answer it is worth saying "according to the current documentation". Cypress does not fit when scenarios with several tabs or Safari are needed. Playwright does not fit when the team consists entirely of frontend developers who value the interactive Test Runner, but even then the difference is not critical. Finally, "both" is also an option: Cypress for components, Playwright for end-to-end scenarios.
Typical mistakes.
Choosing by popularity or novelty without asking about the team and the scenarios.
Suggesting a rewrite of a working suite only because "Playwright is better".
Attributing limits from old versions to Cypress without checking the documentation.
Not naming what would change the decision: in an interview this looks like having no criteria.
Check yourself
A project has a large stable Cypress suite. You are asked to propose rewriting everything in Playwright. What do you say?
Answer
A rewrite alone is not justified: it is expensive and the gain is unclear. I would ask what concrete pain there is (several tabs, WebKit, speed), and if there is none I would keep Cypress. New scenarios that Cypress does not fit can be written in Playwright alongside.
Name two scenarios where Cypress does not fit.
Answer
A scenario with several tabs or several users at once, and a need for WebKit as a real Safari-like engine. Also a team that writes tests not in JavaScript or TypeScript.
Related lessons: “What are the key differences between Cypress and Playwright?”, “How would you migrate a project from Cypress to Playwright?”, “How is the Cypress architecture built under the hood?”.
In the interview.Junior: Cypress fits when the app is a single-page app on one origin and the tests are written together with frontend developers who like time-travel and component tests. Component testing does not decide the choice: it exists in Playwright Test too (the mount fixture). For a new project without an existing suite Playwright is the more common pick, but team experience decides. Middle/Senior: I choose by constraints: scenarios (tabs, users, origins), who writes the tests, what already exists on the project, which browsers are needed. If there is a large stable Cypress suite and the team knows it, I would not rewrite it without a concrete problem. New scenarios that Cypress does not cover I add in Playwright.
How would you migrate a project from Cypress to Playwright?
A migration from Cypress to Playwright is done in stages while both stacks live side by side, not as one big rewrite. The stages are an inventory, a pilot, coexistence, and switching Cypress off once coverage has not dropped. Custom commands become fixtures, cy.session becomes storageState, an intercept with an alias becomes waitForResponse created before the action. Risks are two stacks in CI and hidden dependencies between tests.
Cypress · Comparison
You are asked to move 600 tests from Cypress to Playwright without breaking CI. Where do you start?
A migration question checks whether you think in risks, not in a find-and-replace. Rewriting everything in one sprint rarely works, and a half-migrated project without a plan is worse than both options. This lesson gives an order of work and a map of equivalents.
How it works and why. A migration is not a translation of syntax but a transfer of test architecture, so it is done in stages while both stacks live side by side. First an inventory: what the suite covers, which tests are critical, which are flaky, which depend on each other. Then a pilot on 3-5 tests: this is where a shared base appears (config, fixtures, authentication). Then coexistence: new tests are written in Playwright, old ones are moved in batches, starting with the most critical and the flakiest. Only when coverage has not dropped is Cypress switched off.
Migration stages
Figure 1. The idea is not one big rewritten pool but a controlled transition where both test sets run in CI.
You move the architecture, not the lines. A Page Object moves almost directly, but its methods become async. Custom commands turn into fixtures or helpers. cy.session is replaced by storageState with a setup project. Existing data-cy selectors stay if you set testIdAttribute:
// playwright.config.tsimport { defineConfig } from'@playwright/test';
exportdefaultdefineConfig({
testDir: 'e2e-pw', // next to the Cypress folder
use: {
baseURL: 'http://localhost:3000',
testIdAttribute: 'data-cy', // keep the existing selectors
},
});
A map of equivalents worth showing the team at the start:
Cypress
Playwright
cy.get(sel)
page.locator(sel) / getByTestId
cy.contains(text)
getByText / getByRole
.should('be.visible')
await expect(...).toBeVisible()
cy.intercept + alias
page.route / waitForResponse
cy.session
storageState + setup-project
Custom commands
Fixtures, helpers
cy.task
A direct call in the test (Node)
cy.clock
page.clock
Example: the network. Moving the wait for a request breaks most often. In Cypress an alias is created before the action and cy.wait('@stats') waits for it. In Playwright the counterpart is waitForResponse, which must also be created before the action, otherwise the response can be missed:
// Cypress
cy.intercept('GET', '/api/stats').as('stats');
cy.get('[data-cy=period]').select('30d');
cy.wait('@stats');
cy.get('[data-cy=chart]').should('be.visible');
// Playwrightconst stats = page.waitForResponse('**/api/stats'); // before the actionawait page.getByTestId('period').selectOption('30d'); // data-cy via testIdAttributeawait stats;
awaitexpect(page.getByTestId('chart')).toBeVisible();
Limits and alternatives. Migration risks: two stacks in CI for a while (time and money), team training, implicit dependencies between tests that Cypress hid by serial runs and Playwright will expose in a parallel one. Timeouts and state cleanup also differ, so "the same" test on the new tool may behave differently: that is not a transfer mistake but different models. Automatic converters help with routine work, but the result must be re-read. The alternative is not to migrate at all: if no problem is in the way, keeping Cypress is cheaper.
Typical mistakes.
Trying a "big bang": rewriting everything and switching Cypress off in one day.
Moving line by line while keeping Cypress habits (chains, cy.wait with a time) instead of idiomatic Playwright.
Not defining a success criterion in advance and not knowing when to switch the old suite off.
Ignoring dependencies between tests that will surface in a parallel run.
Check yourself
Why is waitForResponse in Playwright created before the action, not after?
Answer
Because if the response arrives before the wait begins, it is missed and the test waits until the timeout. First create the wait, then perform the action, then await it.
What criterion do you measure the migration success by?
Answer
Fewer flaky tests, a faster run thanks to workers, and coverage that has not dropped: every critical scenario from Cypress has a counterpart in the new suite before the old one is switched off.
Related lessons: “What are the key differences between Cypress and Playwright?”, “When would you choose Cypress over Playwright?”, “What is cy.session and how do you avoid logging in in every test?”, “What is cy.intercept and where exactly does the interception happen?”.
In the interview.Junior: I would not rewrite everything at once. New tests are written in Playwright, old ones live beside them in CI and are moved gradually. I move the architecture, not the lines: Page Object almost directly but with async, custom commands become fixtures, cy.session becomes storageState, intercept with an alias becomes waitForResponse. Middle/Senior: I start with an inventory and a pilot, then coexistence, and switch Cypress off once coverage has not dropped. The main risks are two stacks at once and hidden dependencies between tests that will surface in a parallel run. I measure success by stability, run speed and coverage, and I also honestly ask whether the migration is needed at all.