【发布时间】:2016-01-13 20:37:15
【问题描述】:
我正在阅读Angular tutorial,在第一章中,他们解释了如何运行单元测试和 e2e 测试。在本教程中,他们使用 Chrome 和 Firefox。由于我在没有 GUI 的 Ubuntu 14 虚拟机上运行应用程序,我决定使用 Phantomjs 浏览器。
最终我能够使用 Phantom 运行单元测试,但我遇到了 e2e 问题。
这是 protractor-conf.js 的样子:
exports.config = {
allScriptsTimeout: 11000,
specs: [
'e2e/*.js'
],
capabilities: {
'browserName': 'phantomjs',
'phantomjs.binary.path':'./node_modules/phantomjs/bin/phantomjs',
'phantomjs.ghostdriver.cli.args': ['--loglevel=DEBUG']
},
chromeOnly:true,
baseUrl: 'http://localhost:8000/',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
但是当我运行测试时出现以下错误:
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
[launcher] Process exited with error code 1
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
npm ERR! weird error 8
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
我是否错过了配置中的某些内容?这种情况下如何获取更详细的错误描述?
【问题讨论】:
-
你用的是什么版本的节点
node --version,什么版本的量角器? -
@martin770 节点版本为 v0.10.25。量角器版本是 2.5.1。
-
该版本的节点应该与该版本的量角器兼容,我之前使用过相同的配置,但不使用 phantomJS。除非您真的需要幻像,否则我建议您使用 xvfb-run 进行虚拟显示,并为您的浏览器使用 chrome。
标签: angularjs phantomjs protractor e2e-testing