skip to content

Cypress

3 roadmaps256 questionsupdated

A runner that loads inside the page it tests: commands queue and re-run themselves, and every step leaves a DOM snapshot you can step back to. Interviewers probe how that placement shapes every test.

on this pageshow

guide

overview

~1 min

Cypress is an end-to-end and component test runner that loads into the browser page it tests. A command is not executed at the call site: each one joins a queue, queries keep retrying until an assertion agrees, and every step leaves a snapshot you can step back to. Interviewers lean on it because that design decides how a correct test is written, and because the classic Cypress bugs — a variable that holds no element, a fixed sleep, a test that leaks state into the next — mostly come from treating a spec like an ordinary script. The hub follows a test from the inside out. [Test runner and commands](/topics/dev-cypress-test-runner) is the command chain itself, and [selectors and assertions](/topics/dev-cypress-selectors-assertions) is how a step names an element and judges it. [Network stubbing and intercept](/topics/dev-cypress-network-stubbing) and [fixtures and custom commands](/topics/dev-cypress-fixtures-custom-commands) are how a suite takes control of data, state and repetition, while the [component harness](/topics/dev-cypress-component-testing) mounts one component instead of a whole app. The [in-browser runtime](/topics/dev-cypress-architecture) explains the placement every limit comes from, and [config and Node events](/topics/dev-cypress-config) the Node process it pairs with. [Debugging and diagnostics](/topics/dev-cypress-debugging) and [pipeline orchestration](/topics/dev-cypress-ci-cloud) cover reading a failure and running the suite unattended, and [choosing and moving](/topics/dev-cypress-positioning) asks when Cypress is the wrong tool. Junior rounds test the queue and the waiting model: what a command yields, when it runs, why a hard-coded wait is the wrong fix. Senior rounds turn to suite design — where seeding belongs, what to stub, how to keep sign-in cheap, how to cut a long pipeline — and to judgement about which limits are permanent. Learn the command chain and retry-ability first; nearly every other section assumes them.

primer

### The runner lives inside the page A spec shares the browser, and the event loop, with the application under test. That is why a test can reach the real `window`, stub a function on it, or read the store directly, with nothing serialized in between. It is also why the hard limits exist: one tab, one origin at a time unless you step into another explicitly, and specs written only in JavaScript or TypeScript. Most "why can't Cypress…" questions are this placement seen from the other side. ### Commands are scheduled, not executed Calling `cy.get()` returns a chainer and records a step; nothing touches the page until the test function has returned and Cypress starts working through its queue. Values therefore arrive through the chain — `.then()`, aliases, assertions — never through a variable or a `return`. Mixing synchronous code with queued commands produces the bugs interviewers like best, because the code reads correctly and runs in a different order. ### Waiting is built in, and it has rules Queries re-run, together with the assertion that follows them, until the assertion passes or the timeout runs out. Actions such as `.click()` change the app, so they fire once, after their own readiness checks. A strong answer explains a flaky test in these terms — which step retries, which does not, what the chain is still holding — instead of reaching for a longer fixed wait. ### Two processes, one narrow seam Behind the browser sits a Node process that reads the config, launches the browser and owns the file system. Fixtures, file reads, `cy.task()` and `cy.request()` all cross to it, and only data that survives JSON comes back. Knowing which side a piece of code runs on settles most configuration, secrets and seeding questions. ### Control state from outside the UI Good suites do not click through sign-up to test a dashboard. They stub or spy on traffic with `cy.intercept()`, seed data through the backend, cache logins with `cy.session()`, and rely on test isolation to start every test from a clean page and empty storage. Interviewers probe where you draw the line between faking and exercising the real system. ### Every step leaves evidence Interactively, each command records a DOM snapshot in the Command Log, so diagnosing a failure means stepping back through what the page looked like. A headless run keeps much less, which is why CI debugging leans on screenshots, optional video and recorded runs instead.

