Unable to generate report using html screen shot in protractor

jeevan s

I'm trying to generate reports using html screen shot in protractor, have followed all the steps, but am getting an error. Please help.

My conf.js

// An example configuration file.
var HtmlReporter = require('protractor-html-screenshot-reporter');
var reporter=new HtmlReporter({
    baseDirectory: './protractor-result', // a location to store screen shots.
    docTitle: 'Protractor Demo Reporter',
    docName:    'protractor-demo-tests-report.html'
});
exports.config = {
  directConnect: true,

  // Capabilities to be passed to the webdriver instance.
  capabilities: {
    'browserName': 'chrome'
  },

  // Spec patterns are relative to the current working directly when
  // protractor is called.
  specs: ['example_spec.js'],

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

  onPrepare: function() {
        jasmine.getEnv().addReporter(reporter),
    };
};

Error I'm getting: Unexpected Error.

SyntaxError: Unexpected identifier
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at ConfigParser.addFileConfig (C:\Users\jeevan.s\AppData\Roaming\npm\node_modules\protractor\lib\configParser.js:183:20)
    at Object.init (C:\Users\jeevan.s\AppData\Roaming\npm\node_modules\protractor\lib\launcher.js:35:18)
    at Object.<anonymous> (C:\Users\jeevan.s\AppData\Roaming\npm\node_modules\protractor\lib\cli.js:129:23)
    at Module._compile (module.js:456:26)
alecxe

You have syntax errors:

  • missing , before the onPrepare():
  • replace , with ; after the addReporter() call
  • remove the ; after onPrepare()

Fixed version:

// An example configuration file.
var HtmlReporter = require('protractor-html-screenshot-reporter');
var reporter=new HtmlReporter({
    baseDirectory: './protractor-result', // a location to store screen shots.
    docTitle: 'Protractor Demo Reporter',
    docName:    'protractor-demo-tests-report.html'
});
exports.config = {
    directConnect: true,

    // Capabilities to be passed to the webdriver instance.
    capabilities: {
        'browserName': 'chrome'
    },

    // Spec patterns are relative to the current working directly when
    // protractor is called.
    specs: ['example_spec.js'],

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

    onPrepare: function() {
        jasmine.getEnv().addReporter(reporter);
    }
};

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Unable to attach screen shot to cucumber JVM report

Error while using "Protractor jasmine 2 screen shot reporter"

unable to generate HTML report using Webpack-bundle-analyser

Unable to generate allure report using testng and maven

Cucumber HTML report with Protractor

Cannot generate HTML coverage report using Reportgenerator

Generate a HTML table report using AWK

Generate HTML report in jmeter

Unable to generate table HTML using JSON?

Unable to generate a report with SAP Crystal report

Unable to generate the extent-report

Generate a report using DFSORT

generate html report from .plist using xcodebuild and xcpretty command

Take screen shot of url with PHP using specific website width?

how to save a cropped uiview screen shot using a extension market

How to design the below ui as shown screen shot below using flutter

Generate html report with ScalaTest 3.0

Generate html coverage report in Adonis

lubuntu 18.10 screen shot

Android screen shot

Using Bazel to generate coverage report

Unable to generate extent report in cucumber. I am using cucumber version 4

Unable to generate Extent Report in Selenium Java

I want to run report(.html file) of protractor-html-reportor

Unable to fail the test by timeout using the mocha with protractor

Unable to run specific spec file using protractor

Unable to select value from autocomplete using protractor

How to generate an html report using pylint 1.8.2 to publish in gitlab-ci pages?

How to generate html report for issues reported using sonarqube-5.4 and maven?