Welcome to mirror list, hosted at ThFree Co, Russian Federation.

show.rb « pipeline « project « page « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 151df85af3df4d050806f66761b0385c466d24ed (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# frozen_string_literal: true

module QA
  module Page
    module Project
      module Pipeline
        class Show < QA::Page::Base
          include Component::CiIcon

          view 'app/assets/javascripts/ci/pipeline_details/header/pipeline_details_header.vue' do
            element 'pipeline-details-header', required: true
          end

          view 'app/assets/javascripts/ci/pipeline_details/graph/components/job_item.vue' do
            element 'job-with-link', required: true
          end

          view 'app/assets/javascripts/ci/common/private/job_action_component.vue' do
            element 'ci-action-button'
          end

          view 'app/assets/javascripts/ci/pipeline_details/graph/components/linked_pipeline.vue' do
            element 'expand-pipeline-button'
            element 'linked-pipeline-container'
            element 'downstream-title-content'
          end

          view 'app/assets/javascripts/ci/pipeline_details/graph/components/job_group_dropdown.vue' do
            element 'job-dropdown-container'
            element 'jobs-dropdown-menu'
          end

          view 'app/assets/javascripts/ci/pipeline_details/graph/components/stage_column_component.vue' do
            element 'job-item-container', required: true
          end

          def running?(wait: 0)
            within_element('pipeline-details-header') do
              page.has_content?('running', wait: wait)
            end
          end

          def has_build?(name, status: :success, wait: nil)
            if status
              within_element('job-item-container', text: name) do
                has_selector?("[data-testid='status_#{status}_borderless-icon']", **{ wait: wait }.compact)
              end
            else
              has_element?('job-item-container', text: name)
            end
          end

          def has_job?(job_name)
            has_element?('job-with-link', text: job_name)
          end

          def has_no_job?(job_name)
            has_no_element?('job-with-link', text: job_name)
          end

          def linked_pipelines
            all_elements('linked-pipeline-container', minimum: 1)
          end

          def find_linked_pipeline_by_title(title)
            linked_pipelines.find do |pipeline|
              within(pipeline) do
                find_element('downstream-title-content').text.include?(title)
              end
            end
          end

          def has_linked_pipeline?(title: nil)
            # If the pipeline page has loaded linked pipelines should appear, but it can take a little while,
            # especially on busier environments.
            retry_until(reload: true, message: 'Waiting for linked pipeline to appear') do
              title ? find_linked_pipeline_by_title(title) : has_element?('linked-pipeline-container')
            end
          end

          alias_method :has_child_pipeline?, :has_linked_pipeline?

          def has_no_linked_pipeline?
            has_no_element?('linked-pipeline-container')
          end

          alias_method :has_no_child_pipeline?, :has_no_linked_pipeline?

          def expand_linked_pipeline(title: nil)
            linked_pipeline = title ? find_linked_pipeline_by_title(title) : linked_pipelines.first

            within_element_by_index('linked-pipeline-container', linked_pipelines.index(linked_pipeline)) do
              click_element('expand-pipeline-button')
            end
          end

          alias_method :expand_child_pipeline, :expand_linked_pipeline

          def click_on_first_job
            first('.js-pipeline-graph-job-link', wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME).click
          end

          def click_job(job_name)
            # Retry due to transient bug https://gitlab.com/gitlab-org/gitlab/-/issues/347126
            QA::Support::Retrier.retry_on_exception do
              click_element('job-with-link', Project::Job::Show, text: job_name)
            end
          end

          def click_job_action(job_name)
            wait_for_requests

            within_element('job-item-container', text: job_name) do
              click_element('ci-action-button')
            end
          end

          def click_job_dropdown(job_dropdown_name)
            click_element('job-dropdown-container', text: job_dropdown_name)
          end

          def has_skipped_job_in_group?
            within_element('jobs-dropdown-menu') do
              all_elements('job-with-link', minimum: 1).all? do
                has_selector?('.ci-status-icon-skipped')
              end
            end
          end

          def has_no_skipped_job_in_group?
            within_element('jobs-dropdown-menu') do
              all_elements('job-with-link', minimum: 1).all? do
                has_no_selector?('.ci-status-icon-skipped')
              end
            end
          end
        end
      end
    end
  end
end

QA::Page::Project::Pipeline::Show.prepend_mod_with('Page::Project::Pipeline::Show', namespace: QA)