From 4463ec89861e4cac46caac2f40aa58589e591f4e Mon Sep 17 00:00:00 2001 From: apple Date: Wed, 24 Jan 2024 15:05:43 -0500 Subject: [PATCH] Backport 3.5.x: Remove webdrivers dependency and adjust spec_helper --- blacklight-spotlight.gemspec | 1 - spec/spec_helper.rb | 22 +++++----------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/blacklight-spotlight.gemspec b/blacklight-spotlight.gemspec index 6a8c786d27..95ba305819 100644 --- a/blacklight-spotlight.gemspec +++ b/blacklight-spotlight.gemspec @@ -78,6 +78,5 @@ these collections.) s.add_development_dependency 'sitemap_generator' s.add_development_dependency 'solr_wrapper' s.add_development_dependency 'sqlite3' - s.add_development_dependency 'webdrivers' s.add_development_dependency 'webmock' end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f13bd33e77..e3e958947d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,7 +6,7 @@ require 'engine_cart' EngineCart.load_application! -Internal::Application.config.active_job.queue_adapter = :inline +ActiveJob::Base.queue_adapter = :test require 'rails-controller-testing' require 'rspec/collection_matchers' @@ -16,23 +16,11 @@ require 'paper_trail/frameworks/rspec' require 'selenium-webdriver' -require 'webdrivers' require 'webmock/rspec' -Capybara.javascript_driver = :headless_chrome +Capybara.javascript_driver = :selenium_chrome_headless -Capybara.register_driver :headless_chrome do |app| - Capybara::Selenium::Driver.load_selenium - browser_options = ::Selenium::WebDriver::Chrome::Options.new.tap do |opts| - opts.args << '--headless' - opts.args << '--disable-gpu' - opts.args << '--no-sandbox' - opts.args << '--window-size=1280,1696' - end - Capybara::Selenium::Driver.new(app, browser: :chrome, capabilities: [browser_options]) -end -require 'webmock/rspec' -allowed_sites = ['chromedriver.storage.googleapis.com', 'googlechromelabs.github.io', 'edgedl.me.gvt1.com'] +allowed_sites = ['chromedriver.storage.googleapis.com'] WebMock.disable_net_connect!(net_http_connect_on_start: true, allow_localhost: true, allow: allowed_sites) @@ -83,8 +71,8 @@ config.after(:each, type: :feature) { Warden.test_reset! } config.include Controllers::EngineHelpers, type: :controller config.include Capybara::DSL - config.include ::Rails.application.routes.url_helpers - config.include ::Rails.application.routes.mounted_helpers + config.include Rails.application.routes.url_helpers + config.include Rails.application.routes.mounted_helpers config.include Spotlight::TestFeaturesHelpers, type: :feature config.include CapybaraDefaultMaxWaitMetadataHelper, type: :feature