From 28d903858e1ba491bcb75a5534db9eea1acdeaf0 Mon Sep 17 00:00:00 2001 From: randx Date: Sat, 11 Aug 2012 23:33:49 +0300 Subject: [PATCH] Switch to capybara-webkit for Cucumber --- .travis.yml | 1 + Gemfile | 1 + Gemfile.lock | 4 ++++ features/support/env.rb | 11 +---------- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index f3ede12f..53dc1857 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ env: - DB=sqlite before_install: - sudo apt-get install libicu-dev -y + - sudo apt-get install libqt4-dev libqtwebkit-dev -y - gem install charlock_holmes -v="0.6.8" branches: only: diff --git a/Gemfile b/Gemfile index aa0ef934..d2a5728f 100644 --- a/Gemfile +++ b/Gemfile @@ -104,6 +104,7 @@ end group :development, :test do gem "rspec-rails" gem "capybara" + gem "capybara-webkit" gem "autotest" gem "autotest-rails" gem "pry" diff --git a/Gemfile.lock b/Gemfile.lock index e1680805..7356c35e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -118,6 +118,9 @@ GEM rack-test (>= 0.5.4) selenium-webdriver (~> 2.0) xpath (~> 0.1.4) + capybara-webkit (0.12.1) + capybara (>= 1.0.0, < 1.2) + json carrierwave (0.6.2) activemodel (>= 3.2.0) activesupport (>= 3.2.0) @@ -379,6 +382,7 @@ DEPENDENCIES awesome_print bootstrap-sass (= 2.0.3.1) capybara + capybara-webkit carrierwave charlock_holmes chosen-rails diff --git a/features/support/env.rb b/features/support/env.rb index 47253509..498072a3 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -4,7 +4,6 @@ # instead of editing this one. Cucumber will automatically load all features/**/*.rb # files. -require "selenium-webdriver" require 'cucumber/rails' require 'webmock/cucumber' WebMock.allow_net_connect! @@ -19,6 +18,7 @@ require Rails.root.join 'spec/support/valid_commit' # prefer to use XPath just remove this line and adjust any selectors in your # steps to use the XPath syntax. Capybara.default_selector = :css +Capybara.javascript_driver = :webkit # By default, any exception happening in your Rails application will bubble up # to Cucumber so that your scenario will fail. This is a different from how @@ -64,12 +64,3 @@ end # The :transaction strategy is faster, but might give you threading problems. # See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature Cucumber::Rails::Database.javascript_strategy = :truncation - -# We need this to fix the random timeout error that we were seeing in CI. -Capybara.register_driver :selenium_with_long_timeout do |app| - client = Selenium::WebDriver::Remote::Http::Default.new - client.timeout = 120 - Capybara::Selenium::Driver.new(app, :browser => :firefox, :http_client => client) -end - -Capybara.javascript_driver = :selenium_with_long_timeout