Skip to content

Commit

Permalink
Disable search engine popup in system specs
Browse files Browse the repository at this point in the history
Since Chrome 128 there is a Search Engine selection
popup even in headless mode that needs to be accepted.
This leads to Capybara Element not found exceptions during
system specs.

Refs: SeleniumHQ/selenium#14438
(cherry picked from commit c368c16)
  • Loading branch information
tvdeyen committed Aug 28, 2024
1 parent 6f61879 commit 75fcb6b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion templates/spec/support/solidus_starter_frontend/capybara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@

config.before(:each, type: :system, js: true) do |example|
screen_size = example.metadata[:screen_size] || [1800, 1400]
driven_by :selenium, using: :headless_chrome, screen_size: screen_size
driven_by(:selenium, using: :headless_chrome, screen_size: screen_size) do |capabilities|
capabilities.add_argument("--disable-search-engine-choice-screen")
end
end
end

Capybara.register_driver :selenium_chrome_headless_docker_friendly do |app|
browser_options = ::Selenium::WebDriver::Chrome::Options.new
browser_options.args << '--headless'
browser_options.args << '--disable-gpu'
browser_options.args << '--disable-search-engine-choice-screen'

Check warning on line 27 in templates/spec/support/solidus_starter_frontend/capybara.rb

View check run for this annotation

Codecov / codecov/patch

templates/spec/support/solidus_starter_frontend/capybara.rb#L27

Added line #L27 was not covered by tests
# Sandbox cannot be used inside unprivileged Docker container
browser_options.args << '--no-sandbox'
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
Expand Down

0 comments on commit 75fcb6b

Please sign in to comment.