toxicBurn
toxicBurn

Reputation: 127

how to pass console.log value to protractor-jasmine2-screenshot-reporter

can someone, please, advise on where to seek a solution to the following problem:

I have a code that console.logs some values, but they are not imported into protractor-jasmine2-screenshot-reporter's report.

how to pass those values into the report as they are visible in the log

I'm running protractor against angular app

my code and terminal output

my code and terminal output

my report output

enter image description here

karma.conf.js

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular/cli'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular/cli/plugins/karma')
    ],
    client:{
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    coverageIstanbulReporter: {
      reports: [ 'html', 'lcovonly' ],
      fixWebpackSourcePaths: true
    },
    angularCli: {
      environment: 'dev'
    },
    reporters: ['progress', 'kjhtml'],
    port: 9876,
    captureTimeout: 120000,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: false
  });
};

protractor.conf.js

const HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var reporter = new HtmlScreenshotReporter({
  dest: './e2e/test_results/stream',
  filename: 'test-results.html',
  reportOnlyFailedSpecs: false,
  captureOnlyFailedSpecs: true,
  showQuickLinks: true,
  reportFailedUrl: true
});...

  jasmine.getEnv().addReporter(reporter);

any other reporters can accommodate that?

Link to Github issue: https://github.com/mlison/protractor-jasmine2-screenshot-reporter/issues/123

Upvotes: 2

Views: 1110

Answers (2)

ashutosh mittal
ashutosh mittal

Reputation: 46

Look at 'Extra configuration summary items (optional)' section at https://www.npmjs.com/package/protractor-jasmine2-screenshot-reporter

Basically you need to create report at end of execution with all data you need to be added using above configuration.

Upvotes: 1

Sanja Paskova
Sanja Paskova

Reputation: 1110

Maybe you can add it in the Report Title when you define the reporter like this:

var reporter = new HtmlScreenshotReporter({
 reportTitle: "Test Report for app" + appNameUsedTrimmed
});

Upvotes: 0

Related Questions