Skips the current test if it depends on the previous failed test
$ npm i -D cypress-skip-this-test
# or using Yarn
$ yarn add -D cypress-skip-this-test
Import the `` in the specs with tests that depend on each other
import { skipIfPreviousTestsFailed } from 'cypress-skip-this-test'
describe('Parent suite', () => {
// second test fails on purpose
// and the third test should skip
beforeEach(skipIfPreviousTestsFailed)
it('test 1', () => {})
it('test 2', () => {
throw new Error('fail on purpose')
})
it('test 3', () => {})
})
The "test 3" will be skipped when the test "test 2" fails. If all tests in the parent suite before "test 3" pass successfully, then the test will run.
Author: Gleb Bahmutov <gleb.bahmutov@gmail.com> © 2024
- @bahmutov
- glebbahmutov.com
- blog
- videos
- presentations
- cypress.tips
- Cypress Tips & Tricks Newsletter
- my Cypress courses
License: MIT - do anything with the code, but don't blame me if it does not work.
Support: if you find any problems with this module, email / tweet / open issue on Github