June 2021
Intermediate to advanced
398 pages
9h 35m
English
Let’s pick up our Cypress tests. In the last chapter, we wrote a test that shows that our add favorite functionality works. Now we want to show that our remove favorite functionality also works.
We could just add more lines to the existing test to continue that scenario with a removal of favorite functionality. That’s a reasonable thing to do in some circumstances. However, longer tests like that tend to be more brittle, and a failing test gives you less information because the failure might be anywhere along the sequence of the test.
But in order to get a test to a state where we can remove a favorite, we kind of have to go through all those same steps: log in a user and add a favorite. Ideally, we’d be able to start ...