Interview Questions

30 Cypress Interview Questions and Answers (2026)

Thirty Cypress questions with model answers and working code, grouped from basics to framework design, so you can walk into your next automation round prepared.

✍️ By QA Jobs India📅 4 Nov 2026⏱ 10 min read

Most candidates who list Cypress on their resume can write a login test. Far fewer can explain why cy.get() does not return an element, or why their test passes locally and fails in CI. That gap is exactly where interviewers dig, and it is why these Cypress interview questions focus on the “why” behind each answer, not just the syntax.

The 30 questions below are grouped into basics, commands and assertions, network and data handling, and framework and CI topics. Each answer is short enough to say out loud in an interview, and the code samples work with Cypress 13 and later. If you are still learning the tool, start with our Cypress tutorial for beginners and come back here once you have written a few specs.

Key takeaways

  • Interviewers care most about Cypress architecture, the command queue and retry-ability. Get these three right and the rest of the round becomes easier.
  • Know cy.intercept(), cy.session(), fixtures and custom commands well enough to write them on a whiteboard.
  • Be honest about limitations such as multiple tabs and iframes, and explain the workaround you used.
  • Prepare one real story about fixing a flaky Cypress test. It is one of the most common follow-up questions.
  • Link every answer back to a project you actually built. A generic answer rarely gets you to the next round.

How Cypress interview rounds usually work

For automation roles with one to five years of experience, a Cypress round usually has three parts. First, conceptual questions on architecture and commands. Second, a live coding task, often automating a login or a search page on a demo site. Third, framework questions: folder structure, configuration, reporting and how tests run in your CI pipeline.

Service companies tend to ask more definition-style questions, while product companies and startups lean on live coding and debugging. In both cases, the interviewer is checking whether you have used the tool on a real project or only watched a course.

Cypress interview questions on basics (1-8)

1. What is Cypress and how is it different from Selenium?

Cypress is a JavaScript-based end-to-end and component testing tool. The main difference is architecture. Selenium sends commands to the browser through the WebDriver protocol from a separate process. Cypress runs your test code inside the browser, in the same run loop as the application, with a Node.js server process alongside it for tasks such as file access and network proxying. This gives Cypress direct access to the DOM, automatic waiting and fast feedback, but it also explains its limitations, like no native support for multiple tabs. For a deeper comparison, see our Playwright vs Selenium vs Cypress guide.

2. Which browsers does Cypress support?

Cypress supports Chrome-family browsers (Chrome, Chromium, Edge), Firefox and the bundled Electron browser. WebKit support exists but is still marked experimental. Safari on real devices is not supported, which matters if your product has a large iOS Safari audience.

3. What is the difference between cypress open and cypress run?

cypress open launches the interactive Test Runner, where you pick a spec and watch it run with time-travel snapshots. cypress run executes specs headlessly from the command line, which is what you use in CI. You can pass flags such as --spec, --browser chrome and --headed.

4. Explain the Cypress folder structure.

A default project has cypress/e2e for spec files, cypress/fixtures for static test data, cypress/support for custom commands and global hooks (e2e.js and commands.js), and cypress.config.js at the project root. Screenshots and videos are written to their own folders during cypress run.

5. What goes into cypress.config.js?

The config file uses defineConfig and holds settings for e2e and component testing.

const { defineConfig } = require('cypress');

module.exports = defineConfig({
  e2e: {
    baseUrl: 'https://example.cypress.io',
    defaultCommandTimeout: 6000,
    retries: { runMode: 2, openMode: 0 },
    setupNodeEvents(on, config) {
      on('task', {
        log(message) {
          console.log(message);
          return null;
        }
      });
      return config;
    }
  }
});

setupNodeEvents is where you register Node-side plugins and tasks.

6. Are Cypress commands synchronous?

No. Cypress commands are enqueued and run later, in order. When you call cy.get('button'), nothing happens immediately; the command is added to a queue. That is why you cannot assign the result of cy.get() to a variable and use it on the next line. You work with yielded values through .then(), .should() or aliases.

7. Can you use async/await with Cypress commands?

Not directly. Cypress commands are not real promises, so await cy.get(...) does not behave as you would expect. Use .then() to access yielded subjects. If you need real async Node code, such as a database query, put it in a cy.task() handler.

8. What is test isolation in Cypress?

Since Cypress 12, testIsolation is on by default for e2e tests. Before each test, Cypress clears the page, cookies, local storage and session storage. Each test must set up its own state, which makes tests independent but means you need cy.session() to avoid logging in through the UI every time.

Commands, assertions and retry-ability (9-17)

9. What is retry-ability?

