Cypress: run only one test

前端 未结 6 1216
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-31 07:04

I want to toggle only running one test, so I don\'t have to wait for my other tests to see the result of one test.

Currently, I comment out my other tests, but this is r

6条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 07:31

    There is one way I have found to skip tests which I don't need to run (in the current test), and that is to use: this.skip();

    it('test page', function () {
        // skip this test for now
        this.skip();
        cy.visit('http://example.com/')
        cy.contains('test page').click()
        cy.url()
            .should('include', '/test-page/')
    })
    

    1. it is important to use regular function as second argument of it, this will not be available in arrow function
    2. Whole of the test will be skipped no matter where we write this.skip()

提交回复
热议问题