Loading
Fix flaky protected branches spec form submission race
What does this MR do and why?
Fixes two flaky example blocks.
Error: undefined method `code_owner_approval_required' for nil.
Root cause: Race condition. submit_form (line 116-119) clicks "Protect" + wait_for_requests, then the test immediately reads the DB via find_by_name. wait_for_requests doesn't guarantee the create request finished/committed, so find_by_name can return nil → undefined method code_owner_approval_required for nil.
Fix: After submitting, add a Capybara UI wait for the branch to appear in the list before the DB query.
References
- Related to gitlab-org/quality/analytics/ci-health-incidents#1206 (closed)
- Related to https://gitlab.com/gitlab-org/quality/test-failure-issues/-/work_items/44329
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
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.
Edited by Fred Reinink