Skip to content

Warn about missing frontend console output from RSpec tests

Mike Greiling requested to merge mg-fix-rspec-stack-traces into master

What does this MR do?

Attempts to address issues with missing frontend stack traces within failed Capybara tests

Older versions of ChromeDriver will fail when attempting to collect console logs on newer versions of Chrome. This makes it difficult to diagnose RSpec failures on Capybara tests.

This change will produce a warning alerting the user that they ought to update their ChromeDriver version in order to see JavaScript console output.

before (with old chromedriver):

      1.2) Failure/Error: console = page.driver.browser.manage.logs.get(:browser)&.reject { |log| log.message =~ JS_CONSOLE_FILTER }
           Selenium::WebDriver::Error::WebDriverError:
             unexpected response, code=404, content-type="text/plain"
             unknown command: session/e50f45f3242fb037ccdf1a00bd4d0dc7/se/log

after:

     1.2) Failure/Error: raise JSConsoleError, message
          
          JSConsoleError:
            Unable to access Chrome javascript console logs. You may be using an outdated version of ChromeDriver.

after (with upgraded chromedriver):

     1.2) Failure/Error: raise JSConsoleError, message
          
          JSConsoleError:
            Unexpected browser console output:
            http://gdk.test:3808/assets/webpack/pages.users.chunk.js 61:10 "test error!!"

Note to reviewer

If you have a newer version of ChromeDriver installed with your GDK, you may not see this message. In order to test this message, you can force-install an older version of chromedriver with the following commands:

brew cask uninstall chromedriver
brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask/a807342e48849bc8515fce63718d444065917bd5/Casks/chromedriver.rb

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

closes #209791 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports