Commit 14b8fd9d authored by Mark Lapierre's avatar Mark Lapierre

Merge branch '57921-qa-auto-devops-improvements' into 'master'

Refactor/simplify Auto DevOps QA spec

Closes #57921

See merge request gitlab-org/gitlab-ce!25401
parents b570f53d 2aea7878
...@@ -4,10 +4,6 @@ module QA::Page ...@@ -4,10 +4,6 @@ module QA::Page
COMPLETED_STATUSES = %w[passed failed canceled blocked skipped manual].freeze # excludes created, pending, running COMPLETED_STATUSES = %w[passed failed canceled blocked skipped manual].freeze # excludes created, pending, running
PASSED_STATUS = 'passed'.freeze PASSED_STATUS = 'passed'.freeze
view 'app/assets/javascripts/jobs/components/job_app.vue' do
element :loading_animation
end
view 'app/assets/javascripts/jobs/components/job_log.vue' do view 'app/assets/javascripts/jobs/components/job_log.vue' do
element :build_trace element :build_trace
end end
...@@ -20,26 +16,13 @@ module QA::Page ...@@ -20,26 +16,13 @@ module QA::Page
element :pipeline_path element :pipeline_path
end end
def loaded?(wait: 60) def successful?(timeout: 60)
has_element?(:build_trace, wait: wait) raise "Timed out waiting for the build trace to load" unless loaded?
end raise "Timed out waiting for the status to be a valid completed state" unless completed?(timeout: timeout)
# Reminder: You should check #loaded? first
def completed?(timeout: 60)
wait(reload: false, max: timeout) do
COMPLETED_STATUSES.include?(status_badge)
end
end
# Reminder: You should check #completed? and #loaded? first
def successful?
status_badge == PASSED_STATUS status_badge == PASSED_STATUS
end end
def trace_loading?
has_element?(:loading_animation)
end
# Reminder: You may wish to wait for a particular job status before checking output # Reminder: You may wish to wait for a particular job status before checking output
def output def output
find_element(:build_trace).text find_element(:build_trace).text
...@@ -47,6 +30,16 @@ module QA::Page ...@@ -47,6 +30,16 @@ module QA::Page
private private
def loaded?(wait: 60)
has_element?(:build_trace, wait: wait)
end
def completed?(timeout: 60)
wait(reload: false, max: timeout) do
COMPLETED_STATUSES.include?(status_badge)
end
end
def status_badge def status_badge
find_element(:status_badge).text find_element(:status_badge).text
end end
......
...@@ -95,8 +95,6 @@ module QA ...@@ -95,8 +95,6 @@ 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_loaded
expect(job).to be_completed
expect(job).to be_successful expect(job).to be_successful
expect(job.output).to include(sha1sum) expect(job.output).to include(sha1sum)
end end
......
...@@ -73,9 +73,7 @@ module QA ...@@ -73,9 +73,7 @@ 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_loaded expect(job).to be_successful(timeout: 600)
expect(job).to be_completed(timeout: 600)
expect(job).to be_successful
job.click_element(:pipeline_path) job.click_element(:pipeline_path)
end end
...@@ -84,9 +82,7 @@ module QA ...@@ -84,9 +82,7 @@ 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_loaded expect(job).to be_successful(timeout: 600)
expect(job).to be_completed(timeout: 600)
expect(job).to be_successful
job.click_element(:pipeline_path) job.click_element(:pipeline_path)
end end
...@@ -95,9 +91,7 @@ module QA ...@@ -95,9 +91,7 @@ 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_loaded expect(job).to be_successful(timeout: 1200)
expect(job).to be_completed(timeout: 1200)
expect(job).to be_successful
job.click_element(:pipeline_path) job.click_element(:pipeline_path)
end end
...@@ -140,9 +134,7 @@ module QA ...@@ -140,9 +134,7 @@ 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_loaded expect(job).to be_successful(timeout: 600)
expect(job).to be_completed(timeout: 600)
expect(job).to be_successful
job.click_element(:pipeline_path) job.click_element(:pipeline_path)
end end
...@@ -151,9 +143,7 @@ module QA ...@@ -151,9 +143,7 @@ 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_loaded expect(job).to be_successful(timeout: 600)
expect(job).to be_completed(timeout: 600)
expect(job).to be_successful
job.click_element(:pipeline_path) job.click_element(:pipeline_path)
end end
...@@ -162,9 +152,7 @@ module QA ...@@ -162,9 +152,7 @@ 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_loaded expect(job).to be_successful(timeout: 1200)
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