Queries such as cy.get(), .find() and .contains() retry automatically until the assertions chained after them pass or the timeout expires. The default timeout is 4 seconds and can be changed with defaultCommandTimeout or per command with { timeout: 10000 }. Action commands like .click() are not retried in the same way, which is why the assertion should come before the action when timing matters.

10. What is the difference between .should() and .then()?

.should() retries its callback until the assertions inside pass or the timeout is reached. .then() runs its callback once with the yielded subject and does not retry. Use .should() for checks on changing UI, and .then() when you need the value to do something else.

cy.get('[data-cy=cart-count]').should(($el) => {
  expect(Number($el.text())).to.be.greaterThan(0);
});

cy.get('[data-cy=order-id]').invoke('text').then((orderId) => {
  cy.log('Created order ' + orderId);
});

11. Which assertion libraries come with Cypress?

Cypress bundles Chai, Chai-jQuery and Sinon-Chai. That is why you can write both should('be.visible') and expect(value).to.equal(5) without installing anything else.

12. How do you choose locators in Cypress?

Prefer dedicated test attributes such as data-cy or data-testid, because they do not change when styling or text changes. Use cy.contains() when visible text is the real requirement. Avoid long CSS chains and auto-generated class names.

13. What are aliases and how do you use them?

.as('name') stores a subject, route or fixture. You read it back with cy.get('@name') or, inside a function () {} callback, with this.name. Aliases are cleared between tests, so set them in beforeEach.

14. How do you handle iframes?

Cypress has no built-in iframe command. A common approach reads the iframe body and wraps it:

cy.get('iframe#payment')
  .its('0.contentDocument.body')
  .should('not.be.empty')
  .then(cy.wrap)
  .find('input[name=card]')
  .type('4242424242424242');

This only works for same-origin iframes. Mention that in the interview; it shows you know the limitation.

15. How do you handle a link that opens a new tab?

Cypress does not support multiple tabs. The usual workaround is to remove the target attribute and open the link in the same tab, or to assert on the href value instead of following it.

cy.get('a[data-cy=terms]').invoke('removeAttr', 'target').click();
cy.url().should('include', '/terms');

16. How do you upload a file?

Use .selectFile(), available since Cypress 9.3. Pass a path relative to the project root or a fixture reference.

cy.get('input[type=file]').selectFile('cypress/fixtures/resume.pdf');

17. How do you deal with uncaught exceptions from the application?

By default, an uncaught exception in the app fails the test. If the error is known and unrelated, you can return false from the uncaught:exception event, ideally scoped to a specific message rather than ignoring everything.

Cypress.on('uncaught:exception', (err) => {
  if (err.message.includes('ResizeObserver')) {
    return false;
  }
});

Network, data and API questions (18-24)

18. What does cy.intercept() do?

cy.intercept() spies on or stubs network requests made by the application. You can wait for a request, assert on its body, or replace the response with a fixture to test edge cases such as empty lists or server errors.

cy.intercept('GET', '/api/jobs*', { fixture: 'jobs.json' }).as('getJobs');
cy.visit('/jobs');
cy.wait('@getJobs').its('response.statusCode').should('eq', 200);
cy.get('[data-cy=job-card]').should('have.length', 3);

19. Why is cy.wait(5000) considered bad practice?

A fixed wait slows every run and still fails when the server is slower than expected. Waiting on an intercepted alias, or asserting on the UI state you expect, waits only as long as needed.

20. How do you use fixtures?

Place JSON files in cypress/fixtures and load them with cy.fixture('user.json'), or reference them directly in cy.intercept(). Fixtures keep test data out of spec files and make data-driven tests simpler.

21. How do you make API calls in Cypress?

cy.request() sends HTTP requests from the Node side, so it is not limited by browser CORS rules. Teams use it to seed data, log in through the API, or write simple API checks alongside UI tests.

22. What is cy.session() and why use it?

cy.session() caches cookies and storage after a setup function runs, and restores them in later tests with the same id. It cuts minutes from suites that log in before every test.

Cypress.Commands.add('login', (email, password) => {
  cy.session([email, password], () => {
    cy.visit('/login');
    cy.get('[data-cy=email]').type(email);
    cy.get('[data-cy=password]').type(password, { log: false });
    cy.get('[data-cy=submit]').click();
    cy.url().should('include', '/dashboard');
  });
});

23. How do you manage environment variables?

Use Cypress.env('name') to read values. You can set them in the env block of the config, in cypress.env.json, with --env on the command line, or through OS variables prefixed with CYPRESS_. Keep secrets in CI variables, never in the repository.

24. When would you use cy.task()?

When you need to run code in Node rather than the browser: reading files outside the project, querying a database, or calling a library that does not run in the browser. The task is registered in setupNodeEvents and must return a value or null.

