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

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

require 'capybara/dsl'

module QA
  module Vendor
    module Jenkins
      module Page
        class ConfigureJob < Page::Base
          attr_accessor :job_name

          def initialize
            @path = "/job/#{@job_name}/configure"
          end

          def configure(scm_url:)
            set_git_source_code_management_url(scm_url)
            click_build_when_change_is_pushed_to_gitlab
            set_publish_status_to_gitlab
            click_save
          end

          private

          def set_git_source_code_management_url(repository_url)
            select_git_source_code_management
            set_repository_url(repository_url)
          end

          def click_build_when_change_is_pushed_to_gitlab
            find('label', text: 'Build when a change is pushed to GitLab').find(:xpath, "..").find('input').click
          end

          def set_publish_status_to_gitlab
            click_add_post_build_action
            select_publish_build_status_to_gitlab
          end

          def click_save
            click_on 'Save'
          end

          def select_git_source_code_management
            find('#radio-block-1').click
          end

          def set_repository_url(repository_url)
            find('.setting-name', text: "Repository URL").find(:xpath, "..").find('input').set repository_url
          end

          def click_add_post_build_action
            click_on "Add post-build action"
          end

          def select_publish_build_status_to_gitlab
            click_link "Publish build status to GitLab"
          end
        end
      end
    end
  end
end