conf(capybara): make JS_LOG work for head and headless

This commit is contained in:
simon lehericey 2022-10-28 11:13:09 +02:00
parent 091a522cbf
commit db0fcec019

View file

@ -16,6 +16,12 @@ def setup_driver(app, download_path, options)
upload_throughput: 1024000
}
end
if ENV['JS_LOG'].present?
driver.browser.on_log_event(:console) do |event|
puts event.args if event.type == ENV['JS_LOG'].downcase.to_sym
end
end
end
end
@ -76,12 +82,6 @@ RSpec.configure do |config|
config.before(:each, type: :system, js: true) do
driven_by ENV['NO_HEADLESS'] ? :chrome : :headless_chrome
if ENV['JS_LOG'].present?
page.driver.browser.on_log_event(:console) do |event|
puts event.args if event.type == ENV['JS_LOG'].downcase.to_sym
end
end
end
# Set the user preferred language before Javascript system specs.