diff options
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/page/component/ci_badge_link.rb | 23 | ||||
-rw-r--r-- | qa/qa/page/project/job/show.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb | 20 |
3 files changed, 31 insertions, 14 deletions
diff --git a/qa/qa/page/component/ci_badge_link.rb b/qa/qa/page/component/ci_badge_link.rb index d3e44fd867d..ef9bfa560ce 100644 --- a/qa/qa/page/component/ci_badge_link.rb +++ b/qa/qa/page/component/ci_badge_link.rb @@ -5,7 +5,22 @@ module QA module Component module CiBadgeLink COMPLETED_STATUSES = %w[passed failed canceled blocked skipped manual].freeze # excludes created, pending, running - PASSED_STATUS = 'passed'.freeze + INCOMPLETE_STATUSES = %w[pending created running].freeze + + # e.g. def passed?(timeout: nil); status_badge == 'passed'; end + COMPLETED_STATUSES.map do |status| + define_method "#{status}?" do |timeout: nil| + timeout ? completed?(timeout: timeout) : completed? + status_badge == status + end + end + + # e.g. def pending?; status_badge == 'pending'; end + INCOMPLETE_STATUSES.map do |status| + define_method "#{status}?" do + status_badge == status + end + end def self.included(base) base.view 'app/assets/javascripts/vue_shared/components/ci_badge_link.vue' do @@ -17,12 +32,6 @@ module QA find_element(:status_badge).text end - def successful?(timeout: 60) - raise "Timed out waiting for the status to be a valid completed state" unless completed?(timeout: timeout) - - status_badge == PASSED_STATUS - end - private def completed?(timeout: 60) diff --git a/qa/qa/page/project/job/show.rb b/qa/qa/page/project/job/show.rb index d673efd1970..26db2f20c1b 100644 --- a/qa/qa/page/project/job/show.rb +++ b/qa/qa/page/project/job/show.rb @@ -21,7 +21,7 @@ module QA::Page raise "Timed out waiting for the build trace to load" unless loaded? raise "Timed out waiting for the status to be a valid completed state" unless completed?(timeout: timeout) - status_badge == PASSED_STATUS + passed? end # Reminder: You may wish to wait for a particular job status before checking output diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb index c036f188ea2..98c42f5803d 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb @@ -68,12 +68,20 @@ module QA Page::Project::Menu.perform(&:click_ci_cd_pipelines) Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline) - Page::Project::Pipeline::Show.perform do |pipeline| - expect(pipeline).to be_running(wait: max_wait) - expect(pipeline).to have_build('test-success', status: :success, wait: max_wait) - expect(pipeline).to have_build('test-failure', status: :failed, wait: max_wait) - expect(pipeline).to have_build('test-tags', status: :pending, wait: max_wait) - expect(pipeline).to have_build('test-artifacts', status: :success, wait: max_wait) + { + 'test-success': :passed, + 'test-failure': :failed, + 'test-tags': :pending, + 'test-artifacts': :passed + }.each do |job, status| + Page::Project::Pipeline::Show.perform do |pipeline| + pipeline.click_job(job) + end + + Page::Project::Job::Show.perform do |show| + expect(show).to public_send("be_#{status}") + show.click_element(:pipeline_path, Page::Project::Pipeline::Show) + end end end end |