From c75f3e85a3811910ec1dc0ac931e1e61822bc166 Mon Sep 17 00:00:00 2001
From: Harsha Muralidhar <hmuralidhar@gitlab.com>
Date: Tue, 22 Oct 2024 08:02:25 +0000
Subject: [PATCH] Add wait for pipeline success to stabilise vulnerability spec

---
 .../browser_ui/10_govern/resolve_this_vulnerability_spec.rb   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/qa/qa/specs/features/ee/browser_ui/10_govern/resolve_this_vulnerability_spec.rb b/qa/qa/specs/features/ee/browser_ui/10_govern/resolve_this_vulnerability_spec.rb
index 1f88dcfaee553..1f81eba32983a 100644
--- a/qa/qa/specs/features/ee/browser_ui/10_govern/resolve_this_vulnerability_spec.rb
+++ b/qa/qa/specs/features/ee/browser_ui/10_govern/resolve_this_vulnerability_spec.rb
@@ -72,6 +72,9 @@ module QA
       it 'checks resolve vulnerability with MR AI feature', :aggregate_failures,
         testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/482996' do
         commit_test_sast_reports
+        Flow::Pipeline.wait_for_pipeline_creation_via_api(project: project)
+        expect { project.latest_pipeline[:status] }.to eventually_eq('success').within(max_duration: 90)
+
         resolve_this_vulnerability(vuln_name)
 
         QA::Support::Retrier.retry_on_exception(max_attempts: 10, sleep_interval: 1,
@@ -91,7 +94,6 @@ module QA
       def resolve_this_vulnerability(vulnerability_name)
         Page::Project::Menu.perform(&:go_to_vulnerability_report)
         EE::Page::Project::Secure::SecurityDashboard.perform do |security_dashboard|
-          security_dashboard.wait_for_vuln_report_to_load
           security_dashboard.click_vulnerability(description: vulnerability_name)
         end
         EE::Page::Project::Secure::VulnerabilityDetails.perform(&:resolve_this_vulnerability)
-- 
GitLab