1×
Become a member
to unlock all features
Autoplay

    Reduce Code Duplication in Cypress Tests with beforeEach

    cypressCypress
    ^1.4.1

    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.