From 575da9ce2c1995a8ad67703836ad315cd0f53462 Mon Sep 17 00:00:00 2001 From: Mike Korcynski Date: Thu, 30 Nov 2023 16:09:27 -0500 Subject: [PATCH] wip --- spec/rails_helper.rb | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 7402e9d..74d8c35 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -24,46 +24,21 @@ require 'spec_helper' require 'rspec/rails' -require 'capybara-screenshot/rspec' # Add additional requires below this line. Rails is not loaded until this point! require 'active_fedora/cleaner' + Capybara.server = :webrick -Capybara::Screenshot.autosave_on_failure = false -if ENV['IN_DOCKER'].present? || ENV['HUB_URL'].present? - args = %w[disable-gpu no-sandbox whitelisted-ips window-size=1400,1400] - args.push('headless') if ActiveModel::Type::Boolean.new.cast(ENV['CHROME_HEADLESS_MODE']) - - capabilities = Selenium::WebDriver::Remote::Capabilities.chrome("goog:chromeOptions" => { args: args }) - - Capybara.register_driver :selenium_chrome_headless_sandboxless do |app| - driver = Capybara::Selenium::Driver.new(app, - browser: :remote, - desired_capabilities: capabilities, - url: ENV['HUB_URL']) - - # Fix for capybara vs remote files. Selenium handles this for us - driver.browser.file_detector = lambda do |argss| - str = argss.first.to_s - str if File.exist?(str) - end - driver - end - Capybara.server_host = '0.0.0.0' - Capybara.server_port = 3010 - Capybara.javascript_driver = :selenium_chrome_headless_sandboxless - ip = IPSocket.getaddress(Socket.gethostname) - Capybara.app_host = "http://#{ip}:#{Capybara.server_port}" - Capybara.default_driver = :selenium_chrome_headless_sandboxless -else - # this is for github actions only +# this is for github actions only +if ENV['CI'] Webdrivers::Chromedriver.required_version = '106.0.5249.21' custom_chrome_path = '/opt/hostedtoolcache/chromium/1036826/x64/chrome' +end - # Adding chromedriver for js testing. +# Adding chromedriver for js testing. Capybara.register_driver :headless_chrome do |app| browser_options = ::Selenium::WebDriver::Chrome::Options.new browser_options.headless! @@ -84,11 +59,6 @@ Capybara.javascript_driver = :headless_chrome -end - -# Change to :chrome for js test debugging - - # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are # run as spec files by default. This means that files in spec/support that end