mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Add JS console errors check (#28682)
This commit is contained in:
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
|
||||
|
18
spec/support/javascript_errors.rb
Normal file
18
spec/support/javascript_errors.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user