Fix flaky spec/features/projects/environments/environments_spec.rb
What does this MR do and why?
Previously this test would attempt to play a job in the environments
page, but it did not actually wait for the GraphQL request to be sent.
Now we wait for the transition from spinner back to play icon to
ensure the request to JobsController#play
has completed.
Closes #362880 (closed)
How to set up and validate locally
- Add a delay for
JobsController#play
:
diff --git a/app/controllers/projects/jobs_controller.rb b/app/controllers/projects/jobs_controller.rb
index 557ac5667339..28a04c1a1e09 100644
--- a/app/controllers/projects/jobs_controller.rb
+++ b/app/controllers/projects/jobs_controller.rb
@@ -90,6 +90,8 @@ def play
job = @build.play(current_user, play_params[:job_variables_attributes])
+ sleep 3
+
if job.is_a?(Ci::Bridge)
redirect_to pipeline_path(job.pipeline)
else
- Run
bundle exec rspec ./spec/features/projects/environments/environments_spec.rb:342
.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Stan Hu