How to stop the test running if one of the 'it' sections fails?

1.3k views Asked by At

My test suite contains several 'it' sections within the 'describe'.

If one of the 'it' sections fails (e.g. if it can't find an element) - it jumps straight to the next 'it' section and carries on the test.

If an 'it' section fails I just want the test to stop running and be marked as a fail.

How do you do this?

1

There are 1 answers

1
Matt On

The solution to this was to use the bail flag within the mochaOpts section of wdio.conf as shown here:

mochaOpts: {
    bail: true
},

Thanks to @leun4m for this answer