Use cy.skip in order to skip a test in a cypress suite

Tomasz Łakomy
InstructorTomasz Łakomy
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 4 years ago

Some of our tests in a cypress suite can cause problems or have performance issues that we need to take care of.

Sometimes it's even necessary to skip one of the tests because our CI/CD pipeline is failing because of a randomly failing test - at this time we should spend time to improve that test as soon as we can.

Of course we could comment the test out or remove it from the codebase entirely, but a better solution is to use .skip in order to (temporarily) skip a cypress test - and that's exactly what we're going to learn in this quick lesson.

Tomasz Łakomy: [0:00] We have a couple of tests in our Cypress Suite. If I restart all of them, we're going to see that one of them is a very long test, because basically, it's going to wait for 10 seconds and do nothing at all. Obviously, we need to improve it for a bit.

[0:11] Suppose we wanted to push all those changes to our Git repository. One way we could solve that is basically to comment out the test, but this is not perfect. Instead, we can do it.skip, which is going to run all those tests without this one, because it's going to skip it.

[0:26] Of course, we shouldn't skip every single test that we have problems with. Nevertheless, if you want all those other tests to start being as value, sometimes it is worthwhile to skip one of those tests, and fix that as soon as we can.