Cypress- Chapter 3 -TipsNTricks

Some points to be noted 
1)Cypress relies on many best-of-breed open source testing libraries to lend stability:
   a)Cypress has adopted Mocha’s bdd syntax, which fits perfectly with both integration and unit testing.
   b)Chai gives us the ability to easily write assertions. Chai gives us readable assertions with excellent error messages.
   c)When writing integration tests, you will likely work a lot with the DOM. Cypress brings in Chai-jQuery, which automatically extends Chai with specific jQuery chainer methods.
   d)When writing unit tests, or even in integration-like tests, you often need to ability to stub and spy methods. Cypress includes two methods, cy.stub() and cy.spy() that return Sinon stubs and spies, respectively.
   e)When working with stubs or spies you’ll regularly want to use those when writing Chai assertions. Cypress bundles in Sinon-Chai which extends Chai allowing you to write assertions about stubs and spies.

2)Cypress automatically travels back in time to a snapshot of when that command resolved. Additionally, since cy.contains() finds DOM elements on the page, Cypress also highlights the element and scrolls it into view (to the top of the page).

3)Page events:
Cypress logs out page events for:
  • Network XHR Requests
  • URL hash changes
  • Page Loads
  • Form Submissions
4)Dev tools: Additional debugging information to available in the dev tools console.
5)pause and debug 

Comments

Popular Posts