1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Add a beforeEach function to cypress tests to avoid copying and pasting needless code

    cypressCypress

    DRY (Don't Repeat Yourself) is (in most cases) a good idea when it comes to programming.

    E2E tests are no different - if we have actions that we want to perform before every cypress test, it would be great to define them in a single spot.

    In this lesson we're going to learn how to use beforeEach command in order to visit the app homepage before every test in a suite.