Command queue
The ordered list of steps a test body records. Cypress works through it after the test function returns, one command at a time, each waiting for the one before.
Chainer
The object every cy command returns. It lets you append further commands to the same chain; it never holds an element or a value.
Query command
A read-only command such as cy.get or .find that Cypress may re-run, together with later queries, until the following assertion passes.
Action command
A command that changes the application, such as .click or .type. It runs readiness checks first, then fires once and is never retried.
Retry-ability
Cypress's waiting model: queries and their assertions are re-evaluated until they pass or defaultCommandTimeout expires, replacing most explicit waits.
defaultCommandTimeout
The config value, four seconds by default, that bounds how long a retrying query and its assertion keep trying before the test fails.
Alias
A name given with .as() to a subject, route or spy, read back with the @ prefix. Aliases are cleared before every test.
cy.intercept
The command that declares a route for matching browser requests and then spies on, stubs, rewrites, delays or fails each request it matches.
cy.session
A command that runs a login setup once per id and caches the resulting cookies and storage, restoring them in later tests instead of repeating setup.
Test isolation
The default behaviour of resetting the page, cookies and browser storage before each test, so no test depends on what an earlier one left behind.
cy.task
A command that sends a JSON-serializable argument to a Node handler registered in the config and yields its result back into the chain.
cy.origin
A command that runs a block of commands against a second origin, which Cypress evaluates there with only the arguments passed in.
Command Log
The runner's left-hand panel listing every command, assertion and request, with a DOM snapshot per step in interactive mode.
Cypress Cloud
The paid service a run records to with --record. It coordinates parallel machines, balances spec files and keeps results, flake data and replays.

Follow one spec from the command line to a result. `cypress open` or `cypress run` starts the Node process, which reads `cypress.config.js`, runs `setupNodeEvents`, and launches a browser. For end-to-end tests the spec is bundled and loaded beside your app's page; for component tests a dev server built on your own bundler compiles the spec, and a registered `mount` command renders one component into a bare page instead. When the test body runs, it only records commands. Cypress then drains the queue: queries retry against the live DOM, actions check readiness and fire, and routes declared earlier with `cy.intercept()` catch the app's requests as they happen. Anything the browser cannot do — read a file, seed a database, make a request without CORS — goes back to Node through a fixture, `cy.task()` or `cy.request()`. Between tests, isolation wipes the page and storage, and `cy.session()` restores whatever login was cached. The output depends on the mode. Interactively you get the Command Log with its snapshots; headless you get an exit code, failure screenshots and, if recorded, a Cypress Cloud run that can split spec files across machines. ```javascript // cypress.config.js — runs in Node const { defineConfig } = require('cypress') module.exports = defineConfig({ e2e: { baseUrl: 'http://localhost:3000', setupNodeEvents(on) { on('task', { seedOrders: (rows) => db.insert(rows).then(() => null) }) }, }, }) // orders.cy.js — runs in the browser cy.task('seedOrders', [{ id: 1, total: 42 }]) // JSON across the seam cy.intercept('GET', '/api/orders').as('orders') // a spy: no reply given cy.visit('/orders') cy.wait('@orders') cy.get('[data-cy=order-row]').should('have.length', 1) ``` Each line belongs to one of the sections below: the task to config, the route to network stubbing, the wait and the retrying query to the runner, and the `data-cy` selector to selectors and assertions. The handler returns `null` on purpose, because a task that resolves nothing fails the command that called it.

  1. Test Runner and Commands →

    The command queue, what each step yields and what retries; every other section assumes this model.

  2. Selectors and Assertions →

    How a step finds elements and asserts on them, where retry-ability shows up in daily test code.

  3. Network Stubbing and Intercept →

    Taking control of the backend: spying, stubbing and waiting on requests instead of on time.

  4. Fixtures and Custom Commands →

    The reuse layer, seeding, custom commands and cached logins, once single tests are solid.

  5. In-Browser Runtime →

    Why the tool works, and stops working, the way it does: in-page placement, origins, tabs and browsers.

  6. Config and Node Events →

    The Node side of a run: config layout, values and secrets, and tasks that cross the seam.

  • Assigning cy.get() to a variable and expecting an element: it holds a chainer, and the query has not run yet.

  • Fixing a flaky test with cy.wait(5000) instead of waiting on an aliased request or an assertion that retries.

  • Asserting inside .then() with a bare expect and assuming it retries: only queries chained before an assertion are re-run.

  • Keeping a stale element after a re-render: the chain holds the old node, not the selector, so query again after the change.

  • Logging in through the UI before every test instead of seeding state from outside or caching it with cy.session().

  • Creating aliases or state in before() and expecting later tests to see them; isolation and alias clearing reset both per test.

  • Promising multi-tab flows, a second browser in one test, or specs in another language: those limits follow from running inside the page.

  • Expecting cy.intercept() to see cy.request() traffic: that request comes from Node, so no browser route matches it.

  • Passing --parallel without recording to Cypress Cloud; splitting spec files across machines is a Cloud service, not a runner feature.

