How can I view console.log output in an angularjs protractor jasmine test? As of now, the browser closes by itself too quickly.
more info - I am working with the angularjs tutorial, step 8. I am trying to change the e2e test to protractor. The protractor config file I'm using is based on %appdata%\npm\node_modules\protractor\referenceConf.js. In spec js files referenced by the config file, I have instances of console.log. However, during execution of the protractor e2e test, the web site opens in chrome, I see things happen in the browser, then the browser closes before I can examine any console.log output. I think I need to keep chrome open somehow. How?
Use browser.manage().logs().get('browser')
browser.manage().logs().get('browser').then(function(browserLogs) {
// browserLogs is an array of objects with level and message fields
browserLogs.forEach(function(log){
if (log.level.value > 900) { // it's an error log
console.log('Browser console error!');
console.log(log.message);
}
});
});