我最近开始使用Protractor lib测试angularjs site.I尝试使用2个以下的libs来创建HTML报告,但在这两种情况下我都收到了错误
https://www.npmjs.com/package/protractor-jasmine2-html-reporter 和 https://www.npmjs.com/package/protractor-jasmine2-screenshot-reporter
平台: - Windows 7
安装cmd: - npm install -g protractor-jasmine2-html-reporter
错误:无法找到模块' protractor-jasmine2-html-reporter'
Config.js
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
var today = new Date(),
timeStamp = today.getMonth() + 1 + '-' + today.getDate() + '-' + today.getFullYear() + '-' + today.getHours() + 'h-' + today.getMinutes() + 'm';
var reporter=new Jasmine2HtmlReporter({
consolidateAll: true,
savePath: 'target/screenshots',
takeScreenshotsOnlyOnFailures: true,
filePrefix: 'index -'+today
});
// An example configuration file.
exports.config = {
directConnect: true,
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Framework to use. Jasmine 2 is recommended.
framework: 'jasmine2',
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['../Test/SmokeTest.js'],
// Options to be passed to Jasmine.
jasmineNodeOpts: {
showColors:true,
defaultTimeoutInterval: 400000,
isVerbose: true,
includeStackTrace: true
},
onPrepare: function() {
jasmine.getEnv().addReporter(reporter);
}
};
如果我遗漏了什么,请告诉我。 提前谢谢。