This guide assumes Cypress 16, the version the questions below describe. Several older changes still come up, because many suites were written against earlier releases: - **10** replaced `cypress.json` and the plugins file with `cypress.config.js`, its `e2e` and `component` blocks, and `setupNodeEvents`, and brought component testing into the same app. - **12** turned test isolation on by default, made `cy.session()` and `cy.origin()` generally available, and introduced query commands that re-run the whole chain of queries, which removed most detached-element errors. - **13** switched video recording off by default. - **16** removed `Cypress.env()` in favour of `cy.env()` for secrets and `Cypress.expose()` for public values, moved request interception in Chrome-family browsers onto the browser's own network stack,. In 16, WebKit support is still experimental and the bundled Electron browser is deprecated. When an answer depends on these — whether state survives between tests, where a value is read from, whether traffic goes through a proxy — say which era you mean.

Cypress is built on familiar parts: Mocha supplies the test structure and hooks, Chai the assertions, Sinon the spies and stubs, and jQuery-style selection the element queries. Plugins fill known gaps, such as Testing Library queries or real pointer events for hover. It is most often weighed against Playwright and Selenium WebDriver. Both drive the browser from outside, through a protocol: that costs the direct access to the app's objects that Cypress has, but allows several tabs, origins and browser contexts in one test, and specs in more than one language. Selenium also reaches the widest range of browsers. A defensible choice names the project — a team-owned JavaScript app tested in Chrome-family browsers or Firefox suits Cypress; cross-site flows, real Safari sign-off or a non-JavaScript team point elsewhere. On the component side, Cypress competes with simulated-DOM runners such as Jest or Vitest with Testing Library, which are faster per test but cannot prove layout, visibility or CSS. [Choosing and moving](/topics/dev-cypress-positioning) covers these judgements, and porting in either direction, in depth.

explore

report an issue with this guide →

questions

256 · 10 sections

In Cypress, what does `.click()` check about an element before it fires the click?

level: juniorimportance: must knowfreq 76%
basics
~20 s

Cypress re-runs a fixed readiness list before every action: it scrolls the element into view, then requires it to be attached, visible, enabled, not readonly, not animating and not covered at the point the event will land.

open as a page

