Commit 39bddd38 authored by Michael Kozono's avatar Michael Kozono

Succeed or fail fast based on job status first

Also, move wait block into the correct page block.
parent 09747ecd
module QA::Page module QA::Page
module Project::Job module Project::Job
class Show < QA::Page::Base class Show < QA::Page::Base
COMPLETED_STATUSES = %w[passed failed canceled blocked skipped manual].freeze # excludes created, pending, running
PASSED_STATUS = 'passed'.freeze
view 'app/views/projects/jobs/show.html.haml' do view 'app/views/projects/jobs/show.html.haml' do
element :build_output, '.js-build-output' element :build_output, '.js-build-output'
end end
def output view 'app/assets/javascripts/vue_shared/components/ci_badge_link.vue' do
css = '.js-build-output' element :status_badge, 'ci-status'
end
wait(reload: false) do def completed?
has_css?(css) COMPLETED_STATUSES.include? find('.ci-status').text
end end
find(css).text def passed?
find('.ci-status').text == PASSED_STATUS
end
# Reminder: You may wish to wait for a particular job status before checking output
def output
find('.js-build-output').text
end end
end end
end end
......
...@@ -87,16 +87,12 @@ module QA ...@@ -87,16 +87,12 @@ module QA
Page::Project::Show.act { wait_for_push } Page::Project::Show.act { wait_for_push }
Page::Menu::Side.act { click_ci_cd_pipelines } Page::Menu::Side.act { click_ci_cd_pipelines }
Page::Project::Pipeline::Index.act { go_to_latest_pipeline } Page::Project::Pipeline::Index.act { go_to_latest_pipeline }
Page::Project::Pipeline::Show.act { go_to_first_job }
Page::Project::Pipeline::Show.act do
go_to_first_job
wait do
!has_content?('running')
end
end
Page::Project::Job::Show.perform do |job| Page::Project::Job::Show.perform do |job|
job.wait(reload: false) { job.completed? }
expect(job.passed?).to be_truthy, "Job status did not become \"passed\"."
expect(job.output).to include(sha1sum) expect(job.output).to include(sha1sum)
end end
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