Merge pull request #9545 from Philwi/control-capybara-headless-mode-via-environment-variable

Control capybara headless mode for testing via environment variable
This commit is contained in:
jibees
2022-08-10 08:05:26 +02:00
committed by GitHub

View File

@@ -2,6 +2,8 @@
require "capybara/cuprite"
headless = ActiveModel::Type::Boolean.new.cast(ENV.fetch("HEADLESS", true))
Capybara.register_driver(:cuprite) do |app|
Capybara::Cuprite::Driver.new(
app,
@@ -13,7 +15,7 @@ Capybara.register_driver(:cuprite) do |app|
# Don't load scripts from external sources, like google maps or stripe
url_whitelist: ["http://localhost", "http://0.0.0.0", "http://127.0.0.1"],
inspector: true,
headless: true,
headless: headless,
js_errors: true,
}
)