Add JS console errors check (#28682)
parent
cd37048439
commit
df9e220364
|
@ -3,6 +3,8 @@
|
|||
if Rake::Task.task_defined?('spec:system')
|
||||
namespace :spec do
|
||||
task :enable_system_specs do # rubocop:disable Rails/RakeEnvironment
|
||||
ENV['LOCAL_DOMAIN'] = 'localhost:3000'
|
||||
ENV['LOCAL_HTTPS'] = 'false'
|
||||
ENV['RUN_SYSTEM_SPECS'] = 'true'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.after(:each, type: :system) do
|
||||
errors = page.driver.browser.logs.get(:browser)
|
||||
if errors.present?
|
||||
aggregate_failures 'javascript errrors' do
|
||||
errors.each do |error|
|
||||
expect(error.level).to_not eq('SEVERE'), error.message
|
||||
next unless error.level == 'WARNING'
|
||||
|
||||
$stderr.warn 'WARN: javascript warning'
|
||||
$stderr.warn error.message
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue