量角器:在config.js文件上获取错误消息,该错误消息先前已在终端中工作

时间:2018-11-05 15:45:11

标签: javascript node.js testing protractor automated-tests

在量角器上运行测试我不断收到一条消息,说明我的配置文件有问题(该功能在2天前运行良好)。

希望能帮助您解决此问题。

  1. 我做错了什么?
  2. 我该如何解决?

注意事项:

  • npm已于2天前全局更新(版本11)

  • package.json文件已正确设置。能够运行
    星期六没有问题。

浏览日志,我认为这是问题所在

npm ERR! LocatorTraining@ protractor: `protractor configurations.js` 

在我的configuration.js文件中,我只添加了Html报告器。没什么。

var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['PageObjectLocator1.js'],
  capabilities: {
    browserName: 'chrome'
  },

  onPrepare: function() {
      browser.driver.manage().window().maximize(); 

      jasmine.getEnv().addReporter(
                new Jasmine2HtmlReporter({
                  savePath: 'target/screenshots'
                })
              );




  }
}

这是来自终端的消息

[16:27:25] I/launcher - 0 instance(s) of WebDriver still running
    [16:27:25] I/launcher - chrome #01 failed 1 test(s)
    [16:27:25] I/launcher - overall: 1 failed spec(s)
    [16:27:25] E/launcher - Process exited with error code 1

    npm ERR! Darwin 17.7.0
    npm ERR! argv "/Users/jacquelinegeorge/.nvm/versions/node/v7.2.0/bin/node" "/Users/jacquelinegeorge/.nvm/versions/node/v7.2.0/bin/npm" "run" "protractor"
    npm ERR! node v7.2.0
    npm ERR! npm  v3.10.9
    npm ERR! code ELIFECYCLE
    npm ERR! LocatorTraining@ protractor: `protractor configurations.js`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the LocatorTraining@ protractor script 'protractor configurations.js'.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR! If you do, this is most likely a problem with the LocatorTraining package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     protractor configurations.js
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR!     npm bugs LocatorTraining
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR!     npm owner ls LocatorTraining
    npm ERR! There is likely additional logging output above.

    npm ERR! Please include the following file with any support request:
    npm ERR!     /Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/npm-debug.log

这是2天前正在工作的package.json文件。

{
  "name": "LocatorTraining",

  "dependencies": {

"protractor":  "^5.4.1",
"jasmine-data-provider": "^2.2.0",
"protractor-jasmine2-html-reporter":"^0.0.7"



  },


  "scripts": {
    "webdriver-update": "./node_modules/.bin/webdriver-manager update",
    "webdriver-start": "./node_modules/.bin/webdriver-manager start",
    "protractor": "./node_modules/.bin/protractor configurations.js",
    "start": "npm run webdriver-update && npm run webdriver-start"
  }

}

1 个答案:

答案 0 :(得分:0)

目前,我似乎无法在Google Chrome浏览器中运行测试。当我在FF中运行此测试时,效果很好。所以代码很好。因此,我要做的就是找出为什么chrome不允许我运行测试。