Search⌘ K
AI Features

Assertions

Explore how to perform detailed assertions in Cypress using the should command and Chai syntax for verifying page content. Understand how to use stubs with Sinon and simulate server responses with cy.server and cy.route. This lesson equips you to write robust end-to-end tests for Rails applications using Cypress.

We'll cover the following...

cy assertions

After we’ve done all the actions, we’re likely going to want to make some assertions about what’s on the page. Cypress assertions are complicated on one level in that there are many options, but at the same time, the syntax has some common patterns.

The should command

We can chain an assertion at the end of a series of commands with should. We need to do something between cy and should, however. We can’t simply write cy.should("exist"), but we can write ...