我有流浪的虚拟机,我可以从那里访问一些端点(通过curl)。我安装了节点(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.
修改的
我尝试了节点v8.3.0和噩梦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
deguggin电子给出:
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
答案 0 :(得分:0)
我必须安装libxss1 libnspr4-0d libcurl3,libx11-xcb-dev。也许不是所有的库都是必需的。