mirror of https://github.com/mastodon/mastodon
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
Ruby
40 lines
1.1 KiB
Ruby
12 months ago
|
# frozen_string_literal: true
|
||
|
|
||
5 months ago
|
module BrowserErrorsHelpers
|
||
|
def ignore_js_error(error)
|
||
|
@ignored_js_errors_for_spec << error
|
||
|
end
|
||
|
end
|
||
|
|
||
12 months ago
|
RSpec.configure do |config|
|
||
5 months ago
|
config.include BrowserErrorsHelpers, :js, type: :system
|
||
|
|
||
|
config.before(:each, :js, type: :system) do
|
||
|
@ignored_js_errors_for_spec = []
|
||
|
end
|
||
|
|
||
8 months ago
|
config.after(:each, :js, type: :system) do
|
||
6 months ago
|
# 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
|
||
5 months ago
|
/Manifest: Line: 1, column: 1, Syntax error/, # Similar parsing/interruption issue as above
|
||
5 months ago
|
].concat(@ignored_js_errors_for_spec)
|
||
|
|
||
6 months ago
|
errors = page.driver.browser.logs.get(:browser).reject do |error|
|
||
|
ignored_errors.any? { |pattern| pattern.match(error.message) }
|
||
|
end
|
||
|
|
||
12 months ago
|
if errors.present?
|
||
5 months ago
|
aggregate_failures 'browser errrors' do
|
||
12 months ago
|
errors.each do |error|
|
||
|
expect(error.level).to_not eq('SEVERE'), error.message
|
||
|
next unless error.level == 'WARNING'
|
||
|
|
||
5 months ago
|
warn 'WARN: browser warning'
|
||
12 months ago
|
warn error.message
|
||
12 months ago
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|