Cypress Interview Questions (2–3 yrs)

1. What is Cypress? How is it different from Selenium?
2. Can you explain Cypress architecture?
3. What are Cypress commands? Why are they asynchronous?
4. How does Cypress handle waiting for elements?
5. What are fixtures in Cypress? How do you use them?
6. Explain the purpose of the cypress.json configuration file.
7. How do you write a test to check if a button is disabled?
8. How do you handle API calls in Cypress tests?
9. What is the use of cy.intercept()? Explain with an example.
10. What is the difference between cy.get() and cy.contains()?
11. Explain what custom commands are in Cypress and how to create them.
12. How can you handle iframes in Cypress?
13. What is the purpose of before(), beforeEach(), after(), and afterEach() hooks?
14. How do you handle file upload in Cypress?
15. What are Cypress plugins? Can you name a few commonly used ones?
16. Explain how you would integrate Cypress tests with CI/CD tools like Jenkins or GitLab.
17. How to run Cypress tests headlessly?
18. Can you run Cypress tests on multiple browsers? Which ones?
19. What is the difference between .should() and .then() in Cypress?
20. Explain test retries in Cypress and how to configure them.
21. How do you capture screenshots or videos of your tests?
22. What are the limitations of Cypress?
23. What is the role of cy.request() and how is it different from cy.visit()?
24. How do you organize test files and structure a real project?
25. Share a challenge you faced while writing Cypress tests and how you resolved it.


Focus: Cypress fundamentals, setup, and basic usage

  1. What is Cypress, and how is it different from Selenium?
  2. How do you install Cypress in a project?
  3. What type of testing is Cypress primarily used for?
  4. Where does Cypress run: browser or Node.js?
  5. What are some key features of Cypress?
  6. How do you open the Cypress Test Runner?
  7. What is the folder structure Cypress creates when you first install it?
  8. How do you write a simple test in Cypress to check if a button is visible?
  9. What command do you use to visit a webpage in Cypress?
  10. How do you use cy.get() in Cypress?
  11. How does Cypress handle waits and timeouts?
  12. What is the difference between cy.get() and cy.find()?
  13. How do you run all your tests in headless mode using Cypress?
  14. What is the purpose of cypress.json (or cypress.config.js in v10+)?
  15. How do you take a screenshot in Cypress?

Focus: Test organization, Cypress commands, assertions, and practical use

  1. How do you organize your test cases and test suites in Cypress?
  2. What is a custom command in Cypress, and how do you define one?
  3. How would you assert that an element contains specific text in Cypress?
  4. Explain the use of aliases and .as() in Cypress.
  5. What is beforeEach() used for in Cypress tests?
  6. How do you test a form submission using Cypress?
  7. How can you simulate a file upload in Cypress?
  8. How do you handle iframes in Cypress tests?
  9. How does Cypress deal with browser pop-ups or alerts?
  10. What are fixtures in Cypress, and how do you use them?
  11. How do you use the cy.intercept() method to stub network requests?
  12. What is the difference between cy.intercept() and the deprecated cy.route()?
  13. How would you validate an API response using Cypress?
  14. How can you retry an assertion in Cypress?
  15. How do you handle dynamic elements in Cypress tests?
  16. How can you test a SPA (Single Page Application) with Cypress?
  17. How do you ensure your tests are isolated and repeatable?
  18. What is the command for running a specific spec file in Cypress?
  19. How do you use environment variables in Cypress?
  20. What’s the difference between should() and then() in Cypress?

Focus: Debugging, CI/CD integration, architecture, and best practices

  1. Explain how Cypress architecture works under the hood.
  2. How do you debug failed Cypress tests effectively?
  3. Can Cypress handle multi-tab testing? Why or why not?
  4. How do you implement page object model (POM) in Cypress?
  5. Describe how to handle test data setup and teardown in Cypress.
  6. How would you integrate Cypress with a CI/CD pipeline (e.g., GitHub Actions, Jenkins, GitLab)?
  7. How do you deal with flaky Cypress tests?
  8. What strategies do you use to reduce test execution time in Cypress?
  9. How can you generate HTML or video reports after Cypress test runs?
  10. Can Cypress be used for API testing? Give an example.
  11. What are Cypress plugins? Mention any 2 useful ones.
  12. How do you handle authentication in Cypress for protected routes?
  13. How can you make your Cypress tests more maintainable in a growing project?
  14. How do you implement custom Cypress commands that include assertions?
  15. What are the limitations of Cypress, and how do you work around them?