【发布时间】:2016-02-25 13:46:21
【问题描述】:
下面是包含“protractor-jasmine2-screenshot-reporter”和“jasmine-reporter”的配置文件
它单独工作正常,但如果我将量角器-jasmine2-screenshot-reporter' 都结合起来不起作用,是因为我有两个 'onPrepare' 功能
var HtmlScreenshotReporter = require('C:/Protractor_Scripts/node_modules/protractor-jasmine2-screenshot-reporter');
var reporter = new HtmlScreenshotReporter({
dest: 'C:/Protractor_Scripts/Screenshots',
filename: 'Report.html'
});
exports.config = {
directConnect: false,
multiCapabilities: [
{'browserName': 'chrome'},
{'browserName': 'firefox'}
],
allScriptsTimeout: 1200000,
framework: 'jasmine2',
specs: ['C:/Protractor_Scripts/Protractor/Driver/Driver.js'],
// Setup the report before any tests start
beforeLaunch: function() {
return new Promise(function(resolve){
reporter.beforeLaunch(resolve);
});
},
onPrepare: function() {
jasmine.getEnv().addReporter(reporter);
},
// Close the report after all tests finish
afterLaunch: function(exitCode) {
return new Promise(function(resolve){
reporter.afterLaunch(resolve.bind(this, exitCode));
});
},
Jasmine Reporter which is used to generate xml reports
onPrepare: function() {
var jasmineReporters = require('C:/Protractor_Scripts/node_modules/jasmine-reporters');
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
consolidateAll: true,
savePath: 'C:/Protractor_Scripts/Results',
filePrefix: 'xmloutput'
}));
},
// ----- Options to be passed to minijasminenode -----
jasmineNodeOpts: {
// onComplete will be called just before the driver quits.
onComplete: null,
// If true, display spec names.
isVerbose: false,
// If true, print colors to the terminal.
showColors: true,
// If true, include stack traces in failures.
includeStackTrace: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 1200000
}
};
【问题讨论】:
标签: node.js protractor