Cypress assertions
As we learned in the previous section, when writing our first test, assertions exist to describe the desired state of the application. Assertions in Cypress behave like guards to the tests in that they validate that the desired state and the present state are the same. Cypress assertions are unique as they are retried when Cypress commands are running until a timeout is reached or until an element is found.
Cypress assertions originate from the chai, chai-jquery and sinon-chai modules, which come bundled with the Cypress installation. Cypress also allows you to write custom assertions using the Chai plugins. However, in this section, we will focus on the default assertions that come bundled with Cypress, and not on the custom assertions that can be extended as plugins.
We can write Cypress assertions in two ways: either by explicitly defining subjects or by implicitly defining subjects. Cypress recommends implicitly defining subjects in assertions as they are...