Reduce Code Duplication in Cypress Tests with beforeEach
lessonDuration 1m 27s
A lot of our tests will share setup steps. Since Cypress is using Mocha under the hood, we can take advantage of existing features such as the ability to define a `beforeEach` block that runs before each of our tests. In this lesson we’ll refactor two tests that contain duplicate commands by moving that duplication into the `beforeEach` for our `describe` block.