Generate reports using protractor-jasmine2-html-reporter

By Default if we generate an angular project using Angular-cli, e2e tests have support for jasmine spec reporter, but developers and QA’s need much more than that.

One of the basic reporting modules that npm provides is “protractor-jasmine2-html-reporter”.  It is easy to install and configure.


  • Run npm install protractor-jasmine2-html-reporter
  • In your protractor config.js file add following:
    var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
  •  In On Prepare section register the new reporter as
    jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
      savePath: './test-reports',
  •  We can add various options like:
  • takeScreenshots: true,  If we set it to true then screenshots will be taken
    takeScreenshotsOnlyOnFailures: true, If we set it to false Screenshots will be taken both at the test pass and test fail.
    fileNameSuffix: timeStamp,  We can add suffix text or time to test report filename.
    fileNamePrefix: ‘Abc’, We can default prefix to Test report file name
    fileNameSeparator: ‘_’, Separator for various components of test report filename
    cleanDestination: false, If we want test report folder to be cleaned set it to false

example report:

Screen Shot 2018-06-21 at 12.12.31 AM


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s