Cypress interview questions — Medium
353 medium-level Cypress questions from our Automation Testing bank, each with the correct answer and an explanation of why it is correct.
What this covers
Cypress appears throughout Automation Testing interviews. At medium level, interviewers are typically checking that you have used it in practice: what you configured, what broke, and how you knew it worked. Work through these, then explain your answer out loud; the second part is what interviews actually test.
20 example questions
1. During a code review, a reviewer asks: Why do Cypress commands rarely need explicit waits?
- A. They never wait.
- B. Commands auto-retry until actionable or assertions pass.correct
- C. Animations are disabled.
- D. It sleeps 5s each command.
Why: Cypress auto-retries commands/assertions within a timeout.
2. "Queries the DOM for elements matching a selector, with retry" — in Cypress, this describes which of the following?
- A. Cy.fixture().
- B. BeforeEach hook.
- C. Chai assertions (.should).
- D. Cy.get().correct
Why: cy.get(): Queries the DOM for elements matching a selector, with retry.
3. "Changes the screen size/orientation for the test" — in Cypress, this describes which of the following?
- A. BeforeEach hook.
- B. Cy.get().
- C. Cy.stub().
- D. Cy.viewport().correct
Why: cy.viewport(): Changes the screen size/orientation for the test.
4. "Assertion syntax chained onto Cypress queries with retry-ability" — in Cypress, this describes which of the following?
- A. Chai assertions (.should).correct
- B. Cy.viewport().
- C. Cy.request().
- D. Cy.fixture().
Why: chai assertions (.should): Assertion syntax chained onto Cypress queries with retry-ability.
5. "Runs setup code before every test in the block" — in Cypress, this describes which of the following?
- A. Cy.fixture().
- B. Cy.get().
- C. BeforeEach hook.correct
- D. Cy.task().
Why: beforeEach hook: Runs setup code before every test in the block.
6. "Loads static data files from the fixtures folder" — in Cypress, this describes which of the following?
- A. Chai assertions (.should).
- B. Cy.fixture().correct
- C. Cy.stub().
- D. BaseUrl.
Why: cy.fixture(): Loads static data files from the fixtures folder.
7. "Executes Node.js code from within a test via the plugins process" — in Cypress, this describes which of the following?
- A. Cy.task().correct
- B. Cy.request().
- C. Chai assertions (.should).
- D. Cy.stub().
Why: cy.task(): Executes Node.js code from within a test via the plugins process.
8. Which of the following statements about Cypress is TRUE?
- A. Cypress supports WebKit/Safari as fully as Chrome with no experimental flags in every version.
- B. Cypress requires manual sleep() calls because it has no automatic retry.
- C. Fixtures in Cypress load static test data from the cypress/fixtures folder.correct
- D. Cypress fully supports controlling multiple browser tabs simultaneously in all versions.
Why: cy.fixture() reads JSON or other files for data-driven tests.
9. Which statement correctly describes Cypress?
- A. Cy.intercept() can only observe requests and cannot stub responses.
- B. Fixtures in Cypress load static test data from the cypress/fixtures folder.correct
- C. Component testing in Cypress launches the entire application backend.
- D. Cypress commands return values synchronously that you can assign with const el = cy.get(...).
Why: cy.fixture() reads JSON or other files for data-driven tests.
10. Identify the accurate statement about Cypress:
- A. Cypress supports WebKit/Safari as fully as Chrome with no experimental flags in every version.
- B. Component testing in Cypress launches the entire application backend.
- C. Cypress Component Testing mounts individual framework components (React, Vue, Angular) for isolated testing.correct
- D. Cypress requires manual sleep() calls because it has no automatic retry.
Why: Component tests render a single component without the full app.
11. "Finds an element containing specific text" — in Cypress, this describes which of the following?
- A. Cy.viewport().
- B. Chai assertions (.should).
- C. Cy.stub().
- D. Cy.contains().correct
Why: cy.contains(): Finds an element containing specific text.
12. "Config value prepended to cy.visit() paths" — in Cypress, this describes which of the following?
- A. Cy.task().
- B. Cy.viewport().
- C. Chai assertions (.should).
- D. BaseUrl.correct
Why: baseUrl: Config value prepended to cy.visit() paths.
13. Which Cypress concept matches this description: "Runs setup code before every test in the block"?
- A. Cy.fixture().
- B. BeforeEach hook.correct
- C. Cy.viewport().
- D. BaseUrl.
Why: beforeEach hook: Runs setup code before every test in the block.
14. Which Cypress concept matches this description: "Assertion syntax chained onto Cypress queries with retry-ability"?
- A. Chai assertions (.should).correct
- B. Cy.viewport().
- C. Cy.fixture().
- D. BaseUrl.
Why: chai assertions (.should): Assertion syntax chained onto Cypress queries with retry-ability.
15. Which Cypress concept matches this description: "Replaces a function to control behavior and record calls"?
- A. BeforeEach hook.
- B. Cy.contains().
- C. Cy.stub().correct
- D. Cy.fixture().
Why: cy.stub(): Replaces a function to control behavior and record calls.
16. Which Cypress concept matches this description: "Sends an HTTP request directly, bypassing the UI"?
- A. Cy.get().
- B. Cy.viewport().
- C. Cy.stub().
- D. Cy.request().correct
Why: cy.request(): Sends an HTTP request directly, bypassing the UI.
17. In Cypress, which of the following is described as: "Loads static data files from the fixtures folder"?
- A. Cy.fixture().correct
- B. Cy.get().
- C. Cy.contains().
- D. Cy.stub().
Why: cy.fixture(): Loads static data files from the fixtures folder.
18. In Cypress, which of the following is described as: "Runs setup code before every test in the block"?
- A. Cy.get().
- B. Cy.stub().
- C. Cy.fixture().
- D. BeforeEach hook.correct
Why: beforeEach hook: Runs setup code before every test in the block.
19. In Cypress, which of the following is described as: "Queries the DOM for elements matching a selector, with retry"?
- A. Cy.get().correct
- B. Cy.stub().
- C. BaseUrl.
- D. BeforeEach hook.
Why: cy.get(): Queries the DOM for elements matching a selector, with retry.
20. In the context of Cypress, which of the following is a correct statement?
- A. Cypress supports WebKit/Safari as fully as Chrome with no experimental flags in every version.
- B. Component testing in Cypress launches the entire application backend.
- C. Fixtures in Cypress load static test data from the cypress/fixtures folder.correct
- D. Cypress fully supports controlling multiple browser tabs simultaneously in all versions.
Why: cy.fixture() reads JSON or other files for data-driven tests.