Navigation Menu

Skip to content

Commit

Permalink
Add logging for any JS error
Browse files Browse the repository at this point in the history
  • Loading branch information
rmosolgo committed Jun 17, 2020
1 parent b1582f1 commit 2cb8174
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/dummy/test/application_system_test_case.rb
Expand Up @@ -3,4 +3,14 @@

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]

teardown do
# Adapted from https://medium.com/@coorasse/catch-javascript-errors-in-your-system-tests-89c2fe6773b1
errors = page.driver.browser.manage.logs.get(:browser)
if errors.present?
errors.each do |error|
assert_nil "#{error.level}: #{error.message}"
end
end
end
end

0 comments on commit 2cb8174

Please sign in to comment.