Node.js 找不到量角器结果文件夹';量角器html屏幕截图报告器';
我正试图在量角器中生成报告,我按照教程来做 这是我的Node.js 找不到量角器结果文件夹';量角器html屏幕截图报告器';,node.js,npm,protractor,Node.js,Npm,Protractor,我正试图在量角器中生成报告,我按照教程来做 这是我的conf.js文件 var HtmlReporter = require('protractor-html-screenshot-reporter'); var reporter = new HtmlReporter({ baseDirectory: 'D:/My Work/Protractor/Financial/protractor-result', // a location to store screen shots.
conf.js
文件
var HtmlReporter = require('protractor-html-screenshot-reporter');
var reporter = new HtmlReporter({
baseDirectory: 'D:/My Work/Protractor/Financial/protractor-result', // a location to store screen shots.
docTitle: 'Protractor Demo Reporter',
docName: 'protractor-demo-tests-report.html'
});
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['invoice.js'],
capabilities: {
browserName: 'chrome',
},
jasmineNodeOpts: {
showColors: true, // Use colors in the command line report.
},
onPrepare: function() {
jasmine.getEnv().addReporter(reporter);
}
}
我试着使用命令dragrator conf.js
运行这个程序,但没有生成包含测试结果的文件夹。如果我使用命令,量角器specs\configurations.js
将发生以下错误
ERROR - failed loading configuration file specs/conf.js
C:\Users\Manuli\AppData\Roaming\npm\node_modules\protractor\lib\configParser.js:
204
throw e;
^
Error: Cannot find module 'D:\My Work\Protractor\Financial\specs\conf.js'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at ConfigParser.addFileConfig (C:\Users\Manuli\AppData\Roaming\npm\node_modu
les\protractor\lib\configParser.js:195:22)
at Object.init (C:\Users\Manuli\AppData\Roaming\npm\node_modules\protractor\
lib\launcher.js:103:18)
at Object.<anonymous> (C:\Users\Manuli\AppData\Roaming\npm\node_modules\prot
ractor\lib\cli.js:140:23)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
错误-加载配置文件specs/conf.js失败
C:\Users\Manuli\AppData\Roaming\npm\node\u modules\dragrator\lib\configParser.js:
204
投掷e;
^
错误:找不到模块“D:\My Work\dragrator\Financial\specs\conf.js”
在Function.Module.\u解析文件名(Module.js:339:15)
在Function.Module.\u加载(Module.js:290:25)
at Module.require(Module.js:367:17)
根据需要(内部/module.js:16:19)
在ConfigParser.addFileConfig(C:\Users\Manuli\AppData\Roaming\npm\node\u modu
les\dragrator\lib\configParser.js:195:22)
在Object.init(C:\Users\Manuli\AppData\Roaming\npm\node\u modules\dragrator\
lib\launcher.js:103:18)
反对。(C:\Users\Manuli\AppData\Roaming\npm\node\u模块\prot
ractor\lib\cli.js:140:23)
在模块处编译(Module.js:413:34)
在Object.Module._extensions..js(Module.js:422:10)
在Module.load(Module.js:357:32)
为什么我不能生成报告
提前感谢。:) 我将我的conf.js更改为这样
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var reporter = new HtmlScreenshotReporter({
dest: 'D:/My Work/Protractor/Financial/screenshots',
filename: 'my-report.html'
});
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['invoice.js'],
capabilities: {
browserName: 'chrome',
},
// Setup the report before any tests start
beforeLaunch: function() {
return new Promise(function(resolve){
reporter.beforeLaunch(resolve);
});
},
// Assign the test reporter to each running instance
onPrepare: function() {
jasmine.getEnv().addReporter(reporter);
},
// Close the report after all tests finish
afterLaunch: function(exitCode) {
return new Promise(function(resolve){
reporter.afterLaunch(resolve.bind(this, exitCode));
});
}
}
然后我使用npm安装量角器-jasmine2-screenshot-reporter--save dev
命令来安装npm
正在工作。:) 我将我的conf.js更改为这样
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var reporter = new HtmlScreenshotReporter({
dest: 'D:/My Work/Protractor/Financial/screenshots',
filename: 'my-report.html'
});
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['invoice.js'],
capabilities: {
browserName: 'chrome',
},
// Setup the report before any tests start
beforeLaunch: function() {
return new Promise(function(resolve){
reporter.beforeLaunch(resolve);
});
},
// Assign the test reporter to each running instance
onPrepare: function() {
jasmine.getEnv().addReporter(reporter);
},
// Close the report after all tests finish
afterLaunch: function(exitCode) {
return new Promise(function(resolve){
reporter.afterLaunch(resolve.bind(this, exitCode));
});
}
}
然后我使用npm安装量角器-jasmine2-screenshot-reporter--save dev
命令来安装npm
正在工作。:) 你在哪里使用《茉莉花记者》?您使用的是
量角器html屏幕截图报告器
,它适用于过时的jasmine 1.x版本。您为什么不尝试更新您的资料,并使用与jasmine2
兼容的其他reporter。对不起。我更新了问题标题。你能推荐一款与茉莉花兼容的波特吗?:)这里有一个-谢谢,我来试试。你在哪里使用《茉莉花记者》?您使用的是量角器html屏幕截图报告器
,它适用于过时的jasmine 1.x版本。您为什么不尝试更新您的资料,并使用与jasmine2
兼容的其他reporter。对不起。我更新了问题标题。你能推荐一款与茉莉花兼容的波特吗?:)这里有一个-谢谢,我试试这个。