Top 25 Cypress Interview Questions [2021 Updated]

1. What is Cypress?

Ans. Cypress is an open-source test automation tool used for creating automated tests within your application. It works in the same area as tools like Selenium, however, cypress uses real browsers; allowing developers to create a higher quality of test (less false-negatives). Cypress takes screenshots and videos throughout the testing process, making it easier to debug errors with the test.

2. Which OS does cypress support?

Ans. Cypress supports macOS, Linux, and Windows and can be installed on the mentioned platforms. See the system requirements here.

3. What browsers does cypress support?

Ans. Cypress is initiated from the Test Runner and it supports the following browsers:

  • Chrome 80
  • Edge 79
  • Edge Dev 81
  • Edge Canary 81
  • Edge Beta 80
  • Electron 78
  • Canary 82
  • Firefox 72
  • Firefox nightly 74
  • Firefox dev edition 73
  • Chromium 78

The supported browsers are shown on the top left corner of the test runner. The browser can be changed at any time by selecting the required ones from the drop-down list.


4. What is the command used to run a browser in Cypress?

Ans. The Electron browser is pre-installed and comes default with the tool. 

To run Electron within the CLI, it can be launched headlessly. 

The below command needs to be used to run the Electron browser headed.

cypress run --headed

5. What are the advantages of Cypress?

Ans. There are many advantages of cypress but below are some of the most interesting ones.

  • Real-time reloads
  • Debuggability
  • Automatic waiting
  • OpenSource Tool
  • Fast response time
  • Active community support
  • Plugin ecosystem

6. How is Cypress different from the X testing tool?

Ans. Cypress test runner acts as an application, framework, service all packed into a single tool. It supports other testing tools available and improves their overall performance.

The other tools are: 

  • Mocha
  • Karma
  • Capybara
  • Protractor

7. What languages does Cypress support?

Ans. Cypress is easy to use if you are familiar with JavaScript and NPM package Manager for JavaScript.

8. What is automation in Cypress?

Ans. Cypress automation is the process of running a test code simultaneously with the application with the help of a user. The test not only executes in a single loop but it also happens in a single browser. A Node.js server is used for the tasks that happen outside the browser.

9. What are the other tools used along with Cypress?

Ans. Prettier is a tool that is recommended for code formatting and other tools like Xpath, Cucumber, and Docker are used while performing product testing. 

10. What is the installation command for Cypress?

Ans. The below command is used to install Cypress IO

npm install cypress

11. Does Cypress support native mobile apps?

Ans. Cypress does not support native mobile apps, but it can be tested for some functionality of mobile browsers and test apps that are used within a browser. One of such supported frameworks is Ionic.

12. What is Cypress Studio?

Ans. According to Cypress.io, Cypress Studio is used to generate tests inside of the test runner. It is obtained by recording the interactions against the application that is being tested. It is an experimental feature that can be enabled using the experimentalstudio attributes.

13. What can you do within the cypress dashboard?

Ans. you’ll be able to do the following things from the dashboard:

  • Setting up a project to record
  • add or reset record keys
  • control who all can access the project
  • provide ownership of the project to others.
  • delete project
  • see the test results whether it is passed, failed, pending, or skipped.
  • manage runs by cancelling while in progress and archive them if in cancelled or error state.
  • Manage organizations by creating, editing, and deleting them.
  • Manage user roles.
  • Integrate with applications like GitHub, Slack, etc.

14. What is component testing in cypress?

Ans. component testing in cypress is used to run tests on a particular component which is in isolation. Typically these component tests are conducted using Node.js frameworks which are used for testing like jest or mocha. The components that are to be tested are rendered in a virtual browser known as jsdom.

15. What is the use of plugins in Cypress?

Ans. Cypress plugins are used to modify, tap into, or extend the internal behavior of the cypress tool. These plugins are used to write your custom code that executes during certain stages of the lifecycle.

16. What are the 3rd party reporters built alongside Mocha?

Ans. There are two reporters that are built alongside mocha, they are:

  • Teamcity
  • Junit

17. What is the command used to install Cypress.io?

Ans. The command used to install the cypress tool is:

npm install cypress

18. Explain Cypress CLI?

Ans. Cypress is a command-line interface (CLI). It provides an access point for cypress commands in your terminal. However, it is not required to use cypress. You can run cypress tests through your browser as well by opening Cypress’ webpack monitor.

19. Why was cypress created?

Ans. A lot of the test automation out there today is limited to the capabilities of a developer. It can be difficult from cypress’ documentation to see where it fits in with other test automation tools like Selenium, for example. Cypress was created to provide an open-source, user-friendly test automation tool that takes advantage of real browsers and provides developers with everything they need to create high-quality automated tests.

20. Does Cypress Support Xpath? 

Ans. No, cypress currently does not support XPath. That being said, there are plans to implement this feature in the future. cypress can test elements using an ID or class name (or other CSS-selectors).

21. Why are cypress tests faster than other tools?

Ans. When cypress tests are being executed, Cypress does not utilize the DOM to locate elements and thus takes full advantage of a browser’s JavaScript engine. This means you get real screenshots on failure, so developers can quickly debug without cypress’ webpack monitor or cy.screenshot().

22. What is Cypress run?

Ans. Cypress run executes your cypress tests in headless browsers. It will open a new browser tab and load cypress at the URL cypress was installed from. If cypress detects cypress.json, cypress will also run cypress tests within the cypress webpack monitor and not cypress run.

23. What are custom commands in cypress?

Ans. cypress custom commands allow for users to write cypress mocha like testing framework using cypress API, and cypress will be able to execute such test script in cypress environment.

24. What are cy.commands()?

Ans. cy.command allows users to call command line executable within the context of the cypress app domain, and cypress will also be able to pass cypress variable to such command in the cypress app domain as well.

25. what are cy.task()?

Ans. cy.tasks() allows for the user to call any node script which is not in cypress API, cypress will also be able to pass cypress environment variables/objects to such cypress API test script within cypress app domain.

Recent Articles

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here

Subscribe to get IQ's , Tutorials & Courses