【问题标题】:nightmareJS timeout on vagrant无业游民的噩梦JS超时
【发布时间】:2018-02-13 21:35:55
【问题描述】:

我有 vagrant 虚拟机,我可以从那里访问一些端点(通过 curl)。我安装了 node (v 8.4.0) 和 npm (v 5.3.0)。我通过 sudo 运行它。我使用 nightmareJS,它无法连接到端点。我在另一台机器上运行相同的测试用例,它可以在没有超时的情况下工作:

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)
      })
    })
  })
})

当我跑步时:

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 正在阻止请求(?)

编辑2 我在调试节点中运行了噩梦,我得到了电子错误: 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

编辑3 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

【问题讨论】:

  • 我也可以在他们的示例中重现该问题,所以最新版本可能存在一些错误?
  • @TarunLalwani 我更新问题,降级没有帮助
  • 我尝试了 mac、vm、docker,但没有任何效果。我猜想与电子设置有关

标签: node.js npm vagrant nightmare codeceptjs


【解决方案1】:

我必须安装 libxss1 libnspr4-0d libcurl3、libx11-xcb-dev。也许并不是所有的库都是必需的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-11
    • 2018-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多