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
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), domains 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:
// Cypress
cy.visit('/login');
cy.get('[data-cy=email]').type('qa@example.com');
cy.contains('button', 'Sign in').click();
cy.url().should('include', '/dashboard'); // retried
// Playwright
await page.goto('/login');
await page.getByTestId('email').fill('qa@example.com');
await page.getByRole('button', { name: 'Sign in' }).click();
await expect(page).toHaveURL(/dashboard/); // retried
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 domains 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 domains: 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.