Fix flakiness in user_suggests_changes_on_diff_spec

What does this MR do and why?

spec/features/merge_request/user_suggests_changes_on_diff_spec.rb is the top flaky-test offender for ~"group::code review" over the last 30 days (flaky tests dashboard), with three examples quarantined in #601810.

Root cause

All three quarantined examples shared the same race in the Apply suggestion flow. The spec clicked the Apply suggestion dropdown toggle and then immediately clicked Apply — but Apply lives inside the disclosure dropdown panel (apply_suggestion.vue), which renders asynchronously after the toggle. When the second click landed before the panel mounted, the test failed.

What this MR changes

  • Fixes the race (root cause): introduces an apply_suggestion helper that clicks the toggle, waits for the commit-message field to confirm the dropdown is open, then clicks Apply. All five apply call sites now use it.
  • Hardens other flaky patterns flagged by the testing guidelines:
    • Replaces all(...).first.click / all[idx] with a waiting have_css(..., count:) matcher before indexing.
    • Replaces find('.js-...').click with semantic find_by_testid finders.
    • Routes the reply-field value assertion through a waiting finder.
  • Removes the quarantine tags from the three previously-flaky examples so they run in CI again.

Test plan

Verified locally — the full file passes, including the three formerly-quarantined examples (quarantined tests run locally since !ENV['CI']):

12 examples, 0 failures

Run twice to check for residual flakiness; both green. RuboCop and commit-message lint clean.

How to set up and validate locally

bundle exec rspec spec/features/merge_request/user_suggests_changes_on_diff_spec.rb

MR acceptance checklist

Merge request reports

Loading