Draft: Fail feature specs on unexpected browser console errors - no allow list (DON'T MERGE)
What does this MR do and why?
This is a reveal MR for !256639. It is not meant to merge as is. Its purpose is to run the full feature spec suite with a stricter browser console check and list the errors that Vue 2 hides today.
This MR changes the feature spec browser console check to fail on any SEVERE console error, not only when the example already failed. Vue 2 catches render errors, logs them with console.error, and renders the component blank. Vue 3, in the development build that feature specs use, rethrows these errors and breaks the component tree. Feature specs pass under Vue 2 today while logging these latent bugs. With this change, the specs fail now, before a Vue 3 migration flag is enabled. This applies to every page, not only Rapid Diffs.
Changes:
spec/support/capybara.rb,config.after(:example, :js)hook:raise_if_unexpected_browser_console_outputruns for every:jsexample, except when the exception isRSpec::Core::Pending::PendingExampleFixedError. Before, it ran only when the example had already failed.spec/support/helpers/browser_console_helpers.rb,BROWSER_CONSOLE_ERROR_FILTER: also ignoresFailed to load resource(Chrome logs every 4xx/5xx response as SEVERE; many specs assert on them), all Snowplow tracker messages (CSP violations in the test environment), and[Sentry stub](the stub forwardscaptureExceptiontoconsole.error). The first pipeline run showed that these three messages made up most of the failures.
Note that [Vue warn] messages are also emitted with console.error and therefore are SEVERE. They also fail specs now.
The pipeline runs all RSpec jobs and the Vue 3 system jobs. Expect many failures. Each failure is either a latent bug that a Vue 3 migration would turn into a crash, noise that the filter should ignore, or a spec that must be fixed.
Findings from the first run
Pipeline https://gitlab.com/gitlab-org/gitlab/-/pipelines/2843011566 (before the filter widening). The expected Rapid Diffs failure was present under Vue 2 ([Vue warn]: Error in render: "TypeError: Cannot read properties of undefined (reading 'id')" in user_comments_on_whitespace_hidden_diff_spec.rb and user_sees_avatar_on_diff_notes_spec.rb). Other application errors found, in both Vue versions unless noted:
Uncaught ReferenceError: _this12 is not defined(main.chunk.js): analytics dashboards, compliance dashboard, value streams dashboardUncaught ParametersMissing: Route missing required keys: id: Pages domains and Let's Encrypt settingsUncaught RangeError: Invalid time value: branches pageUncaught TypeError: Cannot read properties of null (reading 'text'): note comments, GFM autocomplete, design commentsUncaught TypeError: Cannot read properties of null (reading 'containsElement'): incident timeline events, work item statuses, service account tokensUncaught Error: No match for(Vue 3 jobs only): merge request list filtering and sortingCannot set properties of null (setting '__vnode')(Vue 3 jobs only): Rapid Diffs reply placeholder, andMerge request > Batch comments ... resolves the thread- Smaller groups:
GlTabsBehavior without an element,reading 'appendChild',reading 'value',reading 'filter',reading 'map',reading 'emitsOptions',$toolpop.show is not a function,reading 'clientWidth', several[Vue warn]: Invalid prop, ApolloMissing field 'humanTimeEstimate'
References
- Issue for the Rapid Diffs placeholder crash that motivated this change: #628791 (closed)
- Fix MR for that crash: !255075 (merged)
- Sibling MR that adds a full-mount Jest spec for the same bug class: !255198 (closed)
- Vue 3 migration MR of the MR Rapid Diffs page (merged, then reverted): !252389 (merged)
- Revert MR: !255026 (merged)
- Failing feature spec jobs that showed the symptom (
rspec system pg177/32 and 15/32): https://gitlab.com/gitlab-org/gitlab/-/jobs/16446513687 and https://gitlab.com/gitlab-org/gitlab/-/jobs/16446513695 - First reveal pipeline of this MR: https://gitlab.com/gitlab-org/gitlab/-/pipelines/2843011566
- Vue 3 migration (Code Review) epic: gitlab-org#23167
Screenshots or screen recordings
This MR has no UI change. Screenshots are not required.
How to set up and validate locally
Run a feature spec that has a known console error on master. For example:
bin/rspec spec/features/merge_request/user_comments_on_whitespace_hidden_diff_spec.rb:49This spec targets Rapid Diffs. Under Vue 2 it passes on master and logs TypeError: Cannot read properties of undefined (reading 'id'). With this MR, it fails with BrowserConsoleError and prints the console output. With the fix from !255075 (merged) applied, it passes again.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.