Protractor best html report…

We have seen how to create reports in our previous article, but that report used to break when we have testcase names with special character or long names.

So i came across a better report and lets see how to implement it.

Note: Drawback of this report is that you cannot send it as attachment as it is dependent on many files. It won’t work as standalone,

So you can use both this report and the old report together and use this one for debugging and the other one as a summary to send along with emails.

Install protractor-beautiful-reporter

 npm install protractor-beautiful-reporter --save-dev 

Add below code to OnPrepare of config file:

onPrepare: function(){
let HtmlReporter = require('protractor-beautiful-reporter');
             jasmine.getEnv().addReporter(new HtmlReporter({
                baseDirectory: 'reports_new',
                screenshotsSubfolder: 'screenshotsOnFailure',
                takeScreenShotsOnlyForFailedSpecs: true,
                jsonsSubfolder: 'jsonFiles',
                excludeSkippedSpecs: true,
                preserveDirectory: false,
                clientDefaults:{
                showTotalDurationIn: "header",
                totalDurationFormat: "h:m:s",
                gatherBrowserLogs: true
              },
             }).getJasmine2Reporter());

}

Report: