shailjain
shailjain

Reputation: 13

Unable to produce HTML reports in protractor 3.3.0 with protractor-html-screenshot-reporter

i am new to protractor testing.

i was using protractor with protractor-html-screenshot-reporter and i used to generate html reports.

jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: '/protractor-result', // a location to store screen shots.
docTitle: 'Protractor Demo Reporter',
docName:    'protractor-demo-tests-report.html'

but when i upgraded my protractor version to 3.3.0, i am unable to produce these reports anymore by using protractor-html-screenshot-reporter module.

i may be missing some or the other configurations or is it not compatible with the protractor 3.3.0 version

any response would be highly appreciated.

Upvotes: 1

Views: 832

Answers (1)

Ram Pasala
Ram Pasala

Reputation: 5231

protractor-html-screenshot-reporter is not compatible with jasmine 2. Latest versions of protractor come with Jasmine2 by default.You can use - protractor-jasmine2-html-reporter

for Json report you need to add resultJsonOutputFile in your config file.

  resultJsonOutputFile: 'Path to your Report.json'

Code Snippet of conf.js

var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');  

exports.config = {
directConnect: true, //seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
    'browserName': 'chrome'
},
baseUrl: 'http://juliemr.github.io/protractor-demo/',
framework: 'jasmine2',
specs: ['*spec.js '],
allScriptsTimeout: 180000,
getPageTimeout: 180000,
jasmineNodeOpts: {
    defaultTimeoutInterval: 180000
},
resultJsonOutputFile: './Report.json', // here you need to put the json option
onPrepare: function () {
    var width = 1300;
    var height = 1200;
    browser.driver.manage().window().setSize(width, height);
    browser.ignoreSynchronization = true;
    jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
            savePath: './test/reports/'
        }));
  }
 };

NOTE: First install protractor-jasmine2-html-reporter package by running '_npm install protractor-jasmine2-html-reporter' from command prompt. Otherwise it will give error 'protractor-jasmine2-html-reporter' Not found

Upvotes: 1

Related Questions