summaryrefslogtreecommitdiff
path: root/qa/qa/page/project/job/show.rb
blob: 83bb224b5c34609581acbd30f62d2b6ca8f4034e (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
module QA::Page
  module Project::Job
    class Show < QA::Page::Base
      COMPLETED_STATUSES = %w[passed failed canceled blocked skipped manual].freeze # excludes created, pending, running
      PASSED_STATUS = 'passed'.freeze

      view 'app/views/projects/jobs/show.html.haml' do
        element :build_output, '.js-build-output'
      end

      view 'app/assets/javascripts/vue_shared/components/ci_badge_link.vue' do
        element :status_badge, 'ci-status'
      end

      def completed?
        COMPLETED_STATUSES.include? find('.ci-status').text
      end

      def passed?
        find('.ci-status').text == PASSED_STATUS
      end

      # Reminder: You may wish to wait for a particular job status before checking output
      def output
        find('.js-build-output').text
      end
    end
  end
end