I am trying to have a test in Webdriver.io stop when the first it() block fails its assertion. Is it possible to either nest it() blocks or conditionally execute them?
For your first question "I am trying to have a test in Webdriver.io stop when the first it() block fails its assertion", here is the answer:-
You can use mocha 'bail' option as described here Mocha Bail
Command line usage :-
--bail, -b Abort ("bail") after first test failure [boolean]
And, In any configuration file like this
"bail" : true
Any "boolean" flag (which doesn't require a parameter, such as --bail), can be specified using a boolean value, e.g.: "bail": true.
For your second question on conditional execution of it statements, please see the below code
describe("Some module", function() {
if(false) {
it ("should NOT run this test case", function() { });
}
it("should run this test case", function() { }); });
Please let me know if you need more help with this.