In Cypress, what does `.type()` do with text wrapped in curly braces?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Cypress reads curly braces in .type() as special key sequences rather than literal characters, so {enter} presses Enter and {selectall} selects the field. An unrecognised sequence throws. Type a literal brace with {{}, or pass the option parseSpecialCharSequences: false.

open as a page

In Cypress, what does `const rows = cy.get('[data-cy=book-row]')` put into `rows`?

level: juniorimportance: must knowfreq 88%
basics
~20 s

A Cypress chainer object: a handle you use to append more commands to that chain. It holds no element and no jQuery data, because at the moment the assignment runs cy.get() has only been queued, not executed.

open as a page

In a Cypress test, when do the cy commands in the test body actually run?

level: juniorimportance: must knowfreq 88%
basics
~20 s

Cypress commands do not run when you call them. Each cy call only appends a step to an internal command queue and returns immediately; Cypress drains that queue, one step at a time, after the test body function has returned.

open as a page

In Cypress, what does cy.wrap() do, and when do you need it?

level: juniorimportance: must knowfreq 70%
basics
~20 s

cy.wrap() starts a Cypress chain whose subject is the value you hand it - a plain object, a number, a jQuery element or a promise - so queries, .should() assertions, .its() and .invoke() can run against it.

open as a page

In Cypress, how do you write an `expect()` assertion inside a `.then()` callback?

level: juniorimportance: must knowfreq 70%
basics
~10 s

Cypress makes Chai's expect and assert global in every spec, so inside .then(($rooms) => ...) you call expect($rooms).to.have.length(4) straight on the yielded subject. A throw from that expect fails the test at that command.

open as a page

In Cypress, what does .should('have.text', 'Deluxe King') do when chained onto cy.get()?

level: juniorimportance: must knowfreq 84%
basics
~10 s

It attaches a Chai-jQuery assertion to the preceding cy.get(), and Cypress keeps re-evaluating the query and the check until the element's text matches or the four-second default command timeout expires, then fails the test.

open as a page

In Cypress, how do you find an element by its `data-cy` test attribute?

level: juniorimportance: must knowfreq 82%
basics
~20 s

Pass a CSS attribute selector to cy.get(), as in cy.get('[data-cy="room-card"]'). Cypress ships no dedicated test-id command: the attribute is ordinary markup and the selector is ordinary CSS, matched the way jQuery's $() matches, with data-cy carrying no special status.

open as a page

In Cypress, why does a re-render detach the element your chain already holds?

level: juniorimportance: must knowfreq 80%
basics
~20 s

A Cypress chain carries a concrete DOM node, not the selector that found it. A re-render throws that node away and mounts a fresh one, so the node your chain still holds is no longer in the document.

open as a page

In Cypress, what does `cy.get('.room-card')` yield when the page renders 12 room cards?

level: juniorimportance: must knowfreq 78%
basics
~20 s

One jQuery-wrapped collection holding all 12 room-card elements, not a single DOM node and not an array. Its length is 12, and the whole set becomes the subject the next command in the chain receives.

open as a page

In Cypress, what does `cy.wait('@getForecast')` yield to the next command?

level: juniorimportance: must knowfreq 78%
basics
~20 s

cy.wait on an intercept alias yields one interception object for that request-response cycle: request and response, plus id, routeId, and an error property when the request failed. Chain .its() or .then() to assert on it.

open as a page

What are the three ways to call Cypress's `cy.intercept()`, and what does each match?

level: juniorimportance: must knowfreq 78%
basics
~10 s

Cypress accepts cy.intercept(url), cy.intercept(method, url) and cy.intercept(routeMatcher). A bare url matches every HTTP method; the method form narrows it to one; the routeMatcher object matches fields such as pathname, query and headers together.

open as a page

In Cypress, what turns a `cy.intercept()` route from a spy into a stub?

level: juniorimportance: must knowfreq 80%
basics
~20 s

The response argument. A Cypress cy.intercept('GET', '/api/forecast') with no second argument only spies, and the request still reaches the real server. Supply a StaticResponse, a plain body, or a handler that calls req.reply() and Cypress answers it instead.

open as a page

In Cypress, how does a `cy.intercept()` 500 stub differ from `forceNetworkError`?

level: juniorimportance: must knowfreq 70%
basics
~20 s

A 500 stub sends a real HTTP response the application can read, so its status and error body are available. forceNetworkError destroys the browser connection instead: no status, no headers, no body, and the app's fetch rejects.

open as a page

In Cypress 16, why is `req.httpVersion` undefined inside a `cy.intercept()` handler in Chrome?

level: middleimportance: must knowfreq 62%
basics
~20 s

Because Chrome, Chromium and Edge now intercept on the native browser network. The browser negotiates the protocol with your server directly, and that is not known when the request is paused, so Cypress reports no value rather than a wrong one.

open as a page

Cypress 16 removed cy.exec() - how do you run a setup command now?

level: juniorimportance: must knowfreq 58%
basics
~20 s

cy.exec() was removed in Cypress 16 and now throws; use cy.task() instead, calling a handler registered under the task event in setupNodeEvents. The execTimeout option was removed with it, and taskTimeout, default 60000 ms, replaces it.

open as a page

In Cypress, how does cy.fixture('receipts') resolve a file with no extension?

level: juniorimportance: must knowfreq 76%
basics
~20 s

Cypress joins the path onto fixturesFolder, which defaults to cypress/fixtures. If that exact file exists it is read; otherwise Cypress tries a fixed extension list, .json first, and yields the first match, parsed according to that extension.

open as a page

In Cypress, when should a repeated step be a plain function instead of a custom command?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Make it a custom command only when the behaviour is wanted across all your specs, such as signing in or seeding an expense report. A step that one spec file repeats should stay a plain JavaScript function in that file.

open as a page

In Cypress, what does the id argument to cy.session() do, and when does setup run?

level: juniorimportance: must knowfreq 78%
basics
~20 s

The id is the cache key. Cypress runs the setup function only when no valid session is saved under that id; every later call with the same id skips setup and re-applies the cached cookies, localStorage and sessionStorage.

open as a page

In Cypress, what does the `prevSubject` option in `Cypress.Commands.add()` control?

level: juniorimportance: must knowfreq 72%
basics
~20 s

It decides how your command treats the subject the previous command yielded: false makes a parent that ignores it, true a child that receives it, optional a dual command that works either way. element, document and window also validate it.

open as a page

Cypress has no built-in cy.mount(): how do you make it available to every component spec?

level: juniorimportance: must knowfreq 82%
basics
~10 s

Cypress ships no cy.mount command. You import mount from a framework adapter - cypress/react, cypress/vue, cypress/angular or cypress/svelte - and register it once with Cypress.Commands.add('mount', mount) in cypress/support/component.js, which loads before every spec.

open as a page

In a Cypress component test, how do you assert that a component invoked its `onRate` callback prop?

level: juniorimportance: must knowfreq 78%
basics
~20 s

Create a Cypress spy with cy.spy(), name it with .as(), and pass it into cy.mount() as the prop. Drive the component, then assert through the alias: cy.get('@onRate').should('have.been.calledWith', 4). The alias is what makes the assertion retry until the callback fires.

open as a page

Why does a component mounted by Cypress's cy.mount() render unstyled?

level: juniorimportance: must knowfreq 74%
basics
~20 s

Cypress renders components into cypress/support/component-index.html, not your application's page, so nothing the app's entry file does at startup has run. Import your global stylesheets in cypress/support/component.js, or add the same link tags to that index file.

open as a page

In a Cypress component test, why does an aliased spy assertion retry when `expect(spy)` does not?

level: middleimportance: must knowfreq 62%
basics
~20 s

cy.get('@alias') is a Cypress query, so the chained assertion is re-run against the spy until it passes or defaultCommandTimeout expires. A bare expect(spy) inside .then() is plain Chai: it runs once, at that instant, and loses the race whenever the callback is late.

open as a page

Why does a Cypress component mount cost more than a simulated-DOM render?

level: middleimportance: must knowfreq 68%
basics
~20 s

Cypress mounts the component in a real browser, so every test pays for a compiled dev-server bundle, a loaded page, real layout and paint, and a snapshot per command. That buys a real box model, real visibility and real CSS.

open as a page

What do the Cypress Docker images cypress/base, cypress/browsers and cypress/included contain?

level: juniorimportance: must knowfreq 58%
basics
~20 s

cypress/base carries Debian, Node.js and the OS packages Cypress needs, but no browser. cypress/browsers adds Chrome, Firefox and Edge. cypress/included adds a tag-pinned Cypress installed globally. cypress/factory generates a custom image when no published combination fits.

open as a page

In Cypress, what is the difference between `cypress open` and `cypress run`?

level: juniorimportance: must knowfreq 85%
basics
~20 s

cypress open launches the interactive Cypress app: you pick a spec, watch it run in a visible browser, and it reruns every time you save. cypress run executes matching specs once, headlessly, then exits with a status code a pipeline reads.

open as a page

In Cypress Cloud, what does it mean when a recorded run is flagged flaky?

level: juniorimportance: must knowfreq 65%
basics
~20 s

At least one test in that run failed an attempt and then passed on a later attempt of the same code. Cypress Cloud counts those tests and badges the run, so a run can finish green and still be flaky.

open as a page

What does a project need before `cypress run --record` uploads to Cypress Cloud?

level: juniorimportance: must knowfreq 62%
basics
~10 s

Two things: a projectId in the Cypress config (or CYPRESS_PROJECT_ID) naming the Cloud project, and a record key passed as --key or exported as CYPRESS_RECORD_KEY. The projectId says where; the key authorises writing there.

open as a page

What exit code does `cypress run` return, and what does `--posix-exit-codes` change?

level: middleimportance: must knowfreq 62%
basics
~20 s

By default cypress run exits with the number of failed tests, Mocha-style: three failures give status 3, and 0 means everything passed. Passing --posix-exit-codes makes any test failure exit 1 instead, and adds 112 for a Cypress Cloud network failure.

open as a page

Which browsers can Cypress 16 launch, and how do you pick one for a run?

level: juniorimportance: must knowfreq 76%
basics
~20 s

Cypress 16 launches Chrome-family browsers - Chrome, Chrome for Testing, Chromium and Edge - plus Firefox, experimental WebKit, and the deprecated bundled Electron. Choose one per run with the --browser flag, or set defaultBrowser in the Cypress config.

open as a page

Why do Cypress commands fail after the app navigates to another origin?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Cypress runs inside the browser and obeys the same-origin policy, so a test is bound to one origin and cannot touch a document from a different one. Wrap the commands for the new origin in a cy.origin() block.

open as a page

Why does a console.log() in a Cypress spec never reach the terminal running cypress run?

level: juniorimportance: must knowfreq 58%
basics
~20 s

Spec code is evaluated inside the browser, so console.log() writes to that browser's DevTools console. The terminal belongs to Cypress's separate Node process, which only prints what code in cypress.config.js and its Node handlers log.

open as a page

In Cypress, what happens to a request whose host matches a `blockHosts` pattern?

level: juniorimportance: must knowfreq 55%
basics
~10 s

Cypress ends the request itself and answers 503, adding an x-cypress-matched-blocked-host header naming the pattern that matched. The request is never sent, so it resolves immediately instead of waiting on a third party.

open as a page

Why did Cypress 16 remove `Cypress.env()`, and what replaced it?

level: juniorimportance: must knowfreq 74%
basics
~20 s

Cypress.env() hydrated every configured environment variable into the browser, so reading one value exposed them all. Cypress 16 removed it and split the job: cy.env() reads secrets asynchronously and keeps them in Node, while Cypress.expose() serves public values synchronously.

open as a page

In a Cypress `cypress.config.js`, which options must sit inside the `e2e` block, not the root?

level: juniorimportance: must knowfreq 74%
basics
~20 s

The testing-type-only keys: baseUrl, specPattern, supportFile, excludeSpecPattern, slowTestThreshold and testIsolation. Cypress refuses to start and names the offending key if one of them appears at the root of the exported object, telling you to move it into e2e or component.

open as a page

Which Cypress commands let a spec running in the browser reach the file system?

level: juniorimportance: must knowfreq 72%
basics
~10 s

Only four: cy.fixture(), cy.readFile(), cy.writeFile() and cy.task(). Spec code is browser JavaScript with no fs module, so each of those hands the work to the Node process that loaded the Cypress config.

open as a page

In Cypress, what must an `on('task')` handler in `setupNodeEvents` return?

level: juniorimportance: must knowfreq 62%
basics
~20 s

It must return a value, null, or a promise that resolves to one of those. Returning undefined fails the calling command with a message naming the task, because Cypress reads undefined as "no handler answered this event".

open as a page

Cypress's `cy.env()` never logs a value, so how do secrets still reach the Command Log?

level: middleimportance: must knowfreq 58%
basics
~20 s

cy.env() logs only the key names you asked for, and that protection ends when it yields. The object you receive is an ordinary JavaScript object that Cypress does not mask or track, so assertions, .its(), .invoke() and failing commands all print what they touch.

open as a page

In Cypress, what does a failing `cypress run` leave on disk by default?

level: juniorimportance: must knowfreq 82%
basics
~20 s

One PNG per failed test, written under cypress/screenshots, because screenshotOnRunFailure defaults to true. No video: the video option defaults to false, so cypress/videos stays empty until you enable it. Neither of those happens in cypress open mode.

open as a page

In Cypress open mode, what does cy.pause() let you do to a running spec?

level: juniorimportance: must knowfreq 66%
basics
~20 s

cy.pause() stops the spec before the next queued command and hands control to the Command Log, where Resume finishes the run and Next advances exactly one command. While stopped you can click through the application, inspect the DOM, and read network traffic and storage.

open as a page

In the Cypress Command Log, what do hovering and clicking a command do?

level: juniorimportance: must knowfreq 78%
basics
~20 s

Hovering a Cypress Command Log entry restores the app under test to the DOM snapshot taken when that command ran. Clicking pins that snapshot so it stays put, and prints the entry's console properties to the browser console.

open as a page

In Cypress's `cy.screenshot()`, what do capture 'viewport', 'fullPage' and 'runner' capture?

level: middleimportance: must knowfreq 60%
basics
~20 s

viewport captures the application as it fits the current viewport, fullPage scrolls and stitches the whole application top to bottom, and runner captures the entire browser viewport including the Cypress Command Log. The default is fullPage.

open as a page

In a Cypress test, why does .debug() pause where a bare debugger line does not?

level: middleimportance: must knowfreq 60%
basics
~20 s

A bare debugger in the test body runs immediately, before any queued cy command has executed, so it stops on an untouched page. .debug() is itself queued, so it fires in order, with the previous command's subject in hand — the same effect as a debugger inside .then().

open as a page

Which projects is Cypress a strong fit for, and which are the classic misfits?

level: juniorimportance: must knowfreq 74%
basics
~20 s

Cypress fits an application your own team owns: JavaScript or TypeScript, one superdomain per test, Chrome-family or Firefox. The classic misfits are third-party sites, two-browser or second-tab flows, a real Safari or mobile-device sign-off, and spidering or performance work.

open as a page

What does it mean that Cypress runs your test code inside the browser?

level: juniorimportance: must knowfreq 82%
basics
~20 s

Cypress loads your spec into the browser alongside the application, so both run in the same run loop. Nothing is serialized between a command and an element: the test holds the real window, document and DOM nodes directly.

open as a page

In Cypress, which languages can specs be written in, and why is that permanent?

level: juniorimportance: must knowfreq 72%
basics
~20 s

JavaScript and TypeScript, and nothing else. Cypress evaluates spec code inside the browser alongside the application, so the only language it can ever run is the language of the web; the docs list this as a permanent trade-off.

open as a page

Which of a ported suite's waits vanish into Cypress retry-ability, and which do not?

level: middleimportance: must knowfreq 74%
basics
~20 s

Waits for an element to appear, become visible or change text vanish: cy.get() and .should() retry inside defaultCommandTimeout. Network waits become cy.intercept() plus cy.wait('@alias'). Waits on state outside the browser do not vanish at all.

open as a page

Porting a suite to Cypress, what replaces its XPath locators?

level: juniorimportance: should knowfreq 58%
basics
~10 s

Cypress has no first-class XPath support: cy.get() takes a CSS selector. Text-based XPath becomes cy.contains(), structural XPath becomes a CSS selector, and XPath axes become traversal commands such as .find(), .parent(), .next() and .eq().

open as a page