我有流浪虚拟机,我可以从那里访问一些端点(通过 curl)。我安装了 node (v 8.4.0) 和 npm (v 5.3.0)。我通过 sudo 运行它。我使用 nightmareJS,它无法连接到端点。我在其他机器上运行相同的测试用例,它可以在没有超时的情况下工作:
测试/test_simple.js
const Nightmare = require('nightmare')
describe('UI Flow Tests', function() {
this.timeout('60s')
let nightmare = null
beforeEach(() => {
nightmare = new Nightmare()
})
describe('Using the App', function () {
describe('customize', () => {
it('should work without timing out', done => {
nightmare
.goto('http://simple-form-bootstrap.plataformatec.com.br/documentation')
.end()
.then(result => { done() })
.catch(done)
})
})
})
})
当我运行时:
sudo npm test
然后有一个超时:
> codec@1.0.0 test /home/vagrant/project/codecept
> mocha
UI Flow Tests
Using the App
customize
1) should work without timing out
0 passing (1m)
1 failing
1) UI Flow Tests Using the App customize should work without timing out:
Error: Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
npm ERR! Test failed. See above for more details.
编辑
我尝试了 node v8.3.0 和 nightmare 2.8 和 2.4.1 但同样的错误。看起来 vagrant 正在阻止请求(?)
Edit2
我在调试节点中运行了噩梦,我得到了电子错误:
DEBUG=nightmare npm test
nightmare electron child process exited with code 127: command not found - you may not have electron installed correctly +0ms
nightmare queueing action "goto" for http://simple-form-bootstrap.plataformatec.com.br/documentation +3ms
nightmare running +2ms
Edit3 deuggin
电子给出:
electron:stderr /home/vagrant/te/node_modules/electron/dist/electron: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory