Skip to main content

Cypress Skip Test

There are multiple ways to skip a test case or suite in Cypress. You can use plugins, write your custom logic, or use the Cypress skip function. In this article, we will discuss how to skip it and describe using the skip function. 

Skip Cypress Test

In below code test 1 and test 3 will execute and test 2 will be skipped because we have added .skip.

describe('suite 1', () => {
    it('suite 1 - test 1', () => {
        // test 1
    })

    it.skip('suite 1 - test 2', () => {
        //test 2
    })

    it('suite 1 - test 3', () => {
        //test 3
    })
})

Output

cypress skip test programmatically

Observe the tick mark for executed test scenarios, and skipped one has different color and icon.

Cypress Describe Skip

describe.skip('suite 1', () => {
    it('suite 1 - test 1', () => {
        // test 1
    })

    it.skip('suite 1 - test 2', () => {
        //test 2
    })

    it('suite 1 - test 3', () => {
        //test 3
    })
})

describe('suite 2', () => {
    it('suite 2 - test 1', () => {
        // test 1
    })

    it.skip('suite 2 - test 2', () => {
        //test 2
    })
})

In above code suite 1 will be skipped. In suite 2 only test 1 will be executed.

Output

cypress describe.skip

Video Tutorial: Skip Cypress Test

Tags
Submitted by arilio666 on February 12, 2021

Ashwin is working with iVagus as a Technical Lead. He has experience in various technologies like Cypress, JavaScript, TypeScript, Rest Assured, Selenium, Cucumber, and Java.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.