Webkit and Rspec Without X Server

capybara-webkit

problems running capybara-webkit with the Headless gem, Xvfb and our ci server. We use this setup for automatic integration testing and javascript testing of our Ruby on Rails 3.2 app. During the tests it complains that

webkit_server: cannot connect to X server need to rspec to config as:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rspec'
require 'capybara/webkit'
require 'headless'

Capybara.register_driver :webkit do |app|
  Capybara::Driver::Webkit.new(app, :ignore_ssl_errors => true)
end

Capybara.javascript_driver = :webkit

# don't run on the local machine (since we don't have xvfb running locally)
if Rails.env.production?
    headless = Headless.new
    headless.start
end

Comments