Skip to content

Filter Welcome to GitLab console message from capybara

Lee Tickett requested to merge filter-welcome-console-message-from-capybara into master

What does this MR do and why?

The welcome message we recently added in the console often appears in capybara test output. This MR adds it to the existing filters.

Screenshots or screen recordings

Before:

Failures:

  1) Admin::AbuseReports as an admin if a user has been reported for abuse in the abuse report view presents information about abuse report
     Got 1 failure and 1 other error:

     1.1) Failure/Error: expect(1).to be(2)
          
            expected #<Integer:5> => 2
                 got #<Integer:3> => 1
          
            Compared using equal?, which compares object identity,
            but expected and actual are not the same object. Use
            `expect(actual).to eq(expected)` if you don't care about
            object identity in this example.
          # ./spec/features/admin/admin_abuse_reports_spec.rb:22:in `block (5 levels) in <main>'
          # ./spec/spec_helper.rb:404:in `block (3 levels) in <main>'
          # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
          # ./spec/spec_helper.rb:395:in `block (2 levels) in <main>'
          # ./spec/spec_helper.rb:391:in `block (3 levels) in <main>'
          # ./lib/gitlab/application_context.rb:31:in `with_raw_context'
          # ./spec/spec_helper.rb:391:in `block (2 levels) in <main>'
          # ./spec/support/database/prevent_cross_joins.rb:95:in `block (3 levels) in <main>'
          # ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
          # ./spec/support/database/prevent_cross_joins.rb:95:in `block (2 levels) in <main>'
          # -e:1:in `<main>'

     1.2) Failure/Error: raise JSConsoleError, message
          
          JSConsoleError:
            Unexpected browser console output:
            webpack-internal:///oeCv 1608 Refused to connect to 'http://gdk.test:3808/sockjs-node/info?t=1632667135060' because it violates the following Content Security Policy directive: "connect-src 'self'".
          
            webpack-internal:///Vdnm 11:10 "%cWelcome to GitLab!%c\n\nDoes this page need fixes or improvements? Open an issue or contribute a merge request to help make GitLab more lovable. At GitLab, everyone can contribute!\n\n🤝 Contribute to GitLab: https://about.gitlab.com/community/contribute/\n🔎 Create a new GitLab issue: https://gitlab.com/gitlab-org/gitlab/-/issues/new\n" "padding-top: 0.5em; font-size: 2em;" "padding-bottom: 0.5em;"
            webpack-internal:////t7P 171:8 "[WDS] Disconnected!"
            webpack-internal:///oeCv 1608 Refused to connect to 'http://gdk.test:3808/sockjs-node/info?t=1632667136218' because it violates the following Content Security Policy directive: "connect-src 'self'".
          
            webpack-internal:///oeCv 1608 Refused to connect to 'http://gdk.test:3808/sockjs-node/info?t=1632667138381' because it violates the following Content Security Policy directive: "connect-src 'self'".
          
            webpack-internal:///Vdnm 11:10 "%cWelcome to GitLab!%c\n\nDoes this page need fixes or improvements? Open an issue or contribute a merge request to help make GitLab more lovable. At GitLab, everyone can contribute!\n\n🤝 Contribute to GitLab: https://about.gitlab.com/community/contribute/\n🔎 Create a new GitLab issue: https://gitlab.com/gitlab-org/gitlab/-/issues/new\n" "padding-top: 0.5em; font-size: 2em;" "padding-bottom: 0.5em;"
            webpack-internal:////t7P 171:8 "[WDS] Disconnected!"
            webpack-internal:///Vdnm 11:10 "%cWelcome to GitLab!%c\n\nDoes this page need fixes or improvements? Open an issue or contribute a merge request to help make GitLab more lovable. At GitLab, everyone can contribute!\n\n🤝 Contribute to GitLab: https://about.gitlab.com/community/contribute/\n🔎 Create a new GitLab issue: https://gitlab.com/gitlab-org/gitlab/-/issues/new\n" "padding-top: 0.5em; font-size: 2em;" "padding-bottom: 0.5em;"
            webpack-internal:///oeCv 1608 Refused to connect to 'http://gdk.test:3808/sockjs-node/info?t=1632667139299' because it violates the following Content Security Policy directive: "connect-src 'self'".
          
            webpack-internal:////t7P 171:8 "[WDS] Disconnected!"
          # ./spec/support/capybara.rb:197:in `block (2 levels) in <main>'
          # ./spec/spec_helper.rb:404:in `block (3 levels) in <main>'
          # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
          # ./spec/spec_helper.rb:395:in `block (2 levels) in <main>'
          # ./spec/spec_helper.rb:391:in `block (3 levels) in <main>'
          # ./lib/gitlab/application_context.rb:31:in `with_raw_context'
          # ./spec/spec_helper.rb:391:in `block (2 levels) in <main>'
          # ./spec/support/database/prevent_cross_joins.rb:95:in `block (3 levels) in <main>'
          # ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
          # ./spec/support/database/prevent_cross_joins.rb:95:in `block (2 levels) in <main>'
          # -e:1:in `<main>'

