Fix silently failing archive download button specs

What does this MR do and why?

Fix silently failing archive download button specs

Contributes to https://gitlab.com/gitlab-org/quality/quality-engineering/team-tasks/-/work_items/4183

Problem

The archive download buttons shared example used all(...).first do ... end which silently skipped all assertions because Capybara::Result#first ignores blocks.

The expected URLs also missed the ref_type query parameter added by the actual download_links helper in tree_helper.rb, and URI#path= failed when the path contained query parameters.

Solution

Replace all(...).first do ... end with direct find_by_testid calls. Add ref_type to the archive_path helper and each consumer spec.

Parse the archive path as a URI before assigning components, mirroring external_storage_url_or_path in application_helper.rb.

References

https://gitlab.com/gitlab-org/quality/quality-engineering/team-tasks/-/work_items/4183+

How to set up and validate locally

  1. bundle exec rspec --format documentation /Users/vasya/projects/gdk/gitlab/spec/features/projects/branches/download_buttons_spec.rb:39

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading