Skip to content

Add waiting for requests after posting a comment in commit_spec.rb

Nao Hashizume requested to merge 386199-fix-flaky-commit_spec into master

What does this MR do and why?

This MR adds wait_for_requests after the click to post a comment. The test would occasionally fail because, prior to this fix, the assertion was made without first waiting for "My comment" to be present, and instead used a discussion that is above that comment.

Related to #386199 (closed) and gitlab-org/quality/engineering-productivity/master-broken-incidents#454 (closed)

Sample failure

1) Thread Comments Commit behaves like thread comments for commit and snippet clicking "Comment" will post a comment
  Got 1 failure and 1 other error:
  Shared Example Group: "thread comments for commit and snippet" called from ./spec/features/discussion_comments/commit_spec.rb:21
  1.1) Failure/Error: expect(new_comment).not_to have_selector '.discussion'
          expected not to find visible css ".discussion" within #<Capybara::Node::Element tag="li" path="/HTML/BODY[1]/DIV[3]/DIV[1]/DIV[3]/MAIN[1]/DIV[2]/DIV[7]/UL[1]/LI[1]">, found 1 match: "Sidney Jones5\n@namespace3 started a thread just now\nLast updated by Sidney Jones6 just now\nHide thread\nSidney Jones5 @namespace3\n· just now\nOwner\nMy title 3\nSidney Jones6 @namespace4\n· just now\nMy title 4\nReply..."
          Timeout (30s) reached while running a waiting Capybara finder.

How to set up and validate locally

Run bundle exec rspec 'spec/features/discussion_comments/commit_spec.rb[1:1:1]' in this branch.

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 Nao Hashizume

Merge request reports