Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorcy committed Nov 30, 2023
1 parent 5e02987 commit 575da9c
Showing 1 changed file with 5 additions and 35 deletions.
40 changes: 5 additions & 35 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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
Expand Down

0 comments on commit 575da9c

Please sign in to comment.