capybara_helper.rb 799 B

12345678910111213141516171819202122232425262728293031323334
  1. require 'rails_helper'
  2. require 'capybara/rails'
  3. require 'capybara/poltergeist'
  4. require 'capybara-screenshot/rspec'
  5. require 'capybara-select-2'
  6. CAPYBARA_TIMEOUT = ENV['CI'] == 'true' ? 60 : 5
  7. Capybara.register_driver :poltergeist do |app|
  8. Capybara::Poltergeist::Driver.new(app, timeout: CAPYBARA_TIMEOUT)
  9. end
  10. Capybara.javascript_driver = :poltergeist
  11. Capybara.default_max_wait_time = CAPYBARA_TIMEOUT
  12. Capybara::Screenshot.prune_strategy = { keep: 3 }
  13. RSpec.configure do |config|
  14. config.include Warden::Test::Helpers
  15. config.include AlertConfirmer, type: :feature
  16. config.include FeatureHelpers, type: :feature
  17. config.before(:suite) do
  18. Warden.test_mode!
  19. end
  20. config.after(:each) do
  21. Warden.test_reset!
  22. end
  23. end
  24. VCR.configure do |config|
  25. config.ignore_localhost = true
  26. end