我在配置文件中尝试了这个*
var reporter = new HtmlScreenshotReporter({
dest: 'target/screenshots',
filename: 'my-report.html'
});
exports.config = {
directConnect: true,
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Framework to use. Jasmine is recommended.
framework: 'jasmine',
// Spec patterns are relative to the current working directory when
// protractor is called.
specs: ['Enter-description-in-resources-spec.js'],
// Options to be passed to Jasmine.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 1100000
}
onPrepare: function() {
jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: '/tmp/screenshots'
}));
}
};
但我收到了错误,我无法理解
throw new exitCodes_1.ConfigError(logger, 'failed loading configuration file ' + filename);
答案 0 :(得分:0)
您在 JasmineNodeOpts 后缺少逗号,请更正并在onPrepare函数中传递您的记者:
var reporter = new HtmlScreenshotReporter({
dest: 'target/screenshots',
filename: 'my-report.html'
});
exports.config = {
directConnect: true,
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Framework to use. Jasmine is recommended.
framework: 'jasmine',
// Spec patterns are relative to the current working directory when
// protractor is called.
specs: ['Enter-description-in-resources-spec.js'],
// Options to be passed to Jasmine.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 1100000
},
onPrepare: function() {
jasmine.getEnv().addReporter(reporter); // Pass the reporter here which you have defined earlier.
}
};