Properly eagerly-load the Capybara server for JS feature specs only
Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
parent
f659c406ab
commit
2fa5607448
3 changed files with 9 additions and 4 deletions
|
@ -3,7 +3,7 @@ require 'capybara/poltergeist'
|
|||
require 'capybara-screenshot/spinach'
|
||||
|
||||
# Give CI some extra time
|
||||
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 40 : 10
|
||||
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 60 : 30
|
||||
|
||||
Capybara.javascript_driver = :poltergeist
|
||||
Capybara.register_driver :poltergeist do |app|
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
# rubocop:disable Style/GlobalVars
|
||||
require 'capybara/rails'
|
||||
require 'capybara/rspec'
|
||||
require 'capybara/poltergeist'
|
||||
require 'capybara-screenshot/rspec'
|
||||
|
||||
# Give CI some extra time
|
||||
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 40 : 10
|
||||
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 60 : 30
|
||||
|
||||
Capybara.javascript_driver = :poltergeist
|
||||
Capybara.register_driver :poltergeist do |app|
|
||||
|
@ -26,7 +27,10 @@ Capybara.ignore_hidden_elements = true
|
|||
Capybara::Screenshot.prune_strategy = :keep_last_run
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.before(:suite) do
|
||||
config.before(:context, :js) do
|
||||
next if $capybara_server_already_started
|
||||
|
||||
TestEnv.eager_load_driver_server
|
||||
$capybara_server_already_started = true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -172,7 +172,8 @@ module TestEnv
|
|||
def eager_load_driver_server
|
||||
return unless defined?(Capybara)
|
||||
|
||||
Capybara.current_session.driver.visit '/'
|
||||
puts "Starting the Capybara driver' server..."
|
||||
Capybara.current_session.visit '/'
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in a new issue