Skip to content

Using Capybara Webkit

Casey Watts edited this page Apr 24, 2018 · 3 revisions

Teaspoon allows using Capybara Webkit when running specs from the rake task or command line interface. This allows for a quick alternative to phantomjs if you can't get it working reliably.

This page is dedicated to how to get setup and running.

Setup

You'll need to include the capybara-webkit gem in your Gemfile.

gem "capybara-webkit"

Configure Teaspoon to use the capybara_webkit driver.

spec/javascripts/teaspoon_env.rb

Teaspoon.configure do |config|
  config.driver = :capybara_webkit
end

Now when you run rake teaspoon it should be using Capybara Webkit to run your specs. You can also override the driver using rake teaspoon DRIVER=capybara_webkit or bundle exec teaspoon --driver=capybara_webkit.

Travis CI

To get this running on Travis CI, you'll need to modify your .travis.yml file. See the Travis docs.

using xvfb-run

Put xvfb-run before the teaspoon command.

script: xvfb-run teaspoon

using xvfb directly

.travis.yml

before_script:
  - 'sh -e /etc/init.d/xvfb start'
env:
  - DISPLAY=":99.0"