量角器截图测试错误代码105

时间:2016-06-28 09:56:03

标签: javascript node.js jasmine protractor

量角器测试运行良好,直到我弄乱我的config.js文件以包含屏幕截图测试。

运行量角器conf.js

时出错
  

C:\ Users \ hhhhhh \ mmmm \ tests \ e2e> protractor conf.js

     

[10:50:13] E / configParser - 错误代码:105

     

[10:50:13] E / configParser - 描述:加载配置文件conf.js失败

     

C:\用户\ HHHHHH \应用程序数据\漫游\ NPM \ node_modules \量角器\内置\ configParser.js:130               抛出新的exitCodes_1.ConfigError(记录器,'加载配置文件' + filename失败);`

的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'
       }));
    }

  };

许多人似乎对此有疑问。有谁找到了合理的解决方案

1 个答案:

答案 0 :(得分:1)

package.json您使用的protractor-jasmine2-screenshot-reporter查看,但您在protractor-screenshot-reporter中使用的是conf.js。两者都是不同的模块,请使用其中一个,然后再试一次!