Commit 42109dd9 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Merge branch 'mg-fix-rspec-stack-traces' into 'master'

Warn about missing frontend console output from RSpec tests

Closes #209791

See merge request gitlab-org/gitlab!34670
parents 6b13b430 a03b5efb
......@@ -153,12 +153,21 @@ RSpec.configure do |config|
# fixed. If we raised the `JSException` the fixed test would be marked as
# failed again.
if example.exception && !example.exception.is_a?(RSpec::Core::Pending::PendingExampleFixedError)
begin
console = page.driver.browser.manage.logs.get(:browser)&.reject { |log| log.message =~ JS_CONSOLE_FILTER }
if console.present?
message = "Unexpected browser console output:\n" + console.map(&:message).join("\n")
raise JSConsoleError, message
end
rescue Selenium::WebDriver::Error::WebDriverError => error
if error.message =~ /unknown command: session\/[0-9a-zA-Z]+(?:\/se)?\/log/
message = "Unable to access Chrome javascript console logs. You may be using an outdated version of ChromeDriver."
raise JSConsoleError, message
else
raise error
end
end
end
# prevent localStorage from introducing side effects based on test order
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment