3

I'm working on a brand new Rails 5 app, and I can't launch Capybara-Webkit. I'm following these indications.

My development process includes Docker-Compose, then CircleCI for building the Docker image and sending it to Google Cloud Registry.

The $ bundle install is fine, the $ docker build is done, but I can't even launch a spec locally with Webkit.

When I launch this command, it hangs out and freeze:

$ docker-compose run web xvfb-run -a bundle exec rspec

I can't find any many informations about the xvfb-run command, I'm assuming it's a launcher packaged in xvfb...

Here is my Dockerfile:

FROM ruby:2.4.1

RUN apt-get update -qq && apt-get install -y \
  build-essential \
  libpq-dev \
  nodejs \
  xvfb \
  qt5-default \
  libqt5webkit5-dev \
  gstreamer1.0-plugins-base \
  gstreamer1.0-tools \
  gstreamer1.0-x

RUN mkdir /app_dir
WORKDIR /app_dir

ADD Gemfile* /app_dir/

RUN bundle install

COPY . .

Edit 07/08/2017

I think I got misleaded by my dev environment. When I try to launch my spec with guard instead of directly with the rspec, I get another error:

Capybara::Webkit::ConnectionError:
  /usr/local/bundle/gems/capybara-webkit-1.14.0/bin/webkit_server failed to start.

This doesnt help me much. This Github issue makes me believe that I need to do something with xvfb.

I tried to launch webkit_server directly from the gem bin folder, and I got the following error:

QXcbConnection: Could not connect to display
Aborted

Edit #2 07/08/2017

I found a way to launch my test suite. If I first launch a bash terminal in my docker compose system, I can then use xvfb without problem.

$ docker-compose run web bash

then

$ xvfb-run -a bundle exec rspec spec

And everything work as expected. The initial problem remains: when I launch this command:

$ docker-compose run web xvfb-run -a bundle exec rspec

It stay on hold and never launch any spec. I'm looking into docker-compose configuration, I must have missed something.

Weird stuff: when I launch my specs via guard it's working... I have no idea why.

Edit #3 08/08/2017

I ended up writing an issue in Capybara-Webkit repo.

Ruff9
  • 1,163
  • 15
  • 34
  • What is the error that you are getting? – Tarun Lalwani Aug 04 '17 at 16:30
  • This won't fix your current issue, but your test needs updating to make it less flaky. `click` isn't guaranteed to wait for the action it triggers to finish so you need an expectation after the `accept_confirm` block which checks the UI for something that changes when the user has been destroyed. Without that the second call to User.count can potentially occur before the user has actually been deleted making the test flaky. – Thomas Walpole Aug 04 '17 at 17:26
  • @TarunLalwani I don't get any errors, the specs never launch and nothing happen. Do you know a way to get more logs? – Ruff9 Aug 07 '17 at 08:19
  • @ThomasWalpole Thanks, I will look into it as soon as I can launch my specs :) – Ruff9 Aug 07 '17 at 08:20
  • @TarunLalwani I got a knew error message, I updated the main question. – Ruff9 Aug 07 '17 at 08:35
  • @ThomasWalpole I ended up cutting the part about the specific spec I was launching, felt more and more off topic. But thanks a lot, I changed my code according to your comment, and it's better now :) – Ruff9 Aug 08 '17 at 08:38

0 Answers0