summaryrefslogtreecommitdiff
path: root/qa/qa/flow/pipeline.rb
blob: 999f352e83467c4eaf4fbbc8a2a783e15388d7f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module QA
  module Flow
    module Pipeline
      module_function

      # In some cases we don't need to wait for anything, blocked, running or pending is acceptable
      # Some cases only we do need pipeline to finish with expected condition (completed, succeeded or replicated)
      def visit_latest_pipeline(pipeline_condition: nil)
        Page::Project::Menu.perform(&:click_ci_cd_pipelines)
        Page::Project::Pipeline::Index.perform(&:"wait_for_latest_pipeline_#{pipeline_condition}") if pipeline_condition
        Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline)
      end

      def wait_for_latest_pipeline(pipeline_condition:)
        Page::Project::Menu.perform(&:click_ci_cd_pipelines)
        Page::Project::Pipeline::Index.perform(&:"wait_for_latest_pipeline_#{pipeline_condition}")
      end
    end
  end
end