Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhoubk committed Jan 21, 2025
1 parent 246485e commit ef30e54
Showing 1 changed file with 2 additions and 59 deletions.
61 changes: 2 additions & 59 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,73 +9,17 @@
require 'capybara/rspec'
require 'selenium-webdriver'
require 'socket'
# require_relative 'support/common_helpers'
Rails.root.glob('spec/support/**/*.rb').sort.each { |file| require file }

Capybara.register_driver(:remote_chrome) do |app|
# chrome_args = %w[
# --disable-smooth-scrolling
# --headless=new
# --window-size=2560,1344
# --log-level FINE
# ]

# chrome_prefs = {
# 'download.prompt_for_download' => false,
# 'download.default_directory' => '/tmp'
# }
#
# chrome_args = %w[
# --disable-smooth-scrolling
# --window-size=2560,1344
# ]

# chrome_args = %w[
# --disable-smooth-scrolling
# --window-size=2560,1344
# --log-level FINE
# ]

# chrome_args = %w[
# --disable-smooth-scrolling
# --window-size=2560,1344
# --disable-features=InsecureDownloadWarnings
# ]

chrome_args = %w[
--disable-smooth-scrolling
--window-size=2560,1344
--disable-site-isolation-trials
]

# chrome_prefs = {
# 'download.prompt_for_download' => false,
# 'download.default_directory' => '/home/seluser/Downloads',
# # 'download.default_directory' => '/tmp',
# 'download.directory_upgrade' => true
# }

# chrome_options = Selenium::WebDriver::Chrome::Options.new(args: chrome_args, prefs: chrome_prefs).tap do |options|
# # NOTE: Different Selenium/Chrome versions set download directory differently -- see
# # https://github.com/teamcapybara/capybara/blob/3.38.0/spec/selenium_spec_chrome.rb#L15-L20
# if (download_dir = chrome_prefs['download.default_directory'])
# options.add_preference(:download, default_directory: download_dir)
# end
# end

# chrome_options = Selenium::WebDriver::Chrome::Options.new(args: chrome_args, prefs: chrome_prefs).tap do |options|
# # NOTE: Different Selenium/Chrome versions set download directory differently -- see
# # https://github.com/teamcapybara/capybara/blob/3.38.0/spec/selenium_spec_chrome.rb#L15-L20
# if (download_dir = chrome_prefs['download.default_directory'])
# options.add_preference(:download, default_directory: download_dir)
# end
# end
# chrome_options = Selenium::WebDriver::Chrome::Options.new(args: chrome_args)
# chrome_options.add_preference(:download, prompt_for_download: false, default_directory: '/home/seluser/Downloads', directory_upgrade: true)
# chrome_options.add_preference(:browser, set_download_behavior: { behavior: 'allow' })

chrome_options = Selenium::WebDriver::Chrome::Options.new(args: chrome_args).tap do |options|
options.add_preference(:download, prompt_for_download: false, default_directory: '/home/seluser/Downloads', directory_upgrade: true)
options.add_preference(:download, prompt_for_download: false, directory_upgrade: true)
options.add_preference(:browser, set_download_behavior: { behavior: 'allow' })
end

Expand All @@ -96,8 +40,7 @@

Capybara.default_driver = Capybara.javascript_driver = :remote_chrome
# Capybara.app_host = 'http://app.test:3000'
# Capybara.app_host = "http://#{IPSocket.getaddress(Socket.gethostname)}" if ENV['SELENIUM_HOST'].present?
# setup for CI later
# check for CI later
Capybara.app_host = "http://#{IPSocket.getaddress(Socket.gethostname)}:3000"
Capybara.server_host = '0.0.0.0'
Capybara.always_include_port = true
Expand Down

0 comments on commit ef30e54

Please sign in to comment.