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

Fri, 02/12/2021 - 23:18
Ashwin possesses over five years of experience in the Quality Assurance industry and is currently serving as a Technical Lead at iVagus. His expertise encompasses a broad range of technologies, including Cypress, Rest Assured, Selenium, Cucumber, JavaScript and TypeScript.

Video Tutorial: Skip Cypress Test

Tags

Comments