Skip to content

Commit

Permalink
test: update how Selenium is configured
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Apr 4, 2024
1 parent 0f1b671 commit 4e4a14c
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions spec/dummy/spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument("--headless")
options.add_argument("--disable-gpu")
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end

Expand Down Expand Up @@ -76,21 +78,6 @@

# Capybara config
config.include Capybara::DSL
#
# selenium_firefox webdriver only works for Travis-CI builds.
default_driver = :selenium_chrome_headless

supported_drivers = %i[selenium_chrome_headless selenium_chrome selenium selenium_headless]
driver = ENV["DRIVER"].try(:to_sym).presence || default_driver
Capybara.javascript_driver = driver
Capybara.default_driver = driver

raise "Unsupported driver: #{driver} (supported = #{supported_drivers})" unless supported_drivers.include?(driver)

Capybara.register_server(Capybara.javascript_driver) do |app, port|
require "rack/handler/puma"
Rack::Handler::Puma.run(app, Port: port)
end

config.before(:each, type: :system, js: true) do
driven_by driver
Expand Down

0 comments on commit 4e4a14c

Please sign in to comment.