Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion spec/support/capybara.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
require "timeout"

require "selenium/webdriver"

Capybara.register_driver :headless_chrome do |app|
# `--disable-dev-shm-usage` keeps Chrome off the small `/dev/shm` of CI
# runners and containers, where exhausting it crashes the renderer.
options = Selenium::WebDriver::Chrome::Options.new(
args: %w[--no-sandbox --headless],
args: %w[--no-sandbox --headless --disable-dev-shm-usage],
)

# Point Selenium at a specific Chrome binary, e.g. inside a container
Expand All @@ -23,3 +27,11 @@

Capybara.server = :webrick
Capybara.javascript_driver = :headless_chrome

RSpec.configure do |config|
# A crashed browser can leave the driver waiting forever: fail the example
# with a backtrace instead of eating the job's runtime cap.
config.around(:each, :js) do |example|
Timeout.timeout(300) { example.run }
end
end