Commit 8cb772bc authored by Dylan Griffith's avatar Dylan Griffith

Fix waiting for spec failures in QA Build specs

The waiting logic on the build page was flaky or just not really
working. Waiting for the spinner to not be present seemed to not work
and we were regularly still seeing the spinner in our build failure
screenshots (eg.
https://gitlab.com/gitlab-org/gitlab-qa/-/jobs/161759351 )
parent 4a7948ea
...@@ -20,15 +20,19 @@ module QA::Page ...@@ -20,15 +20,19 @@ module QA::Page
element :pipeline_path element :pipeline_path
end end
def completed? def loaded?(wait: 60)
COMPLETED_STATUSES.include?(status_badge) has_element?(:build_trace, wait: wait)
end end
def successful?(timeout: 60) # Reminder: You should check #loaded? first
def completed?(timeout: 60)
wait(reload: false, max: timeout) do wait(reload: false, max: timeout) do
completed? && !trace_loading? COMPLETED_STATUSES.include?(status_badge)
end
end end
# Reminder: You should check #completed? and #loaded? first
def successful?
status_badge == PASSED_STATUS status_badge == PASSED_STATUS
end end
......
...@@ -95,7 +95,9 @@ module QA ...@@ -95,7 +95,9 @@ module QA
Page::Project::Pipeline::Show.perform(&:go_to_first_job) Page::Project::Pipeline::Show.perform(&:go_to_first_job)
Page::Project::Job::Show.perform do |job| Page::Project::Job::Show.perform do |job|
expect(job).to be_successful, "Job status did not become \"passed\"." expect(job).to be_loaded
expect(job).to be_completed
expect(job).to be_successful
expect(job.output).to include(sha1sum) expect(job.output).to include(sha1sum)
end end
end end
......
...@@ -73,7 +73,9 @@ module QA ...@@ -73,7 +73,9 @@ module QA
pipeline.go_to_job('build') pipeline.go_to_job('build')
end end
Page::Project::Job::Show.perform do |job| Page::Project::Job::Show.perform do |job|
expect(job).to be_sucessful(timeout: 600), "Job did not pass" expect(job).to be_loaded
expect(job).to be_completed(timeout: 600)
expect(job).to be_successful
job.click_element(:pipeline_path) job.click_element(:pipeline_path)
end end
...@@ -82,7 +84,9 @@ module QA ...@@ -82,7 +84,9 @@ module QA
pipeline.go_to_job('test') pipeline.go_to_job('test')
end end
Page::Project::Job::Show.perform do |job| Page::Project::Job::Show.perform do |job|
expect(job).to be_sucessful(timeout: 600), "Job did not pass" expect(job).to be_loaded
expect(job).to be_completed(timeout: 600)
expect(job).to be_successful
job.click_element(:pipeline_path) job.click_element(:pipeline_path)
end end
...@@ -91,7 +95,9 @@ module QA ...@@ -91,7 +95,9 @@ module QA
pipeline.go_to_job('production') pipeline.go_to_job('production')
end end
Page::Project::Job::Show.perform do |job| Page::Project::Job::Show.perform do |job|
expect(job).to be_sucessful(timeout: 1200), "Job did not pass" expect(job).to be_loaded
expect(job).to be_completed(timeout: 1200)
expect(job).to be_successful
job.click_element(:pipeline_path) job.click_element(:pipeline_path)
end end
...@@ -134,7 +140,9 @@ module QA ...@@ -134,7 +140,9 @@ module QA
pipeline.go_to_job('build') pipeline.go_to_job('build')
end end
Page::Project::Job::Show.perform do |job| Page::Project::Job::Show.perform do |job|
expect(job).to be_sucessful(timeout: 600), "Job did not pass" expect(job).to be_loaded
expect(job).to be_completed(timeout: 600)
expect(job).to be_successful
job.click_element(:pipeline_path) job.click_element(:pipeline_path)
end end
...@@ -143,7 +151,9 @@ module QA ...@@ -143,7 +151,9 @@ module QA
pipeline.go_to_job('test') pipeline.go_to_job('test')
end end
Page::Project::Job::Show.perform do |job| Page::Project::Job::Show.perform do |job|
expect(job).to be_sucessful(timeout: 600), "Job did not pass" expect(job).to be_loaded
expect(job).to be_completed(timeout: 600)
expect(job).to be_successful
job.click_element(:pipeline_path) job.click_element(:pipeline_path)
end end
...@@ -152,7 +162,9 @@ module QA ...@@ -152,7 +162,9 @@ module QA
pipeline.go_to_job('production') pipeline.go_to_job('production')
end end
Page::Project::Job::Show.perform do |job| Page::Project::Job::Show.perform do |job|
expect(job).to be_sucessful(timeout: 1200), "Job did not pass" expect(job).to be_loaded
expect(job).to be_completed(timeout: 1200)
expect(job).to be_successful
job.click_element(:pipeline_path) job.click_element(:pipeline_path)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment