0

为我的 Protractor 项目设置 Jasmine2HtmlReporter。

将下一个代码添加到我的 conf.js 文件中:

    onPrepare: function() {
      jasmine.getEnv().addReporter(
        new Jasmine2HtmlReporter({
          savePath: 'target/screenshots'
        })
      );
   }

并得到下一个错误:

onPrepare: function() {
  ^^^^^^^^^

SyntaxError: Unexpected identifier

在我的整个 conf.js 文件下面:

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

exports.config = {

  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 100000
  },
  capabilities: {
    'browserName': 'chrome'
  },
  directConnect: true,
  framework: 'jasmine',
  specs: ['specs/calbarSpec.js']

  onPrepare: function() {
      jasmine.getEnv().addReporter(
        new Jasmine2HtmlReporter({
          savePath: 'target/screenshots'
        })
      );
   }

};
4

1 回答 1

1
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = {
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 100000
  },
  capabilities: {
    'browserName': 'chrome'
  },
  directConnect: true,
  framework: 'jasmine',
  specs: ['specs/calbarSpec.js'],

  onPrepare: function() {
      jasmine.getEnv().addReporter(
        new Jasmine2HtmlReporter({
          savePath: 'target/screenshots'
        })
      );
   }

};

在“规格”键后加一个逗号。

于 2019-05-12T00:56:31.720 回答