Skip to content

Copy failed spec names to clipboard from MR widget

Mireya Andres requested to merge copy-failed-spec-names into master

What does this MR do and why?

Adds an easy way to copy the path of all tests with failures so users can rerun them locally. The button can be found in the test results of the MR widget.

Also adds a copy-to-clipboard button for individual tests in the test case modal.

Screenshots or screen recordings

Copying test files:

Test Case Recording
Copy all failed specs Screen_Recording_2022-07-06_at_17.13.57
Copy individual spec files Screen_Recording_2022-07-06_at_17.14.17

Rendering Conditions:

Test Case Screenshot
Button should not show up when pipeline is successful no_errors
Button should not show up when data failed to load failed_to_load
Button should show up in the dropdown on smaller screens small_screens

How to set up and validate locally

Setup

  1. Enable the refactor_mr_widgets_extensions feature flag. (echo "Feature.disable(:refactor_mr_widgets_extensions)" | rails c)
  2. Set up your project to use unit test reports; or clone this project and set it up with GDK.
  3. Run a pipeline from the default branch.
  4. Edit files to make some tests fail then open a merge request.
  • If you cloned the above project, you can just create an MR from the failing-specs branch.
  1. Wait for the pipeline to finish.

Test Cases

  1. In the test reports of the MR page, click on the vertical ellipses next to the Full Report link. This should copy all the failing specs to your clipboard.
  2. Expand the tab and view an individual test case. In the modal, you should be able to copy the file path through the copy-to-clipboard button.

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 Mireya Andres

Merge request reports