Framework, CI and real-project questions (25-30)

25. How do you create custom commands?

Add them in cypress/support/commands.js with Cypress.Commands.add(). Good candidates are repeated multi-step flows such as login or adding an item to a cart. Keep them small; a command that hides ten assertions makes failures hard to read.

26. Do you use the Page Object Model with Cypress?

Many teams do, and many prefer custom commands plus small helper modules. A reasonable answer: page objects work if they only hold selectors and actions, while assertions stay in the spec. Explain what your team chose and why.

27. How do you handle flaky tests?

Start by finding the cause, not by adding retries. Common causes are fixed waits, tests that depend on each other, shared test data and unstubbed third-party calls. Fix the root cause first, then use retries in run mode as a safety net, and track which tests needed a retry.

28. How do you run Cypress in CI?

Install dependencies, start the app if needed, and run npx cypress run. The official Cypress Docker images include the browsers. On GitHub Actions, the cypress-io/github-action handles install and caching. Store screenshots and videos as build artifacts so failures can be debugged.

29. How do you run tests in parallel?

Cypress Cloud offers parallelisation with --record --parallel, which balances specs across machines. Without it, teams split spec files across CI jobs manually. Either way, tests must be independent for parallel runs to be reliable.

30. What are the main limitations of Cypress?

No native multi-tab support, limited cross-origin handling (improved by cy.origin()), JavaScript or TypeScript only, experimental WebKit, and no native mobile app testing. Naming these honestly, together with how you worked around them, usually scores better than claiming the tool can do everything.

Quick revision table

TopicCommand or settingOne-line answer
WaitingRetry-abilityQueries retry until assertions pass or timeout
Networkcy.intercept()Spy on or stub requests, then wait on an alias
Login speedcy.session()Cache and restore session between tests
Node codecy.task()Run file, DB or library code outside the browser
FlakinessretriesSafety net after fixing the root cause
Locatorsdata-cyStable attributes that survive UI changes

How to prepare for the Cypress round

Reading answers is not enough. Spend a week building a small suite against a public demo site: login with cy.session(), one stubbed API, one fixture-driven test, a custom command, and a GitHub Actions workflow. Push it to GitHub and mention it on your resume.

Also prepare a short comparison with Playwright, because many teams are evaluating both. Our Playwright tutorial is a quick way to try it. Finally, follow a structured plan such as our 30-day QA interview preparation so Cypress is not the only area you revise. The official Cypress documentation is worth reading for any command you are unsure about.

🚀 Looking for Cypress automation jobs?

QA Jobs India shares 100+ fresh QA & software testing openings every morning — manual, automation, API and remote roles.

See today’s QA jobs →

FAQs

Is Cypress good for freshers to learn?

Yes, if you are comfortable with basic JavaScript. Cypress has a gentle setup and readable errors, so freshers can write useful tests quickly. Pair it with core testing concepts, because interviews still check fundamentals.

Which is better for jobs in India, Cypress or Selenium?

Selenium still appears in more job descriptions, especially in service companies with Java stacks. Cypress and Playwright are common in product companies and startups with JavaScript front ends. Knowing one well and the other at a basic level covers most openings.

Do Cypress interviews include JavaScript questions?

Usually, yes. Expect questions on promises, arrow functions, array methods, let vs const and modules. You cannot explain the command queue without understanding asynchronous JavaScript.

How many Cypress interview questions should I prepare?

Quality matters more than count. If you can answer the 30 questions above in your own words and show a working project, you are well prepared for most rounds at the junior and mid level.

Can Cypress be used for API testing?

Yes. cy.request() handles basic API checks and test setup. For a large API suite, teams usually prefer a dedicated tool, but Cypress works well for API calls that support UI tests.

Conclusion

Pick the five questions above you are least confident about, build a small example for each in your own repo, and practise explaining them aloud in under two minutes. When you are ready to apply, check the latest free QA jobs for openings that mention Cypress.

SIGN UP ONCE
Once you sign up, you get all this
Sign up now
  • 100+ fresh QA jobs daily + Direct HR email IDsLive every morning at 9 AM — apply straight to HR
  • Weekly Mega Job Fair800+ QA jobs from India & around the world, every week
  • Certified QA coursesUp to 17 courses, with certificate
  • AI ATS Resume BuilderFree resume points included
  • Full LinkedQA feedEvery post, fully unblurred
  • Complete QA Material libraryInterview Q&A, cheat sheets, templates & roadmaps

Instant activation right after payment · One login for jobs, courses, resume & LinkedQA

💎 Get every QA opening, every day

Join QA Jobs India Premium for 100+ verified QA jobs daily with HR contact details.

✓ You're subscribed — job alerts arrive daily at 9 AM
Scroll to Top