summaryrefslogtreecommitdiff
path: root/qa/qa/flow/pipeline.rb
blob: d19b2530bb897de9c652b200e564de113e2a399d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

module QA
  module Flow
    module Pipeline
      module_function

      # Acceptable statuses:
      # canceled, created, failed, manual, passed
      # pending, running, skipped
      def visit_latest_pipeline(status: nil, wait: nil, skip_wait: true)
        Page::Project::Menu.perform(&:click_ci_cd_pipelines)
        Page::Project::Pipeline::Index.perform do |index|
          index.has_any_pipeline?(wait: wait)
          index.wait_for_latest_pipeline(status: status, wait: wait) if status || !skip_wait
          index.click_on_latest_pipeline
        end
      end

      def wait_for_latest_pipeline(status: nil, wait: nil)
        Page::Project::Menu.perform(&:click_ci_cd_pipelines)
        Page::Project::Pipeline::Index.perform do |index|
          index.has_any_pipeline?(wait: wait)
          index.wait_for_latest_pipeline(status: status, wait: wait)
        end
      end
    end
  end
end