我正在使用量角器对 Angular 网站进行端到端测试,但想将结果导出到 Jenkins 可以读取的文件(JUnitXmlReporter)中,因此为了使其工作,我需要对我的量角器配置文件进行“简单更改” “onPrepare”:
exports.config = {
// Do not start a Selenium Standalone sever - only run this using chrome.
framework: 'jasmine',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
specs: [
'./test1.js',
'./test2.js'
],
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
isVerbose: true
},
onPrepare: function() {
var jasmineReporters = require('jasmine-node-reporter-fix');
jasmine.getEnv().addReporter(
new jasmineReporters.JUnitXmlReporter('protractor_output', true, true, 'testresults.e2e.');
}
};
但是一旦我添加了这个“onPrepare”代码,所有的测试都会运行而无需等待浏览器呈现 html。如果我删除“onPrepare”代码,所有测试都将按预期开始工作,但不会为 jenkins 生成文件。
有什么想法有什么问题吗?