Add JS console errors check (#28682)
This commit is contained in:
parent
cd37048439
commit
df9e220364
2 changed files with 20 additions and 0 deletions
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…
Add table
Add a link
Reference in a new issue