Skip to content

Commit

Permalink
Update chrome options
Browse files Browse the repository at this point in the history
  • Loading branch information
yoldas committed Nov 21, 2024
1 parent 7bea16c commit e6b3e4e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ end

group :test do
gem 'capybara'
gem 'capybara-selenium'
gem 'database_cleaner'
gem 'factory_bot'
gem 'launchy'
gem 'rspec-collection_matchers'
gem 'rspec-rails'
gem 'selenium-webdriver', require: false
gem 'selenium-webdriver', '~> 4.1', require: false
gem 'simplecov', require: false
gem 'timecop'
end
6 changes: 5 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
capybara-selenium (0.0.6)
capybara
selenium-webdriver
childprocess (5.0.0)
coderay (1.1.3)
concurrent-ruby (1.3.3)
Expand Down Expand Up @@ -310,6 +313,7 @@ PLATFORMS
DEPENDENCIES
bootstrap-sass (= 3.4.1)
capybara
capybara-selenium
database_cleaner
exception_notification
factory_bot
Expand All @@ -332,7 +336,7 @@ DEPENDENCIES
rubocop-rspec
sass-rails (~> 6.0)
sdoc (~> 2.4.0)
selenium-webdriver
selenium-webdriver (~> 4.1)
simplecov
spring
timecop
Expand Down
14 changes: 2 additions & 12 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,16 @@
require 'selenium/webdriver'

Capybara.register_driver :chrome do |app|
client = Selenium::WebDriver::Remote::Http::Default.new
client.read_timeout = 120 # Set the read timeout to 120 seconds

Capybara::Selenium::Driver.new(app, browser: :chrome, http_client: client)
Capybara::Selenium::Driver.new(app, browser: :chrome)
end

Capybara.register_driver :headless_chrome do |app|
options = Selenium::WebDriver::Chrome::Options.new

options.add_argument('--headless=old')
options.add_argument('--disable_gpu')
# options.add_argument('--disable-popup-blocking')
options.add_argument('--window-size=1600,3200')
options.add_argument('--disable-search-engine-choice-screen')

client = Selenium::WebDriver::Remote::Http::Default.new
client.open_timeout = 120
client.read_timeout = 120

Capybara::Selenium::Driver.new(app, browser: :chrome, options:, http_client: client)
Capybara::Selenium::Driver.new(app, browser: :chrome, options:)
end

Capybara.javascript_driver = :headless_chrome
Expand Down

0 comments on commit e6b3e4e

Please sign in to comment.