Skip to content

Add details to test summary merge request report widget

Miranda Fluharty requested to merge 351258-test-summary-widget-details into master

What does this MR do and why?

For #351258 (closed): This MR covers that issue except for the modal, which is to say it adds

  • the list of failed/fixed tests at level three of the widget and
  • the messages about recently failed tests to the widget (N out of M failed tests failed more than once in the last 14 days and Failed N times in main in the last 14 days)

The test case names won't be styled like links (as they are in the mockup) because they don't open a modal yet.

For #358184 (closed): this MR also puts this widget refactor behind the refactor_mr_widget_test_summary feature flag to avoid delaying the rollout of other widgets while we figure out modal support.

Screenshots or screen recordings

Screen_Recording_2022-04-08_at_21.14.51

before (from the last iteration) after (with this MR)
Screen_Shot_2022-04-08_at_12.26.24 Screen_Shot_2022-04-07_at_20.50.43 (screenshot modified to show full content)
reference: old widget reference: mockup from figma
Screen_Shot_2022-04-08_at_17.47.21 Screen_Shot_2022-04-08_at_16.42.55

How to set up and validate locally

  1. git checkout 351258-test-summary-widget-details
  2. echo "Feature.enable(:refactor_mr_widget_test_summary)" | rails c
  3. set up unit test reports for a project OR clone this test project
  4. open a merge request in the project that changes the results of some tests relative to the target/main branch
  5. run pipelines for the merge request's branch and the target/main branch to generate test report artifacts
  6. accumulate some recent test failures in the target/main branch of the project OR apply this patch to mock some random numbers in as recent failure data for testing:
diff --git a/lib/gitlab/ci/reports/test_case.rb b/lib/gitlab/ci/reports/test_case.rb
index 09121191047..c0de16fda3c 100644
--- a/lib/gitlab/ci/reports/test_case.rb
+++ b/lib/gitlab/ci/reports/test_case.rb
@@ -24,7 +24,7 @@ def initialize(params)
           @attachment = params.fetch(:attachment, nil)
           @job = params.fetch(:job, nil)
 
-          @recent_failures = nil
+          @recent_failures = { count: rand(0..(rand(0..7))), base_branch: "main" }
 
           @key = hash_key("#{suite_name}_#{classname}_#{name}")
         end

Caveat with this patch: since it's random, it might assign recent failures to tests that haven't failed; with real data, recent failure data is only surfaced for failed tests

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 Miranda Fluharty

Merge request reports