【发布时间】:2016-06-30 17:55:32
【问题描述】:
量角器测试运行良好,直到我弄乱了我的 config.js 文件以包含屏幕截图测试。
运行 protractor conf.js
时出错C:\Users\hhhhhh\mmmm\tests\e2e>量角器conf.js
[10:50:13] E/configParser - 错误代码:105
[10:50:13] E/configParser - 描述:加载配置文件 conf.js 失败
C:\Users\hhhhhh\AppData\Roaming\npm\node_modules\protractor\built\configParser.js:130 throw new exitCodes_1.ConfigError(logger, '加载配置文件失败' + 文件名);`
package.json
{
"name": "e2e",
"version": "1.0.0",
"description": "yup yup yup",
"main": "conf.js",
"dependencies": {
"protractor-jasmine2-screenshot-reporter": "^0.3.1",
"protractor": "3.3.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
conf.js
var ScreenShotReporter = require('protractor-screenshot-reporter');
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
framework: 'jasmine2',
specs: ['specs/*spec.js'],
onPrepare: function() {
jasmine.getEnv().addReporter(new ScreenShotReporter({
baseDirectory: 'target/screenshots'
}));
}
};
许多人似乎对此有疑问。有人找到了合理的解决方案吗?
【问题讨论】:
-
你能粘贴你的配置文件吗?
-
@igniteram1
conf.js已添加 -
你在哪里定义了
saveScreenshot? -
@igniteram1 抱歉,经过调整后再次对其进行了编辑。我们不同意之前的
saveScreenshot
标签: javascript node.js jasmine protractor