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.

egghead
egghead
~ a minute ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today