Jasmine HTML2 Reporter

时间:2018-01-05 10:58:21

标签: jasmine protractor

我一直在使用Jasmine2-HTML-Reporter,它很好。使用屏幕截图生成多规格报告 - 就像我需要的那样。

然而,似乎出现了一些错误!现在我只会得到第一个规格的报告而没有任何其他规格的报告。此外,该系统用于删除以前的报告/屏幕截图,但现在必须手动完成。

我真的无法想到包装的其他部分会发生什么变化导致这种情况发生!!

这里是conf.js文件中的条目......每个conf文件都相同。我试过添加各种开关 - 完全没有效果!

由于

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

exports.config = {
//seleniumAddress: 'http://localhost:444/wd/hub',
params: require ('Models/Baths.js'), 
directConnect: true,

capabilities: {
  cssSelectorsEnabled: true,
  'browserName': 'chrome',


   specs:['Specs/001-First.js',
        'Specs/003-Exp.js'
],


allScriptsTimeout: 120000,
getPageTimetout: 30000,

framework: 'jasmine2',
showColors: true,
isVerbose: true,


onPrepare: function() {

Jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
 takeScreenshots: true,
savePath: './Reports',
  fileName: 'B&Q'
})
  );

  var SpecReporter = require ( 'jasmine-spec-reporter').SpecReporter;
  jasmine.getEnv().addReporter( new SpecReporter( {
  displayStacktrace:      true,
  displayFailureSummary:  true,
  displayPendingSummary:  true,
  displaySuccessfulSpec:  true,
  displayFailedSpec:      true,
  displaySpecDuration:    true,
  displaySuiteNumber:     false,
  colors: {
success: 'green',
failure: 'red',
pending: 'yellow'
 },
   customProcessors: []

} ));

  }
}
};

1 个答案:

答案 0 :(得分:0)

尝试下面的conf文件,它应该适合你。

var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
var log4js = require('log4js');
var params = process.argv;
var args = process.argv.slice(3);

exports.config = {
  //seleniumServerJar: './node_modules/gulp-protractor/node_modules/protractor/selenium/selenium-server-standalone-2.48.2.jar',
  seleniumAddress: 'http://localhost:4444/wd/hub',
  allScriptsTimeout: 100000,
  framework: 'jasmine2',

  onPrepare: function () {

    browser.manage().timeouts().implicitlyWait(11000);
    var width = 768;
    var height = 1366;
    browser.driver.manage().window().setSize(768, 1366);
    browser.ignoreSynchronization = false;

    jasmine.getEnv().addReporter(
      new Jasmine2HtmlReporter({
        savePath: __dirname+'/qualityreports/testresults/e2e',
        takeScreenshots: false,
        filePrefix: 'automationReport',
        consolidate: true,
        cleanDestination: false,
        consolidateAll: true

      })
    );
  },

  suites:{

    example:['./test/e2e/specs/**/*Spec.js',]
  },


  capabilities: {
    'browserName': 'chrome'
  },


  resultJsonOutputFile:'./results.json',

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