CircleCI 不适用于水豚 webkit (Rails)

CircleCI not working with capybara webkit (Rails)

我有一个项目(Rails 5,Capybara-webkit,Rspec)正在尝试在 circleci 上设置。

我使用 elasticsearch 服务向我的项目根目录添加了一个 circle.yml 文件,因为我的项目正在使用 searchkick :

machine:
  timezone:
    America/Los_Angeles
  ruby:
    version: 2.3.0
  services:
    - elasticsearch

问题是circleci returns我下一个错误:

1.1) Failure/Error: visit products_path

Capybara::Webkit::NoResponseError: No response received from the server. # ./spec/features/shop/index/add_product_to_list_spec.rb:48:in `block (6 levels) in '

1.2) Failure/Error: @socket.puts string

Errno::EPIPE: Broken pipe

/home/ubuntu/regalitos/vendor/bundle/ruby/2.3.0/gems/capybara-webkit-1.1.0/lib/capybara/webkit/connection.rb:29:in 'write' # /home/ubuntu/regalitos/vendor/bundle/ruby/2.3.0/gems/capybara-webkit-1.1.0/lib/capybara/webkit/connection.rb:29:in 'puts' # /home/ubuntu/regalitos/vendor/bundle/ruby/2.3.0/gems/capybara-webkit-1.1.0/lib/capybara/webkit/connection.rb:29:in 'puts' # /home/ubuntu/regalitos/vendor/bundle/ruby/2.3.0/gems/capybara-webkit-1.1.0/lib/capybara/webkit/browser.rb:146:in command' # /home/ubuntu/regalitos/vendor/bundle/ruby/2.3.0/gems/capybara-webkit-1.1.0/lib/capybara/webkit/browser.rb:78:in current_url' # /home/ubuntu/regalitos/vendor/bundle/ruby/2.3.0/gems/capybara-webkit-1.1.0/lib/capybara/webkit/driver.rb:25:in current_url' # /home/ubuntu/regalitos/vendor/bundle/ruby/2.3.0/gems/capybara-2.9.2/lib/capybara/session.rb:188:in current_url' # /home/ubuntu/regalitos/vendor/bundle/ruby/2.3.0/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec.rb:55:in block in after_failed_example' # /home/ubuntu/regalitos/vendor/bundle/ruby/2.3.0/gems/capybara-2.9.2/lib/capybara.rb:355:in using_session' # /home/ubuntu/regalitos/vendor/bundle/ruby/2.3.0/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec.rb:54:in after_failed_example' # /home/ubuntu/regalitos/vendor/bundle/ruby/2.3.0/gems/capybara-screenshot-1.0.14/lib/capybara-screenshot/rspec.rb:84:in block (2 levels) in '

所有其他功能也会测试 returns 破管错误。

搜索了一下后,我发现一个可能的解决方案是在 xvfb-run 中执行测试,所以我更新了我的 circle.yml 文件并像这样留下它:

machine:
  timezone:
    America/Los_Angeles
  ruby:
    version: 2.3.0
  services:
    - elasticsearch

test:
  override:
    - xvfb-run -a bundle exec rspec:
        parallel: false
        files:
          - spec/**/*_spec.rb

但我仍然得到同样的错误。有什么想法吗?

显然我必须将 qt5 安装文件添加到 capybara-webkit.[=12= 所需的文件中]

我成功了。这是我用来让它工作的 circle.yml:

machine:
  timezone:
    America/Los_Angeles
  ruby:
    version: 2.3.0
  services:
    - elasticsearch

dependencies:
  pre:
    - sudo add-apt-repository ppa:beineri/opt-qt542-trusty -y
    - sudo apt-get update -y; true
    - sudo apt-get install -y qt54webkit libwebkit-dev libgstreamer0.10-dev
    - echo "/opt/qt54/bin/qt54-env.sh" >> ~/.circlerc

您可以在这里阅读更多内容:https://discuss.circleci.com/t/using-qt-5-with-circleci/88/16