Migrate repository fork suggestion Capybara specs to MSW
What does this MR do and why?
Migrates the repository header's fork suggestion modal coverage, plus the archived-project and binary-file edit restrictions, from Capybara feature specs to MSW frontend integration tests in the repository domain, following the audit in work item 631165.
The fork suggestion modal was opened in 7 Capybara examples across 4 feature specs, each creating a real fork through the UI. The modal routing is frontend logic driven by getBlobControls, so those assertions move to MSW, and one Capybara example (commits an edited file in a forked project) keeps covering real fork creation end to end.
The MSW side adds three recorded getBlobControls fixtures (reporter/non-writable, archived project, binary blob) with purpose-guarding assertions in the generator, NON_WRITABLE/ARCHIVED fixture variants (the binary response stays a request-derived filePath match-table entry), and portal-aware Edit-dropdown finders in the domain test setup.
Coverage parity
| Removed Capybara example | Replacement |
|---|---|
user_edits_files: archived shared example (×2 contexts) |
MSW: archived project disables Edit and hides Replace/Delete. The role difference between the two contexts lives in the recorded response of the same query; the frontend branch is identical |
user_edits_files: binary file has no edit link |
MSW: binary blob offers the Web IDE but not the single file editor |
user_edits_files: inserts content in a forked project |
MSW: fork modal from Edit single file; the fork-then-edit flow stays covered by the kept example |
user_edits_files: opens the Web IDE in a forked project |
MSW: fork modal from the Web IDE action. Accepted loss: the real-browser "Web IDE opens the fork in a new tab" assertion |
user_edits_files: commits a renamed file in a forked project |
Rename covered by the non-fork rename example; fork flow by the kept example |
user_deletes_files: deletes the file in a forked project |
MSW: fork modal from Delete; delete-in-fork commit stays covered by the EE pre-created-fork example |
user_replaces_files: replaces a file in a forked project |
MSW: fork modal from Replace; the replace commit flow stays covered by the maintainer and protected-branch examples |
EE user_deletes_or_replaces_files: replaces in a fork from a non-default branch |
MSW: fork modal from Replace; the lock-on-non-default-branch behavior is already MSW-covered in path_locks_blob_spec.js |
Kept: user_edits_files commits an edited file in a forked project — the single Capybara example that actually creates a fork (fork prompt → fork → edit → commit → MR).
Before/after
| Before | After | |
|---|---|---|
| Capybara examples | 9 removed (~13s median each per knapsack report-master; the 5 fork examples are heavier — real fork via Gitaly + Sidekiq) | 1 kept real-fork example |
| MSW tests | — | 7 (~9s locally for both suites, Vue 2 and Vue 3 green) |
Estimated shave ≈120–180s of Capybara runtime per full pipeline; the Test Result Summary comment will report the exact RSpec vs Jest numbers once CI runs.
References
- Audit / tracking: #631165 (closed)
- Create domain migration issue: #627564 (closed)
Screenshots or screen recordings
Test-only change; no UI changes.
How to set up and validate locally
Test-only change — the jest-integration and rspec-all frontend_fixture CI jobs exercise it; no manual setup applies.
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.