From 1e16596601cd86a8c1ea81d78b4e59b6a8e136e2 Mon Sep 17 00:00:00 2001
From: Valerie Burton <vburton@gitlab.com>
Date: Mon, 24 Jul 2023 17:08:49 +0000
Subject: [PATCH] E2E: Fix Flaky Invite Group Search

---
 qa/qa/page/component/members/invite_members_modal.rb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/qa/qa/page/component/members/invite_members_modal.rb b/qa/qa/page/component/members/invite_members_modal.rb
index ae51213b3e25..876c5ba65b6e 100644
--- a/qa/qa/page/component/members/invite_members_modal.rb
+++ b/qa/qa/page/component/members/invite_members_modal.rb
@@ -59,6 +59,10 @@ def invite_group(group_name, access_level = 'Guest', refresh_page: true)
 
               Support::WaitForRequests.wait_for_requests
 
+              # Needed as a workaround to help avoid race condition with initial search request
+              # https://gitlab.com/gitlab-org/gitlab/-/issues/349379
+              sleep 2
+
               search_and_select(group_name)
 
               set_access_level(access_level)
-- 
GitLab