【发布时间】:2020-04-15 22:55:38
【问题描述】:
我最近开始使用 Protractor 库来测试 angularjs 站点。我尝试使用以下 2 个库来创建 HTML 报告,但在这两种情况下我都得到了错误
https://www.npmjs.com/package/protractor-jasmine2-html-reporter 和 https://www.npmjs.com/package/protractor-jasmine2-screenshot-reporter.
平台:- 视窗 7
安装命令:- 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);
}
};
如果我遗漏了什么,请告诉我。 提前致谢。
【问题讨论】:
标签: angularjs protractor jasmine2.0