I using Nightwatch, Mocha and Should.js for testing. And in some cases I do check for text value of elements. My question is - How to make test status - "fail", when text value is not equals to expected value?
it("Test should return 'fail' status", function(client) {
client
.url(urlAddress)
.waitForElementPresent("h1", config.middleTimer)
.getText("h1", function(result) {
result.value.should.be.exactly("Expected text!!!");
})
.end()
});
I found solution:
This construction will change test status to "fail"! "This" equals to mocha runner.