summaryrefslogtreecommitdiff
path: root/qa/qa/page/project/pipeline/show.rb
blob: 9c0b55b1c4cbc64e6f8047aa8f42f7f294728451 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
module QA::Page
  module Project::Pipeline
    class Show < QA::Page::Base
      view 'app/assets/javascripts/vue_shared/components/header_ci_component.vue' do
        element :pipeline_header, /header class.*ci-header-container.*/ # rubocop:disable QA/ElementWithPattern
      end

      view 'app/assets/javascripts/pipelines/components/graph/graph_component.vue' do
        element :pipeline_graph, /class.*pipeline-graph.*/ # rubocop:disable QA/ElementWithPattern
      end

      view 'app/assets/javascripts/pipelines/components/graph/job_item.vue' do
        element :job_component, /class.*ci-job-component.*/ # rubocop:disable QA/ElementWithPattern
        element :job_link
      end

      view 'app/assets/javascripts/vue_shared/components/ci_icon.vue' do
        element :status_icon, 'ci-status-icon-${status}' # rubocop:disable QA/ElementWithPattern
      end

      view 'app/views/projects/pipelines/_info.html.haml' do
        element :pipeline_badges
      end

      def running?
        within('.ci-header-container') do
          page.has_content?('running')
        end
      end

      def has_build?(name, status: :success, wait: nil)
        within('.pipeline-graph') do
          within('.ci-job-component', text: name) do
            has_selector?(".ci-status-icon-#{status}", { wait: wait }.compact)
          end
        end
      end

      def has_tag?(tag_name)
        within_element(:pipeline_badges) do
          has_selector?('.badge', text: tag_name)
        end
      end

      def click_job(job_name)
        find_element(:job_link, text: job_name).click
      end

      def click_on_first_job
        css = '.js-pipeline-graph-job-link'

        wait(reload: false) do
          has_css?(css)
        end

        first(css).click
      end
    end
  end
end