Cypress Interview Questions

Displaying 1 - 10 of 51

What are the drawbacks of the Cypress testing tool.

  • Support only JavaScript
  • Complex
  • No MultiTab Support
  • No Multiple Browser
  • Difficult to communicate with backend
  • Mouse Hover Issues
  • No Tab Key Support
  • No Direct XPath support
  • No Mobile Support
  • File Upload using Plugin
  • Drag and Drop typical to implement without plugin
  • No Iframe Support
  • Less no. of browser support
  • Only Mocha JS Testing Framework supported
  • Typical Parallel Testing
  • No Page Object Model
  • Not for indexing web
  • Not for performance testing

How to perform API testing in Cypress?

We can use request command to make an HTTP request and pass in multiple attributes to it. For Example:

  method: 'POST', 
  url: '/api/boards', 
  body: {
    name: 'space travel plan'

How many types of assertions are available in Cypress?

Cypress use following assertions:

  1. Chai BDD Assertions: not, include, equal etc.
  2. Chai TDD Assertions: .isOK(), .isTrue() etc
  3. Chai JQuery Assertions: visible, hidden, selected etc.
  4. Sinon-Chai Assertions: called, callCount etc.

Also we can write our own assertions using chai assertions. 

How is the test data maintained in Cypress?

we can use Cypress Fixture command to Load a fixed set of data located in a file. Cypress provides a directory named as fixtures, which stores various "JSON" files, and these JSON files can store the test data which can be read by multiple tests. We store test data in the form of key-values, which we can access in the test scripts.

What are hooks in Cypress?

Cypress Hooks which help in performing a particular set of actions just before/after each test case or before/after all the test cases in the test suite. 

  • Before() Hook
  • After() Hook
  • BeforeEach() Hook
  • AfterEach() Hook

Can we use BDD with Cypress?

Cypress has adopted Mocha's bdd syntax, which fits perfectly with both integration and unit testing.  Also, you can integrate Cypress with Cucumber using Plugin.