量角器运行后的uncaughtException

时间:2016-07-15 13:57:26

标签: javascript angularjs testing selenium-webdriver protractor

升级到Protractor 4.0.0并因为重大变化而调整配置后,我们终于启动了测试。

现在,问题是在测试运行后它失败了:

[09:52:22] E/launcher - "process.on('uncaughtException'" error, see launcher
[09:52:22] E/launcher - Process exited with error code 199

如何调试此问题并了解导致问题的原因?

试图在&#34中运行量角器;排除"模式:

$ protractor config/local.conf.js --troubleshoot

但输出完全相同,没有关于错误的详细信息。

5 个答案:

答案 0 :(得分:11)

这是currently being fixed,很快就会有热门修复。快速修复(在热修复发布之前)是更改node_modules中的代码或恢复为3.3.0。

修改node_modules/protractor/built/launcher.js将第168行的uncaughtException替换为:

    process.on('uncaughtException', function (e) {
    var errorCode = exitCodes_1.ErrorHandler.parseError(e);
    if (errorCode) {
        var protractorError = e;
        exitCodes_1.ProtractorError.log(logger, errorCode, protractorError.message, protractorError.stack);
        process.exit(errorCode);
    }
    else {
        logger.error(e.message);
        logger.error(e.stack);
        process.exit(exitCodes_1.ProtractorError.CODE);
    }
});

答案 1 :(得分:3)

升级到量角器4.0.10似乎可以解决它。

启动器中有4.0.0到4.0.10的几个修复程序。请参阅changelog: https://github.com/angular/protractor/blob/master/CHANGELOG.md

答案 2 :(得分:0)

仍然不确定发生了什么以及调试此类问题的最佳方法是什么,但以下是我已采取的措施:

  • 完全删除node_modules
  • 已执行npm install(量角器在^4.0.0中列为package.json
  • 已执行node_modules/.bin/webdriver-manager update

现在它可以工作了,它不再抛出uncaughtException

我还删除了protractor-jasmine2-screenshot-reporter,但我认为它不相关。

此外,我们一直在使用grunt-protractor-runner从一项艰巨的任务中运行Protractor测试,我必须fork itupdate protractor dependency to 4.0.0

答案 3 :(得分:0)

修改node_modules / protractor / built / launcher.js的解决方案有效。

可能有错误说" E / launcher - 未知错误:Chrome版本必须为> = 53.0.2785.0"只需要更新你的chrome版本

答案 4 :(得分:0)

我一直在使用grunt-protractor-runner 4.0.0。 我正在测试特定的测试文件并在发现我在 protractor.conf.js 文件中意外地注释掉了specs数组中的所有文件后收到了这个错误。

specs:
[
  //'test1-spec.js',
  //'test2-spec.js'
]

希望这个愚蠢的错误有助于某人。