Skip to content

Test: Add BrowserConsoleHelpers for Capybara

Paul Slaughter requested to merge 478037-js-fail-console-error into master

Issue: Add console.error assertion to Web IDE feature ... (#478037 - closed)

What does this MR do and why?

As part of #478037 (closed), this MR does 2 things:

  1. It adds a BrowserConsoleHelpers module for feature specs in Capybara. This introduces a method expect_page_to_have_no_console_errors.
  2. It shows this in action by fixing a bug on .com that would have been caught by this behavior.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Here's the new BrowserConsoleHelpers in action:

Screenshot_2024-08-19_at_6.34.25_PM

Here's the result of the frequent items fix:

Before After
Screenshot_2024-08-12_at_5.13.01_PM Screenshot_2024-08-12_at_5.15.42_PM

How to test?

To test that expect_page_to_have_no_console_errors fails when a console error is thrown:

  1. Checkout the changes in this commit 834e0243
  2. Run bundle exec spring rspec spec/features/global_search_spec.rb

To test the console-error-throwing bug that this MR fixes

  1. Checkout all the changes in this MR.
  2. Start GDK
  3. If you're signed into GDK, then sign out.
  4. Visit a public project as a signed out user and open the browser console.
  5. Click the Search or go to... button.

Related to #478037 (closed)

Edited by Paul Slaughter

Merge request reports