Finished in 38.33 seconds (files took 2.72 seconds to load)
4 examples, 1 failure

Failed examples:

rspec ./spec/features/admin/admin_abuse_reports_spec.rb:19 # Admin::AbuseReports as an admin if a user has been reported for abuse in the abuse report view presents information about abuse report

After:

Failures:

  1) Admin::AbuseReports as an admin if a user has been reported for abuse in the abuse report view presents information about abuse report
     Got 1 failure and 1 other error:

     1.1) Failure/Error: expect(1).to be(2)
          
            expected #<Integer:5> => 2
                 got #<Integer:3> => 1
          
            Compared using equal?, which compares object identity,
            but expected and actual are not the same object. Use
            `expect(actual).to eq(expected)` if you don't care about
            object identity in this example.
          # ./spec/features/admin/admin_abuse_reports_spec.rb:22:in `block (5 levels) in <main>'
          # ./spec/spec_helper.rb:404:in `block (3 levels) in <main>'
          # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
          # ./spec/spec_helper.rb:395:in `block (2 levels) in <main>'
          # ./spec/spec_helper.rb:391:in `block (3 levels) in <main>'
          # ./lib/gitlab/application_context.rb:31:in `with_raw_context'
          # ./spec/spec_helper.rb:391:in `block (2 levels) in <main>'
          # ./spec/support/database/prevent_cross_joins.rb:95:in `block (3 levels) in <main>'
          # ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
          # ./spec/support/database/prevent_cross_joins.rb:95:in `block (2 levels) in <main>'
          # -e:1:in `<main>'

     1.2) Failure/Error: raise JSConsoleError, message
          
          JSConsoleError:
            Unexpected browser console output:
            webpack-internal:///oeCv 1608 Refused to connect to 'http://gdk.test:3808/sockjs-node/info?t=1632667055928' because it violates the following Content Security Policy directive: "connect-src 'self'".
          
            webpack-internal:////t7P 171:8 "[WDS] Disconnected!"
            webpack-internal:///oeCv 1608 Refused to connect to 'http://gdk.test:3808/sockjs-node/info?t=1632667057045' because it violates the following Content Security Policy directive: "connect-src 'self'".
          
            webpack-internal:///oeCv 1608 Refused to connect to 'http://gdk.test:3808/sockjs-node/info?t=1632667059361' because it violates the following Content Security Policy directive: "connect-src 'self'".
          
            webpack-internal:////t7P 171:8 "[WDS] Disconnected!"
            webpack-internal:///oeCv 1608 Refused to connect to 'http://gdk.test:3808/sockjs-node/info?t=1632667060402' because it violates the following Content Security Policy directive: "connect-src 'self'".
          
            webpack-internal:////t7P 171:8 "[WDS] Disconnected!"
          # ./spec/support/capybara.rb:198:in `block (2 levels) in <main>'
          # ./spec/spec_helper.rb:404:in `block (3 levels) in <main>'
          # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
          # ./spec/spec_helper.rb:395:in `block (2 levels) in <main>'
          # ./spec/spec_helper.rb:391:in `block (3 levels) in <main>'
          # ./lib/gitlab/application_context.rb:31:in `with_raw_context'
          # ./spec/spec_helper.rb:391:in `block (2 levels) in <main>'
          # ./spec/support/database/prevent_cross_joins.rb:95:in `block (3 levels) in <main>'
          # ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
          # ./spec/support/database/prevent_cross_joins.rb:95:in `block (2 levels) in <main>'
          # -e:1:in `<main>'

Finished in 39.81 seconds (files took 2.74 seconds to load)
4 examples, 1 failure

Failed examples:

rspec ./spec/features/admin/admin_abuse_reports_spec.rb:19 # Admin::AbuseReports as an admin if a user has been reported for abuse in the abuse report view presents information about abuse report

How to set up and validate locally

  1. Modify a simple js feature spec to deliberately fail e.g. spec/features/admin/admin_abuse_reports_spec.rb
lee@cc-gdk-2:~/gitlab-development-kit/gitlab$ git diff
diff --git a/spec/features/admin/admin_abuse_reports_spec.rb b/spec/features/admin/admin_abuse_reports_spec.rb
index 3a02ce89aa9..fc2bedaaad6 100644
--- a/spec/features/admin/admin_abuse_reports_spec.rb
+++ b/spec/features/admin/admin_abuse_reports_spec.rb
@@ -19,7 +19,7 @@
         it 'presents information about abuse report' do
           visit admin_abuse_reports_path
 
-          expect(page).to have_content('Abuse Reports')
+          expect(1).to be(2)
           expect(page).to have_content(abuse_report.message)
           expect(page).to have_link(user.name, href: user_path(user))
           expect(page).to have_link('Remove user')
  1. Run spec.

If you do this with master checked out, you should see the "before" output (with the welcome message)

If you do this with this branch checked out, you should see the "after" screenshot without the console clutter.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Lee Tickett

Merge request reports

Loading