From ef30e547ed86c66e3986345f40ff346a07c8faf2 Mon Sep 17 00:00:00 2001 From: zhouyu Date: Tue, 21 Jan 2025 15:15:37 -0800 Subject: [PATCH] clean up --- spec/rails_helper.rb | 61 ++------------------------------------------ 1 file changed, 2 insertions(+), 59 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 0caafad..02fba9f 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -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 @@ -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