1
0

Add JS console errors check (#28682)

This commit is contained in:
Matt Jankowski 2024-01-12 04:12:31 -05:00 committed by GitHub
parent cd37048439
commit df9e220364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -3,6 +3,8 @@
if Rake::Task.task_defined?('spec:system') if Rake::Task.task_defined?('spec:system')
namespace :spec do namespace :spec do
task :enable_system_specs do # rubocop:disable Rails/RakeEnvironment task :enable_system_specs do # rubocop:disable Rails/RakeEnvironment
ENV['LOCAL_DOMAIN'] = 'localhost:3000'
ENV['LOCAL_HTTPS'] = 'false'
ENV['RUN_SYSTEM_SPECS'] = 'true' ENV['RUN_SYSTEM_SPECS'] = 'true'
end end
end end

View File

@ -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