Custom Jasmine reporter in Protractor tests

久未见 提交于 2019-11-30 17:19:48

I am building a jasmine reporter that does exactly what you want, jasmine-spec-reporter.

fer

Add the isVerbose flag to the protractor config, it's false by default:

exports.config = {
  . . .

  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    isVerbose: true
  }
};
Automation Tester

Add this dependency to your project:
npm install jasmine-spec-reporter --save-dev

And add this to your config file:

onPrepare: function(){
    var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
    jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
}

To extend @fer's answer:

You can add these settings to jasmineNodeOpts to both see the current test and get stack trace right when test fails:

  jasmineNodeOpts: {
    showColors: true,
    isVerbose: true,
    realtimeFailure: true,
    includeStackTrace: true,
    defaultTimeoutInterval: 30000
  },
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!