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

show.rb « job « project « page « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2fb925b3930af248abaf2acfd98c0368f0659628 (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
# frozen_string_literal: true

module QA
  module Page
    module Project
      module Job
        class Show < QA::Page::Base
          include Component::CiBadgeLink

          view 'app/assets/javascripts/jobs/components/log/log.vue' do
            element :job_log_content
          end

          view 'app/assets/javascripts/jobs/components/stages_dropdown.vue' do
            element :pipeline_path, required: true
          end

          view 'app/assets/javascripts/jobs/components/sidebar.vue' do
            element :retry_button
          end

          view 'app/assets/javascripts/jobs/components/artifacts_block.vue' do
            element :browse_artifacts_button
          end

          def successful?(timeout: 60)
            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)

            job_log = find_element(:job_log_content).text
            QA::Runtime::Logger.debug(" \n\n ------- Job log: ------- \n\n #{job_log} \n -------")

            passed?
          end

          # Reminder: You may wish to wait for a particular job status before checking output
          def output(wait: 5)
            result = ''

            wait_until(reload: false, max_duration: wait, sleep_interval: 1) do
              result = find_element(:job_log_content).text

              result.include?('Job')
            end

            result
          end

          def has_browse_button?
            has_element? :browse_artifacts_button
          end

          def click_browse_button
            click_element :browse_artifacts_button
          end

          def retry!
            click_element :retry_button
          end

          def has_job_log?
            has_element? :job_log_content
          end

          def has_status?(status, wait: 30)
            wait_until(reload: false, max_duration: wait, sleep_interval: 1) do
              status_badge == status
            end
          end

          private

          def loaded?(wait: 60)
            wait_until(reload: true, max_duration: wait, sleep_interval: 1) do
              has_element?(:job_log_content, wait: 1)
            end
          end
        end
      end
    end
  end
end

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