Skip to content

Hide copy failed tests button when endpoint returns null files

Mireya Andres requested to merge fix-copy-failed-specs-bug into master

What does this MR do and why?

This fixes a bug where the Copy failed tests button still shows up when there are no failed test files.

You can see this bug in action in gitlab-org/security-products/analyzers/gosec!158 (merged). When you click on the button, you will only copy a space character " ". This is because the code works by creating an array of test files and concatenating it with the space character.

Screen_Shot_2022-08-17_at_14.53.37

In this case, the endpoint that fetches the failures returns null for suites.new_failures.file. So our failed test array would be [null, null] which ends up as the string " ".

Technically the endpoint data is correct since what's really happening is that the tests were incorrectly marked as failed. However, to avoid confusion in the future for similar cases, we should hide the button anyway if there are no failing test files.

Screenshots or screen recordings

How to set up and validate locally

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