I have vagrant virtualmachine, I can access some endpoints from there (via curl). I installed node (v 8.4.0) and npm (v 5.3.0). I run it via sudo. I use nightmareJS and it can't connect to endpoint. I run the same tests case on other machine and it works without timeout:
test/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)
})
})
})
})
when I run:
sudo npm test
then there is a timeout:
> [email protected] 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.
Edit
I tried node v8.3.0 and nightmare 2.8 and 2.4.1 but the same error. Looks like vagrant is blocking request(?)
Edit2
I ran nightmare in debug node and I get error with electron:
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 gives:
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
I had to install libxss1 libnspr4-0d libcurl3, libx11-xcb-dev. Maybe not all libs are required.