Tomasz Łakomy: We have two Cypress tests at the moment, and in both of those tests, we are visiting the home page.
We have a bit of duplicated code. That is not terrible now, but imagine that in the future, we wanted to set some cookies or do something else entirely before each and every single test. We ideally want to abstract it away in a single function.
Luckily, Cypress allows us to use a beforeEach function, which is going to be done before each and every single test in our suit.
We can remove these two lines, and just place this command over here. After I save that, our tests are going to start automatically, and we can see that they are still passing. Now, our code is a little bit cleaner, because we are not repeating ourselves.