我正在使用与Cucumber集成的Protractor编写e2e测试。 我希望能够为我的测试生成HTML报告,所以我决定使用以下插件:
https://www.npmjs.com/package/protractor-multiple-cucumber-html-reporter-plugin
我按照说明安装了它,还为我的量角器conf.js文件添加了必要的选项:
plugins: [{
package: 'protractor-multiple-cucumber-html-reporter-plugin',
options:{
automaticallyGenerateReport: true,
removeExistingJsonReportFile: true
}
}]
然而,当我运行我的测试时,我得到了这个错误:无法找到模块' protractor-multiple-cucumber-html-reporter-plugin' 我已经双重检查,我的node-modules文件夹中存在protractor-multiple-cucumber-html-reporter-plugin。 当我注释掉上面的代码时,测试没有错误。
我的量角器版本是5.3.2,量角器 - 黄瓜 - 框架版本:5.0.0和量角器 - 多个 - 黄瓜 - html-报告 - 插件版本是1.7.0
编辑: 这是我的完整配置文件:
exports.config = {
directConnect: true,
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
}
},
specs: [
'features/**/home.feature'
],
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
require: ['specs/test_spec.js'],
format: 'json:results.json',
},
onPrepare: function() {
browser.ignoreSynchronisation = true;
browser.manage().timeouts().implicitlyWait(30000);
browser.manage().window().maximize();
},
params: {
username: 'Admin',
password: 'Password',
},
plugins: [{
package: 'protractor-multiple-cucumber-html-reporter-plugin',
options:{
automaticallyGenerateReport: true,
removeExistingJsonReportFile: true,
}
}],
getPageTimeout: 30000,
}
答案 0 :(得分:0)
我有同样的问题。您必须在插件部分初始化package.json或将其更改为配置:
package: require.resolve('protractor-multiple-cucumber-html-reporter-plugin');