Cypress architecture and a comparison
The main difference is where the test runs: Cypress runs in the browser, while Selenium and Playwright drive it from outside. That gives Cypress direct access to the DOM, time-travel, built-in waiting and retries. It also brings limits: only JavaScript or TypeScript, one tab, and cy.origin for several domains. For scenarios with several users or tabs, another language or built-in parallelism, Playwright is the choice.
Cypress · Architecture
You are asked: “Cypress or Playwright?”. Which single difference do you name first?
In an interview the question about choosing a tool almost always comes down to one thing: where the test runs. Everything else, from several tabs to parallelisation, follows from that answer. The closing lesson of the chapter gathers the Cypress architecture in comparison with Selenium and Playwright, so that the answer sounds like a conclusion and not a list.
How it works and why. Cypress runs tests inside the browser, in the same run loop as the application, and a Node process works beside it for tasks outside the browser. Selenium and Playwright drive the browser from outside: Selenium through WebDriver, Playwright through CDP and its own protocols. Because of this architecture Cypress has direct access to the DOM, window and the app's network requests, while the test code runs in the browser, so Node capabilities are reached through cy.task.
Where the test runs in three tools
What this gives and what it takes. Cypress strengths: a convenient interactive runner with time-travel snapshots of every step, built-in retries and waiting, an easy start, cy.intercept for the network, component testing. Limits: only JavaScript/TypeScript, one tab, harder work with iframes and several domains (through cy.origin), no Safari support (only experimental WebKit).
| Cypress | Playwright | Selenium | |
|---|---|---|---|
| Test runs | in the browser | in Node | in the test process |
| Languages | JS/TS | JS/TS, Python, Java, .NET | many |
| Tabs | one | several | several |
| Safari/WebKit | experim. WebKit | WebKit | via Safari driver |
Example: deriving an answer from the architecture. Task: test a chat where two users write at the same time. In Cypress the test lives in one tab, so the second user has to be emulated through the API or a separate run, which is awkward. In Playwright these are two contexts in one test. On the other hand, when a team writes in JS and values fast interactive feedback while building the UI, Cypress gives time travel and a clear Command Log. The conclusion is derived from the architecture, not from preference.
The same goes for parallelisation. In Playwright it is built in (workers and sharding). Cypress runs specs in parallel through Cypress Cloud (the --parallel option with recording) or by splitting specs manually between CI jobs.
It supports several tabs, contexts and languages besides JS, and parallelisation is built in with no paid service. In exchange there is no interactive runner that runs inside the application: its role is played by UI mode and the Trace Viewer.
Limits and alternatives. Comparisons age fast: versions change and tools converge (for example, in Cypress 16 the network interception path changed and Electron became deprecated). So build the answer on the principle and check specific features against the documentation. The choice also depends on the team: languages, existing code, the need for other browsers and tabs, the budget for parallelisation.
Common mistakes.
- Answering with a list of features and no mention of architecture: it sounds memorised.
- Claiming Cypress "does not support iframes or several domains": it does, with limits and extra commands.
- Naming outdated facts or missing changes: cypress.json instead of cypress.config, Electron in CI without an explicit --browser although it is deprecated in Cypress 16.
- Believing one tool is always better: the choice depends on the task.
Check yourself
A test needs two users in different tabs at the same time. Which tool fits better and why?
Answer
Playwright: its test lives in Node and drives several browser contexts. A Cypress test runs in one tab, so the second user can only be emulated through the API or separate runs.
How do you explain in two sentences that Cypress "has direct DOM access"?
Answer
The test runs in the browser in the same run loop as the app, so it sees window and the DOM directly with no protocol between. This gives automatic waiting and time travel but ties the test to one tab and to JS/TS.