1
0
puyopuyotetr.is/spec/support/javascript_errors.rb

26 lines
777 B
Ruby
Raw Normal View History

2024-01-12 18:12:31 +09:00
# frozen_string_literal: true
RSpec.configure do |config|
config.after(:each, :js, type: :system) do
# Classes of intermittent ignorable errors
ignored_errors = [
/Error while trying to use the following icon from the Manifest/, # https://github.com/mastodon/mastodon/pull/30793
]
errors = page.driver.browser.logs.get(:browser).reject do |error|
ignored_errors.any? { |pattern| pattern.match(error.message) }
end
2024-01-12 18:12:31 +09:00
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'
warn 'WARN: javascript warning'
warn error.message
2024-01-12 18:12:31 +09:00
end
end
end
end
end