Use poltergeist instaead of capybara-webkit

This commit is contained in:
Dmitriy Zaporozhets 2012-11-16 12:27:39 +02:00
parent ece563296b
commit ba25b2dc84
5 changed files with 38 additions and 21 deletions

View file

@ -123,8 +123,6 @@ group :development, :test do
gem 'spinach-rails' gem 'spinach-rails'
gem "rspec-rails" gem "rspec-rails"
gem "capybara" gem "capybara"
gem "capybara-webkit"
gem "headless"
gem "pry" gem "pry"
gem "awesome_print" gem "awesome_print"
gem "database_cleaner" gem "database_cleaner"
@ -139,6 +137,9 @@ group :development, :test do
gem 'rb-fsevent', require: darwin_only('rb-fsevent') gem 'rb-fsevent', require: darwin_only('rb-fsevent')
gem 'growl', require: darwin_only('growl') gem 'growl', require: darwin_only('growl')
gem 'rb-inotify', require: linux_only('rb-inotify') gem 'rb-inotify', require: linux_only('rb-inotify')
# PhantomJS driver for Capybara
gem 'poltergeist'
end end
group :test do group :test do

View file

@ -94,9 +94,6 @@ GEM
rack-test (>= 0.5.4) rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0) selenium-webdriver (~> 2.0)
xpath (~> 0.1.4) xpath (~> 0.1.4)
capybara-webkit (0.12.1)
capybara (>= 1.0.0, < 1.2)
json
carrierwave (0.6.2) carrierwave (0.6.2)
activemodel (>= 3.2.0) activemodel (>= 3.2.0)
activesupport (>= 3.2.0) activesupport (>= 3.2.0)
@ -143,6 +140,8 @@ GEM
railties (>= 3.0.0) railties (>= 3.0.0)
faraday (0.8.4) faraday (0.8.4)
multipart-post (~> 1.1) multipart-post (~> 1.1)
faye-websocket (0.4.6)
eventmachine (>= 0.12.0)
ffaker (1.14.0) ffaker (1.14.0)
ffi (1.0.11) ffi (1.0.11)
font-awesome-sass-rails (2.0.0.0) font-awesome-sass-rails (2.0.0.0)
@ -189,8 +188,8 @@ GEM
hashery (1.5.0) hashery (1.5.0)
blankslate blankslate
hashie (1.2.0) hashie (1.2.0)
headless (0.3.1)
hike (1.2.1) hike (1.2.1)
http_parser.rb (0.5.3)
httparty (0.8.3) httparty (0.8.3)
multi_json (~> 1.0) multi_json (~> 1.0)
multi_xml multi_xml
@ -260,6 +259,12 @@ GEM
omniauth-oauth (~> 1.0) omniauth-oauth (~> 1.0)
orm_adapter (0.3.0) orm_adapter (0.3.0)
pg (0.14.0) pg (0.14.0)
poltergeist (1.0.2)
capybara (~> 1.1)
childprocess (~> 0.3)
faye-websocket (~> 0.4, >= 0.4.4)
http_parser.rb (~> 0.5.3)
multi_json (~> 1.0)
polyglot (0.3.3) polyglot (0.3.3)
posix-spawn (0.3.6) posix-spawn (0.3.6)
pry (0.9.9.6) pry (0.9.9.6)
@ -422,7 +427,6 @@ DEPENDENCIES
awesome_print awesome_print
bootstrap-sass (= 2.0.4) bootstrap-sass (= 2.0.4)
capybara capybara
capybara-webkit
carrierwave carrierwave
chosen-rails chosen-rails
coffee-rails (= 3.2.2) coffee-rails (= 3.2.2)
@ -449,7 +453,6 @@ DEPENDENCIES
guard-rspec guard-rspec
guard-spinach guard-spinach
haml-rails haml-rails
headless
httparty httparty
jquery-atwho-rails (= 0.1.6) jquery-atwho-rails (= 0.1.6)
jquery-rails (= 2.0.2) jquery-rails (= 2.0.2)
@ -465,6 +468,7 @@ DEPENDENCIES
omniauth-ldap! omniauth-ldap!
omniauth-twitter omniauth-twitter
pg pg
poltergeist
pry pry
pygments.rb (= 0.3.1) pygments.rb (= 0.3.1)
quiet_assets (= 1.0.1) quiet_assets (= 1.0.1)

View file

@ -96,8 +96,7 @@ class ProjectIssues < Spinach::FeatureSteps
end end
Then 'I should see selected milestone with title "v3.0"' do Then 'I should see selected milestone with title "v3.0"' do
issues_milestone_selector = "#issue_milestone_id_chzn/a" issues_milestone_selector = "#milestone_id_chzn > a"
wait_until { page.has_content?("Details") }
page.find(issues_milestone_selector).should have_content("v3.0") page.find(issues_milestone_selector).should have_content("v3.0")
end end

View file

@ -11,14 +11,33 @@ end
Dir["#{Rails.root}/features/steps/shared/*.rb"].each {|file| require file} Dir["#{Rails.root}/features/steps/shared/*.rb"].each {|file| require file}
#
# Stub gitolite
#
include GitoliteStub include GitoliteStub
WebMock.allow_net_connect! WebMock.allow_net_connect!
Capybara.javascript_driver = :webkit
#
# JS driver
#
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
Spinach.hooks.on_tag("javascript") do
::Capybara.current_driver = ::Capybara.javascript_driver
::Capybara.default_wait_time = 5
end
DatabaseCleaner.strategy = :truncation DatabaseCleaner.strategy = :truncation
Spinach.hooks.before_scenario { DatabaseCleaner.start }
Spinach.hooks.after_scenario { DatabaseCleaner.clean } Spinach.hooks.before_scenario do
DatabaseCleaner.start
end
Spinach.hooks.after_scenario do
DatabaseCleaner.clean
end
Spinach.hooks.before_run do Spinach.hooks.before_run do
RSpec::Mocks::setup self RSpec::Mocks::setup self

View file

@ -11,14 +11,13 @@ require 'capybara/rails'
require 'capybara/rspec' require 'capybara/rspec'
require 'webmock/rspec' require 'webmock/rspec'
require 'email_spec' require 'email_spec'
require 'headless'
# Requires supporting ruby files with custom matchers and macros, etc, # Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories. # in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
# Use capybara-webkit require 'capybara/poltergeist'
Capybara.javascript_driver = :webkit Capybara.javascript_driver = :poltergeist
WebMock.disable_net_connect!(allow_localhost: true) WebMock.disable_net_connect!(allow_localhost: true)
@ -35,11 +34,6 @@ RSpec.configure do |config|
# instead of true. # instead of true.
config.use_transactional_fixtures = false config.use_transactional_fixtures = false
config.before :all do
headless = Headless.new
headless.start
end
config.before do config.before do
stub_gitolite! stub_gitolite!