Skip to content

Commit 2cb8174

Browse files
committed
Add logging for any JS error
1 parent b1582f1 commit 2cb8174

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/dummy/test/application_system_test_case.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,14 @@
33

44
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
55
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
6+
7+
teardown do
8+
# Adapted from https://medium.com/@coorasse/catch-javascript-errors-in-your-system-tests-89c2fe6773b1
9+
errors = page.driver.browser.manage.logs.get(:browser)
10+
if errors.present?
11+
errors.each do |error|
12+
assert_nil "#{error.level}: #{error.message}"
13+
end
14+
end
15+
end
616
end

0 commit comments

Comments
 (0)