I\'m using Protractor to test AngularJS
I want to check that at the end of the test no uncaught exceptions occurred and were printed to the browser console.
Is t
With a little effort we can tweak the accepted answer to work with Cucumber.js, in case you're not using Protractor with the default testing framework.
this.After(function(callback) {
browser.manage().logs().get('browser').then(function(browserLog) {
if (browserLog.length !== 0) {
var failMessage = "There was output in the browser console:" +
browserLog.map(JSON.stringify).join(";\n");
callback.fail(failMessage);
}
else {
callback();
}
});
});
You'll want to check out the documentation on After hooks, which are Cucumber's equivalent to Jasmine's afterEach
.