Cypress Interview Questions and Answers
End-to-end and component testing with Cypress: the command queue and retry-ability, selectors and actions, assertions, aliases, cy.intercept and fixtures, cy.session and logins, custom commands and tasks, test isolation and data, CI, parallel runs, flaky tests and suite architecture.
228 questions for Cypress interviews with answers and explanations - Junior, Middle and Senior levels. Sample questions, online quizzes and coding tasks.
- Retry-ability
- cy.intercept
- cy.session
- Custom commands
- CI
Questions by level
Junior
Core concepts and syntax · 50 questions
Middle
Practice, nuances and optimization · 50 questions
Senior
Architecture, internals, edge cases · 50 questions
Sample questions
A few questions from each level with the correct answer and an explanation.
Cypress · Junior
- Where do Cypress tests run?
Show the answer
Correct answer: Inside the browser, next to the app under test
Cypress runs test code in the same browser run loop as the app, with a Node.js process alongside for tasks like files and network proxying. That's why it can read app state directly.
- Which command opens the interactive Cypress app?
Show the answer
Correct answer:
npx cypress opencypress openlaunches the app where you pick a browser and spec and watch tests run.cypress runruns tests headlessly, as in CI. - Which command runs all Cypress tests headlessly, e.g. in CI?
Show the answer
Correct answer:
npx cypress runcypress runruns every spec in the terminal, records failure screenshots, and returns a non-zero exit code on failures. - Where is the main Cypress configuration usually defined?
Show the answer
Correct answer: In
cypress.config.tsorcypress.config.jsThe config file sets
baseUrl, spec patterns, viewport, timeouts, retries and Node event handlers viadefineConfig.
Cypress · Middle
- In Cypress 12+, what is the difference between queries and action commands?
Show the answer
Correct answer: Queries like
getare retried; actions likeclickrun onceQueries re-run until assertions pass. Actions such as
.click()or.type()aren't retried, though they wait for actionability first. - In
cy.get('.list').find('li').should('have.length', 3), what is retried?Show the answer
Correct answer: The whole chain of queries before the assertion
Since Cypress 12, a failing assertion re-runs the chain of linked queries, so newly rendered elements are found.
- What does
.its('length')do?Show the answer
Correct answer: Gets a property of the subject, with retrying
.its()is a query, socy.get('li').its('length').should('be.gt', 2)retries..invoke()calls a method on the subject. - How do you check the body a form sends to the API?
Show the answer
Correct answer: Intercept it and assert
interception.request.bodyThis catches frontend bugs like wrong field names or types that a stubbed backend would accept silently.
Cypress · Senior
- What is the main architectural trade-off of Cypress running inside the browser?
Show the answer
Correct answer: Direct access to the app, but limits like one tab and same-origin rules
Running in the browser gives time travel, app access and reliable waits. The cost is single-tab control, origin limits and JavaScript-only tests.
- When would you choose Cypress over Playwright for a team?
Show the answer
Correct answer: When the team values its interactive runner and the app fits its limits
Cypress shines for single-app JS teams wanting fast feedback in the app runner. Multi-tab, multi-origin or multi-language needs favour Playwright.
- Why does Cypress need
cy.originfor SSO flows while Playwright doesn't?Show the answer
Correct answer: Cypress runs inside one origin's page and must switch context explicitly
Playwright drives the browser from outside, so origins don't matter. Cypress runs in the page, so other origins need a separate execution context.
- What is the most common root cause of flaky Cypress tests in large suites?
Show the answer
Correct answer: Shared state and timing assumptions, like fixed waits or leaked data
Most flakes trace to tests depending on each other, on real timing, or on shared backend data. Fix the cause; retries only hide it.
Coding tasks
Write your solution right in the browser, and tests check it instantly. JavaScript interview classics (debounce, deepClone, Promise.all, an LRU cache), TypeScript tasks on generics, narrowing and utility types checked by the real compiler, Node.js backend logic (middleware, rate limiters, job queues), SQL queries in real PostgreSQL, and React components and hooks like a todo list, tabs, useDebounce and useInterval.
Open tasks →