Does Cypress run tests in parallel and does it retry failed tests automatically?
No, neither by default: cypress run executes specs one after another, and a failed test is not retried until retries is enabled. Parallelism exists only across machines, through Cypress Cloud with --record --parallel or your own split with a CI matrix and --spec. A retry hides flakiness rather than curing it, so every test that passed on a retry is investigated separately.
Cypress · Running and CI
A test failed on CI and passed on the second attempt. Who reran it, and do specs run in parallel?
The question sounds like one, but both halves are answered "no, not by default". A single cypress run executes specs one after another, and a failed test is not repeated until retries are enabled explicitly. The lesson explains where parallelism comes from, what a retry really does and why it can hide a bug.
How it works
Parallelism.cypress run is one process with one browser: specs run sequentially. Parallelism appears only across machines. There are two ways: Cypress Cloud (--record --parallel, several machines sharing one --ci-build-id, Cloud distributes specs across machines) or your own split: a CI matrix where each job runs its slice of files through --spec, or a plugin such as cypress-split.
Retries. Default is 0. The setting distinguishes runMode (cypress run) from openMode (cypress open). Only the failed test is repeated, together with its beforeEach/afterEach hooks; other tests are untouched.
Where parallelism comes from
one machine
Specs in sequence
One process, one browser. It only gets faster if you split specs.
several machines
Parallel across jobs
Cloud --parallel or a CI matrix with your own file split.
Figure 1. Cypress parallelism lives between machines, not inside a process.
Example: from a "green" CI to an honest one
A team turned retries on everywhere and a green CI became normal. But a test that fails in every third run stays in the suite for years. Better: a minimum of retries on CI and a separate look at every test that passed on a retry.
// cypress.config.tsimport { defineConfig } from'cypress';
exportdefaultdefineConfig({
// retries on CI only, locally we want to see a failure at once
retries: { runMode: 2, openMode: 0 },
e2e: {},
});
// for one known-unstable test (with a ticket link)it('payment', { retries: { runMode: 3 } }, () => {
// ...
});
# each matrix job takes its own slice
npx cypress run --spec "cypress/e2e/checkout/**"
npx cypress run --spec "cypress/e2e/profile/**"
Limits and alternatives
A retry does not cure the cause: a test that passed on the second attempt is "green" in the report but is a flakiness signal (a race, a state not waited for, shared data). A retry also lengthens the run: a failing test executes up to three times. Cypress Cloud flags such tests as flaky; without Cloud you track them yourself, for example in a reporter's output. In Playwright, workers parallelise tests on one machine and --shard splits across machines; retries are off by default there too.
What it looks like on CI
The simplest self-made parallelism needs no services: a CI matrix where every job gets its own group of specs. The drawback is obvious: groups must be maintained by hand, and one heavy group sets the time of the whole run. That is where a duration-aware split helps, but even a split by folders already gives a visible gain.
# .github/workflows/e2e.yml (shortened)jobs:
cypress:
runs-on: ubuntu-latest
strategy:
fail-fast: false# one group does not stop the restmatrix:
group: [checkout, profile, search]
steps:
- uses: actions/checkout@v7
- run: npm ci
- run: npx cypress run --spec "cypress/e2e/${{ matrix.group }}/**"
A separate topic is the retry policy. A practical rule: runMode 1-2, locally 0, and any test that passed only on a retry goes onto a review list. Without such a list retries just hide instability: half a year later half the suite is "green" only thanks to the second attempt, and the run time has quietly grown. Signs that a retry hides a real bug rather than noise: the failure reproduces steadily on the same step, and it depends on data or test order, not on random timing.
Common mistakes
Believing that several terminals with cypress run give parallelism: they share artifacts folders, ports and data, which is a race, not scaling.
Enabling retries for openMode: failures are hidden locally and the developer misses the problem.
Raising the retry count instead of finding the cause: the test is just flaky more slowly.
Check yourself
A CI job runs cypress run on 40 specs and takes 30 minutes. Will raising retries help?
Answer
No, retries only add time for failed tests. Splitting specs over several machines speeds it up: Cloud with --parallel or a CI matrix with --spec.
A test passed on the second attempt. What do you do with the report?
Answer
Do not treat it as stable: it is a flaky candidate. Look at the cause of the first failure (screenshot, video, network), not just enjoy the green.
Related lessons: “How do you parallelise Cypress tests?”, “Flaky tests in Cypress and retries”, “A test is flaky on CI. How do you look for the cause in Cypress?”.
In the interview.Junior: No. One machine runs specs sequentially, and a failed test is not repeated until retries are enabled in the config. Middle/Senior: Parallelism exists only across machines: Cloud --parallel or a CI matrix splitting specs. I enable retries for runMode at 1-2 and review every test that passed on a retry, because a retry hides instability.
How do you keep login and cookies between tests?
cy.session keeps a login between tests: setup runs once, and the cookies and storage are cached and restored in later tests with the same id. Without it the login does not survive, because test isolation clears cookies and storage before every test. The validate option checks that the restored session is still alive, otherwise setup runs again, and each role gets its own id.
Cypress · State and sessions
Every test starts with a login, so 40 tests log in 40 times. How do you keep the session?
Cypress has always cleared cookies and localStorage between tests, and since version 12 test isolation also resets the page and sessionStorage, all of it across every domain. So a login done in one test does not survive to the next. The old Cypress.Cookies.preserveOnce was removed, and copying cookies between tests by hand is brittle. The modern answer is cy.session.
How it works
cy.session(id, setup, options) runs setup (the login) once for that id and caches cookies, localStorage and sessionStorage. In later tests with the same id Cypress clears the current state and restores the saved one without logging in. The validate option checks that the restored session is still alive; if not, setup runs again.
Life of a session
Figure 1. The login runs once, then the cache takes over.
Example: from copying cookies to cy.session
// Before: a login in every testbeforeEach(() => {
cy.visit('/login');
cy.get('[data-cy=email]').type('qa@example.com');
cy.get('[data-cy=password]').type('secret');
cy.get('[data-cy=submit]').click();
});
// After: log in once, then restoreCypress.Commands.add('login', (user: string) => {
cy.session(
user,
() => {
cy.request('POST', '/api/login', { user }); // faster than the UI
},
{
validate: () => {
cy.request('/api/me').its('status').should('eq', 200);
},
},
);
});
beforeEach(() => cy.login('qa'));
Logging in through cy.request inside setup is faster and more stable than the UI. A dedicated test of the login form itself still goes through the interface.
Limits and alternatives
By default a session is cached within one spec; cacheAcrossSpecs: true shares it across specs. After cy.session the page is blank, so cy.visit is needed in the test itself. Different roles use different ids. The Playwright counterpart is storageState: a setup project logs in, saves the state to JSON, and other projects load it through dependencies.
What exactly is cleared and cached
Before setup and before a restore Cypress clears cookies, localStorage and sessionStorage for all domains, and with test isolation on it clears the page too. The cache holds the same: cookies, localStorage and sessionStorage of every domain the session touched. The cache lives in memory, so a new cypress run starts empty. A practical consequence: a test that checks the login must not depend on another test's session.
What counts as a failed check in validate: a thrown error, a promise resolving to false or rejecting, a failing Cypress command, or a last command yielding false. Returning a plain false without a promise is not enough. If validate fails right after setup, the test fails with an error: the freshly created session is useless. If it fails after a restore, Cypress runs setup again.
// Separate roles and reuse across specs
cy.session(
['admin', 'v2'], // id: role + setup version
() => loginViaApi('admin'),
{
validate: () => {
cy.request('/api/me').its('status').should('eq', 200);
},
cacheAcrossSpecs: true, // in-memory cache for one run
},
);
cy.visit('/dashboard'); // we open the page ourselves
If the login changed (another endpoint or cookie), the old cache within a run no longer matches the code, so a version inside the id is useful. A separate case is tests that check the login form itself: a session gets in their way, since they start from a guaranteed clean state.
Common mistakes
One id for different users: a test gets someone else's session.
No validate: an expired token fails far from its cause.
Forgetting cy.visit after the restore: the test starts on a blank page.
Check yourself
The token in the session cache has expired. Which option catches it and what happens?
Answer
validate: after the restore Cypress runs it, and if the check fails the session is recreated through setup.
Why does a login in the first test not carry over to the second, though cookies were not deleted by hand?
Answer
Because of test isolation Cypress itself clears cookies and storage before each test. Keeping them needs cy.session.
Related lessons: “What is cy.session and how do you avoid logging in in every test?”, “Why is programmatic login better than login through the UI?”, “How does Cypress isolate tests from each other?”.
In the interview.Junior: With cy.session: it runs the login once, caches cookies and storages and restores them in later tests. Middle/Senior: I add validate, log in through the API in setup and use a separate id per role. The old preserveOnce was removed in version 12, and copying cookies by hand is brittle.
How do you make a pause (sleep) in Cypress?
Technically it is cy.wait(ms), but a fixed pause guesses the time, so the right approach is to wait for a state, not for time. Query commands and should assertions retry until the timeout, and for the network the test waits on an alias from cy.intercept. A long pause wastes seconds on every run, a short one fails on slow CI. Where time is the requirement (debounce), control it with cy.clock() and cy.tick().
Cypress · Waiting
The button appears after a second or two. Put cy.wait(2000) and forget it?
Technically cy.wait(ms) does pause, which is why the question is tricky. In an interview show that you know the catch: a fixed pause guesses the time. Guess generously and the test wastes seconds on every run; guess short and it fails on a slow CI machine.
How it works
Query commands (cy.get, cy.contains) and should assertions retry until they pass or the timeout runs out (defaultCommandTimeout is 4 s by default). So Cypress already waits, but it waits for a state, not for time: as soon as the condition holds, the test moves on. For the network the state is the end of a specific request: cy.intercept with an alias and cy.wait('@alias').
Pause or state
guessing
cy.wait(2000)
Always 2 s, even when ready in 100 ms. On a slow CI it may not be enough.
waiting for a state
should('be.visible')
Moves on as soon as the condition holds; fails only after the timeout.
Figure 1. Fixed time against waiting for a condition.
Example: from a pause to a wait
// Before
cy.get('[data-cy=search]').type('cypress');
cy.wait(2000);
cy.get('[data-cy=result]').should('have.length', 5);
// After: wait for the request, then the state
cy.intercept('GET', '/api/search*').as('search');
cy.get('[data-cy=search]').type('cypress');
cy.wait('@search');
cy.get('[data-cy=result]').should('have.length', 5);
The intercept with an alias is set before the action that triggers the request, otherwise it may miss it. The assertion on list length already retries on its own, so an extra wait is not always needed.
Limits and alternatives
The rare justified use: checking a debounce or delay, where the time itself is the requirement. Even then it is better to control time with cy.clock() and cy.tick() than to wait for real. In Playwright the same antipattern is page.waitForTimeout(), and web-first assertions and waitForResponse replace it.
Three kinds of waiting
It helps to distinguish what exactly the test waits for. An element state: should('be.visible'), should('have.text', …); all of it retries up to defaultCommandTimeout (4 s). A network event: cy.wait('@alias') after cy.intercept; here requestTimeout and responseTimeout apply. Time as a requirement: debounce, polling, a timer on the page; it is run through cy.clock() and cy.tick() without real waiting.
// Debounce of 500 ms: checked without a real pause
cy.clock();
cy.visit('/search');
cy.get('[data-cy=search]').type('cyp');
cy.get('@searchCalls.all').should('have.length', 0);
cy.tick(500); // 500 ms have "passed"
cy.wait('@searchCalls');
cy.get('@searchCalls.all').should('have.length', 1);
In this example searchCalls is an alias on cy.intercept('GET', '/api/search*').as('searchCalls'), registered before the visit. cy.clock() replaces the page timers, so time moves only through cy.tick: the test is instant and does not depend on machine speed. Order matters: call cy.clock() before the app creates its timers.
Another catch: after cy.wait('@alias') the UI may not have updated yet, because the response arrived but rendering continues. So the request wait is followed by an assertion on the visible result, not straight by the next action.
Common mistakes
cy.wait before every click "just in case": the suite grows by minutes.
Raising the pause when a test fails: that treats the symptom and keeps the race.
Setting cy.intercept after the action: the request has already gone and cy.wait('@alias') never gets it.
Check yourself
A test with cy.wait(1000) is stable locally but fails on CI. What does that say about the pause?
Answer
The second was guessed for a fast machine. On CI the response takes longer. Wait for a state: an assertion or a request alias.
When is cy.wait(ms) appropriate?
Answer
Almost never: only when time is part of the requirement (debounce), and then cy.clock with cy.tick is better.
Related lessons: “Why is cy.wait(3000) an antipattern and what to use instead?”, “What is retry-ability and what exactly is repeated?”, “How do you wait for a request and check it through an alias?”.
In the interview.Junior: Formally it is cy.wait with milliseconds, but I do not do that: it is a guessed number and the test either waits for nothing or fails. Middle/Senior: I wait for a concrete state: a retrying assertion or the end of a request through an intercept with an alias. For debounce I control time through cy.clock.
How do you use XPath in Cypress?
Cypress has no built-in XPath support, and the @cypress/xpath plugin is marked unsupported on npm, so a new project does not take it. Built-in commands cover what XPath is used for: cy.contains for text, .closest() and .parents() upward, .siblings() and .next() sideways, .find() downward. If XPath seems unavoidable, markup usually lacks attributes, so add data-cy.
Cypress · Selectors
An old Selenium test has an XPath locator. How do you carry it over to Cypress?
Cypress has no built-in XPath support. There used to be a plugin, @cypress/xpath, but npm marks it as no longer supported (last release in 2022), so a new project does not take it. The good news: the jobs people reach for XPath to do are covered by built-in commands.
How it works
Cypress selectors are CSS plus retrying query commands. XPath does three things that need replacing: find an element by text, go up to an ancestor and move to a sibling. The counterparts: cy.contains (text), .closest()/.parents() (up), .siblings()/.next()/.prev() (sideways), .find() (down). Each is a query, so the whole chain retries until the element appears.
What replaces what
Figure 1. Three typical XPath jobs have built-in commands.
The chain reads like a path in the table: find the cell, go up to the row, find the button. If you need semantics, Cypress 16.2 has a built-in cy.getByRole('button', { name: 'Delete' }) (earlier you took @testing-library/cypress for it); the most stable choice is a dedicated data-cy attribute.
Limits and alternatives
What the built-ins do not give: complex axes such as following:: or position-based picks in an arbitrary predicate. Such cases almost always point to weak markup; add a data-cy instead. Playwright supports XPath natively (page.locator('xpath=...'); a string starting with // is recognised automatically), but recommends getByRole, getByText and getByTestId.
Harder cases
Two common XPath jobs that first look hopeless. The first: "the cell after a header". In Cypress it is cy.contains('th', 'Status').next(), and the column number comes from the jQuery method through .invoke('index'). The second: "an element that contains a child with some text". Here cy.contains('li', 'Cart') works (it finds the node containing the text) or .filter(':has(...)') when you need a selector with a condition.
The index .eq(2) is brittle: column order changes. It is more reliable when the cell has its own data-cy, for instance data-cy="status", and the chain ends with .find('[data-cy=status]'). A good topic for developers: if you cannot do without XPath, usually attributes or semantic markup are missing, and the application should be fixed rather than another tool added.
Common mistakes
Adding a plugin for one button: an extra dependency that a couple of built-in commands replace.
Rewriting a long XPath into an equally long CSS with indexes: the brittleness stays.
Searching by text that changes between languages: that case needs data-cy.
Check yourself
How do you find a button in a table row by the text of a neighbouring cell in Cypress?
Answer
cy.contains('td', 'text').closest('tr').find('button'): find the cell, go up to the row, go down to the button.
Why is the answer "I will add @cypress/xpath" considered weak?
Answer
The plugin is no longer supported, and XPath needs are covered by contains, closest, siblings and data-cy.
Related lessons: “Which selectors does Cypress recommend and why?”, “How does cy.get() differ from .find() and cy.contains()?”, “How do you narrow the search: within, eq, first, filter?”.
In the interview.Junior: XPath is not built into Cypress, and the plugin for it is a separate dependency. I search by text with cy.contains. Middle/Senior: I move to a parent or sibling with closest, parents, siblings, and for stability I ask for data-cy. Playwright has XPath natively but also recommends role and test id.
How do you install Cypress correctly?
Cypress is installed locally as a dev dependency, npm install --save-dev cypress, so the lock file pins the version, not the machine. The installation has two parts: the package in node_modules and a Test Runner binary in a system cache, downloaded by a postinstall script for the package version. npm 12 blocks such scripts, so Cypress is approved or npx cypress install is run. CI caches the binary directory.
Cypress · Installation
Tests are green for a colleague, red for you, different on CI. Could you all have different Cypress versions?
Cypress is installed locally into the project as a dev dependency: npm install --save-dev cypress. Then package.json and the lock file pin the version, and you run it through npx cypress. A global install makes the version depend on the machine and breaks reproducibility.
How it works
The installation has two parts. The cypress package in node_modules is the CLI and API. The Test Runner application itself (the binary) is downloaded separately during npm install and stored in a system cache shared by projects: %LOCALAPPDATA%\Cypress\Cache on Windows, ~/.cache/Cypress on Linux, ~/Library/Caches/Cypress on macOS. The binary version follows the package version, so several versions can sit side by side in the cache.
Two parts of Cypress
in the project
npm package
Version in package.json and the lock file, the same for everyone.
in the system cache
Binary
Downloaded separately; cached across projects and CI runs.
Figure 1. The package pins the version, the binary lives in the cache.
Example: a typical installation
npm install --save-dev cypress # package into devDependencies
npx cypress open # first run, creates the config
npx cypress verify # is the binary in place and working
npx cypress install # download the binary if missing
npx cypress version # package and binary versions
On CI use npm ci (exactly per the lock file) instead of npm install and cache the binary folder, otherwise it is downloaded on every run. The folder can be changed with the CYPRESS_CACHE_FOLDER variable.
Limits and alternatives
A local install does not guarantee the same browser: Chrome and Firefox come from the system, and their versions differ. For full reproducibility on CI, use Cypress Docker images. The same rule applies to Playwright: npm i -D @playwright/test into the project and npx playwright install for browsers.
The binary cache and CI
The binary is downloaded by the package's postinstall script. If the package manager blocks such scripts (--ignore-scripts, a project policy, or npm 12+, which does it by default), there will be no binary and Cypress complains about it. Then run npx cypress install explicitly. The variable CYPRESS_INSTALL_BINARY=0 skips the download on purpose: handy for base Docker images where the binary is installed in a separate step. The cache folder is changed with CYPRESS_CACHE_FOLDER; that folder must exist every time Cypress launches.
The cache key is built from the lock file: update the Cypress version, the key changes, and the new binary version is downloaded. The path ~/.cache/Cypress is valid for Linux runners; other OSes use a different one (see above).
Common mistakes
npm install -g cypress: every machine has its own version and "works on my machine" cannot be reproduced.
Not caching the binary on CI: hundreds of megabytes downloaded every time.
Updating the package without checking the binary: cypress verify shows the mismatch.
Check yourself
After npm ci on CI Cypress will not start and complains about a missing binary. Where do you look?
Answer
The package is installed but the binary was not downloaded or the cache is empty. npx cypress install fetches it and cypress verify confirms.
Why does a global install hurt a team project?
Answer
The version depends on the machine rather than the repository, so local and CI runs differ.
Related lessons: “What do the project structure and the Cypress config look like?”, “How to install and cache Cypress in CI?”, “What is Cypress and how does it differ from Selenium?”.
In the interview.Junior: Locally into the project as a dev dependency, so the version is pinned and the same for everyone and on CI. Middle/Senior: I know there is a package and a separate binary in the cache. On CI I use npm ci, cache the binary folder and pin a Docker image if needed, because browsers stay system-level.
The element is hidden and the click doesn't go through. What do you do?
First find out why the element is hidden or covered instead of adding { force: true }, because that switches the checks off rather than fixing the problem. Before an action Cypress retries actionability checks until the timeout: the element is visible, enabled, uncovered and not animating. Remove the obstacle (a modal, a banner), wait for the state with should, and keep force for deliberately hidden elements, with a comment.
Cypress · Actions on elements
The click fails: the element is covered or hidden. Add force: true?
The test fails saying the element is hidden, covered by another one or disabled. The temptation is to add { force: true } and turn the test green. But that switches a check off rather than fixing anything. First understand why the element is hidden.
How it works
Before an action (click, type, check) Cypress runs actionability checks and retries them until the timeout: the element is visible, not disabled, not covered, not animating, scrolled into view. The error means the condition never held in the waiting time. The causes differ, and so do the fixes.
The cause decides the step
Figure 1. Diagnose before force.
Example: from force to the cause
// Before: a cookie banner covers it
cy.get('[data-cy=buy]').click({ force: true });
// After: remove the obstacle, wait for the state
cy.get('[data-cy=cookie-accept]').click();
cy.get('[data-cy=buy]').should('be.visible').click();
// a sticky header covers it after scrolling
cy.get('[data-cy=buy]').click({ scrollBehavior: 'center' });
The second version is more honest, because a user would also dismiss the banner first. If the banner genuinely gets in the way, that is the finding.
Limits and alternatives
force: true turns the actionability checks off: a test can pass where a person could not click. A justified use is deliberate: a hidden native checkbox under a custom one, an input type=file with no visible state. Then add a comment saying why. In Playwright it is the same: click({ force: true }) also skips the checks, and the same logic applies.
What exactly blocks an action
force: true turns off the actionability wait: Cypress fires events at once, even when the element is disabled or moving. The full list of checks is described on the "Interacting with Elements" page; in practice three places matter. Covering: a modal, an overlay, a sticky header. Animation: the element is still sliding into place, and Cypress waits until it stops. Element state: a button is disabled until form validation finishes, which is business logic the test has to wait for, not bypass.
// The button activates after validation: wait for state, not force
cy.get('[data-cy=email]').type('qa@example.com');
cy.get('[data-cy=submit]').should('be.enabled').click();
// A justified force: the native checkbox is hidden by styles// (a custom toggle on top), so for the user it is "its own"
cy.get('input[type=checkbox]#agree').check({ force: true });
cy.get('#agree').should('be.checked'); // we verify the result
Note the technique: even when force is justified, an assertion on the result follows at once. That way the test does not pretend that the click had an effect. The scrollBehavior option takes an alignment ('center', 'nearest' and others) or false and fixes a typical problem: after scrolling the element ends up under a sticky header.
Common mistakes
force: true on every click: the suite no longer catches overlaps a user would see.
Not waiting for an element to appear and adding cy.wait: should('be.visible') is correct.
Ignoring animation: a click on a moving element misses, so wait for stability.
Check yourself
The error says div.modal covers the button. What do you check first?
Answer
Whether the modal should be on screen. If so, the test closes it; if not, it is an app bug, not a reason for force.
When is force: true justified?
Answer
When an element is deliberately hidden from the user but works (a native checkbox under a custom one), and a comment states the reason.
Related lessons: “Why is { force: true } dangerous?”, “What is retry-ability and what exactly is repeated?”, “Which selectors does Cypress recommend and why?”.
In the interview.Junior: First I find the cause: covered, not there yet, or a bug. I use force rarely and with a comment. Middle/Senior:force disables actionability, so a test can be green where a user would be stuck. So I remove the obstacle, wait for the state with should, and for a sticky header use scrollBehavior.
How does requestTimeout differ from responseTimeout?
requestTimeout is how long to wait for the app to send a request (5000 ms by default), and responseTimeout is how long to wait for the response (30000 ms). The first firing usually points at the test or UI: the click did not happen, the URL or method does not match the intercept, or the intercept comes after the action. The second points at the backend. Raising both blindly is not advisable.
Cypress · Timeouts
cy.wait('@orders') failed after 5 s. Is the backend slow, or did the request never go out?
Two similar settings answer different questions. requestTimeout is whether the request went out, responseTimeout is whether the response came back. Which timeout fired decides where to look: the test and UI or the backend.
How it works
requestTimeout (5000 ms by default) is how long cy.wait('@alias') waits for the app to send a request that matches the intercept. responseTimeout (30000 ms) is how long to wait for the response: for an intercepted request in cy.wait and for cy.request. There are also defaultCommandTimeout (4000 ms) for query commands and pageLoadTimeout (60000 ms) for page loads.
Two stages of a request
Figure 1. Different stages have different timeouts.
Example: what each failure means
cy.intercept('GET', '/api/orders').as('orders');
cy.get('[data-cy=load]').click();
cy.wait('@orders'); // no request in 5 s: a test or UI problem// slow backend: raise the response timeout only here
cy.wait('@orders', { responseTimeout: 60000 });
If requestTimeout fired, usually the click did not happen, the URL or method does not match the intercept, or the intercept was registered after the action. If responseTimeout fired, the request went out but the backend did not answer: look at its latency, not the test.
Limits and alternatives
Timeouts can be overridden globally in the config, per command through its options ({ requestTimeout: ... }), or for cy.request with the timeout option. A global increase hides slowness: raise them pointwise. API speed needs separate load checks, not wider timeouts.
Diagnosis step by step
When cy.wait('@alias') fails, the sequence is this. First look at the Test Runner command log: did the click happen before the wait, and is the needed request in the list. Then compare the intercept's method and URL with the real request: GET /api/orders?page=1 does not match '/api/orders' without a pattern, you need '/api/orders*' or an object with query. Finally check the order: the intercept is registered before the action. Only when the request is in the log but there is no response are we talking about responseTimeout and the backend.
// Three levels: a command, a request wait, an API call
cy.get('[data-cy=load]', { timeout: 10000 }).click();
cy.intercept('GET', '/api/orders*').as('orders');
cy.get('[data-cy=load]').click();
cy.wait('@orders', { requestTimeout: 8000, responseTimeout: 45000 })
.its('response.statusCode')
.should('eq', 200);
cy.request({ url: '/api/report', timeout: 90000 }); // a long report
If you set only timeout, it becomes the default for both waiting timeouts, and the more specific options override it. So an increase should be pointwise and have its reason in a comment or ticket, not somewhere in the global config. For comparison: pageLoadTimeout (60 s) is about page loading, defaultCommandTimeout (4 s) about query commands and assertions.
Common mistakes
Raising responseTimeout when requestTimeout fired: the request never went out, waiting longer will not help.
Setting the intercept after the click: the request has already passed.
Raising every timeout to a minute "to stop flakiness": the test fails more slowly, not less often.
Check yourself
cy.wait('@orders') fails after 5 seconds. Which setting fired and what do you check?
Answer
requestTimeout: the request was not sent. Check that the UI action happened and that the intercept matches URL and method and sits before the action.
The request went out and the response came after 40 s. What do you do with the timeout?
Answer
responseTimeout is 30 s by default, so the test fails. But first a question for the backend: 40 seconds is a problem, not a reason to raise the limit.
Related lessons: “What timeouts does Cypress have and how do you override them?”, “How do you wait for a request and check it through an alias?”, “What is cy.request and how does it differ from cy.intercept?”.
In the interview.Junior: These are two stages. requestTimeout is five seconds for the request to be sent at all; responseTimeout is thirty for the response to arrive. Middle/Senior: The first usually points to the test or UI (the click did not happen, intercept after the action), the second to the backend. So I do not raise both blindly but look at which one fired.
How do you recognise an outdated answer about Cypress structure?
An outdated answer uses names Cypress removed: cypress.json, cy.server and cy.route, and since version 16 Cypress.env() and cy.exec(). The current counterparts are the cypress.config file with specPattern, cy.intercept(), cy.env() or Cypress.expose() and cy.task(), and video has been off by default since version 13. Exact versions are checked against the Migration Guide.
Cypress · Currency
A candidate says "cypress.json and cy.route". What in that answer is outdated?
Cypress has changed noticeably: version 10 redesigned the config and structure, 12 removed old network and cookie APIs, 13 turned video off by default, 16 removed Cypress.env() and cy.exec(). The interviewer does not listen for a version number but for whether your answer matches current Cypress. The table below is a quick check.
How it works
Each row is a pair "what it was, what it became". Remember not just the new word but the reason: cy.intercept gives one API for any requests instead of two separate commands, cy.session caches state instead of moving cookies by hand, and setupNodeEvents keeps Node logic in the config itself.
Outdated
Current
cypress.json
cypress.config.js / .ts
cypress/integration
cypress/e2e, *.cy.ts files
testFiles
specPattern
cypress/plugins/index.js
setupNodeEvents in the config
cy.server(), cy.route()
cy.intercept() (old commands removed in v12)
Cypress.Cookies.preserveOnce
cy.session() (removed in v12)
Video is always recorded
Off by default since v13
Cypress.env()
Since v16: cy.env() for secrets, Cypress.expose() for the rest
cy.exec()
Removed in v16: cy.task() with child_process
Example: from an old answer to a modern one
// Outdated: cy.server() and cy.route()
cy.server();
cy.route('GET', '/api/users', 'fixture:users.json');
// Current
cy.intercept('GET', '/api/users', { fixture: 'users.json' });
// cypress.config.ts (instead of cypress.json and plugins/index.js)import { defineConfig } from'cypress';
exportdefaultdefineConfig({
e2e: {
specPattern: 'cypress/e2e/**/*.cy.ts',
setupNodeEvents(on, config) {
// Node events and plugins go herereturn config;
},
},
});
Limits and alternatives
The table reflects the state in November 2026 and will age on its own. More reliable than memory: the Migration Guide page on docs.cypress.io and the changelog, where each removal is listed with its version. On a legacy project reality can differ: cypress.json or old versions may live there, and that is no reason to call an answer wrong but a reason to name the migration path.
What a migration looks like in practice
Old versions are usually migrated step by step, not in one jump: first to 10 (the new config and structure), then through the changes of 12 (cy.server, cy.route, preserveOnce removed), then to the current one. At every step read the Migration Guide section for that version: it lists what was removed and what replaces it. A useful habit: run the whole suite after each step and record the result, because a removed command breaks a test at once, while a changed behaviour (for example test isolation) shows up selectively.
// Before (pre-16): environment variables and a shell from a testconst apiUrl = Cypress.env('API_URL');
cy.exec('node scripts/seed.js');
// After: public via expose, a secret via cy.env, a shell via taskconst apiUrl = Cypress.expose('API_URL');
cy.env(['API_TOKEN']).then(({ API_TOKEN }) => {
cy.request({ url: '/api/me', auth: { bearer: API_TOKEN } });
});
cy.task('seed'); // in setupNodeEvents: child_process.execFile(...)
Variables are declared in the env block (secrets, read asynchronously through cy.env()) and the expose block (public, read synchronously through Cypress.expose()) of the config; an undefined variable yields undefined. All of this follows a general trend: Cypress separates secrets from public settings and moves running shell commands from the page into Node.
Common mistakes
Learning only the words from the table without the reasons: no answer to "and why?".
Taking solutions from old articles: cy.route, preserveOnce or cy.exec will not work in fresh code.
Mixing up the binary and package versions during a migration: check with cypress verify.
Check yourself
Old code has cy.server() and cy.route(). What replaces them and since which version are they unavailable?
Answer
cy.intercept(); the old commands were removed in Cypress 12.
A script runs a shell command through cy.exec(). What changes in v16?
Answer
cy.exec() is removed; move the command into cy.task() and run it in Node through child_process.
Related lessons: “What do the project structure and the Cypress config look like?”, “What is cy.intercept and where exactly does the interception happen?”, “What is cy.session and how do you avoid logging in in every test?”, “How do you configure different environments and environment variables?”.
In the interview.Junior: The config is cypress.config, tests live in e2e, specPattern replaces testFiles, plugins sit in setupNodeEvents. The network is intercepted with intercept, sessions are kept with cy.session. Middle/Senior: I also know the newer changes: video is off since 13, and in 16 Cypress.env() (there are cy.env() and Cypress.expose()) and cy.exec() were removed. For accuracy I check the Migration Guide.