Writing your first test
Cypress tests are no different than any other tests. As in all other tests, Cypress tests should pass when the expected result is consistent with what the application under test expects; it should fail when the expected result is not consistent with what the application should do. In this section, we will explore different types of tests, the structure of a test, and how Cypress understands the changes in a test file and reruns the tests. This section will also cover how to write practical tests.
Example test
In this section, we will look at the basic structure of a Cypress test. This remains standard in most of the tests that we will write during the course of this chapter. The following test checks that what we expect and what is returned are equal to true
. It should pass when we run it:
describe('Our Sample Test', () => { it('returns true', () => { expect(true).to.equal(true); &...