QA Interview Hub · Knowledge base · Quizzes · Українська

Cypress › Cypress vs Playwright

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

Cypress: the test is insideone run loop with the appPlaywright: the test is outsideNode process → protocol → browser
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:

CypressPlaywright
Where the test runsIn the browserOutside, through a protocol
Code styleCommand queue, no awaitasync/await
WaitingRetried queries and should, 4 sAuto-waiting actions, expect 5 s
IsolationState cleared in one browserA new BrowserContext per test
TabsOne (new tabs through the @cypress/puppeteer plugin), domains through cy.originAny number
ParallelismAcross machines: Cloud or your own spec splitWorkers and sharding in Playwright Test (JS/TS)
BrowsersChromium-based, Firefox, WebKit experimentalChromium, Firefox, WebKit
Networkcy.interceptpage.route
DebuggingTest Runner with time-travelTrace Viewer, UI mode
LanguagesJS, TSJS/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:

SituationEasier fitWhy
Several tabs or WebKitPlaywrightTest is outside, one API for three engines
Team on Python, Java or .NETPlaywrightVersions for these languages exist
Parallelism with no external servicePlaywrightWorkers and sharding in Playwright Test (JS/TS)
JS/TS and debugging next to the appCypressThe test runs in the same browser as the app
A large Cypress suite already existsCypressMigration 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.

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.

More articles in this chapter