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

new_credentials.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: b0d13973090c30e78ceea531c93dc72b18e9636f (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
# frozen_string_literal: true

require 'capybara/dsl'

module QA
  module Vendor
    module Jenkins
      module Page
        class NewCredentials < Page::Base
          def initialize
            @path = 'credentials/store/system/domain/_/newCredentials'
          end

          def visit_and_set_gitlab_api_token(api_token, description)
            visit!
            wait_for_page_to_load
            select_gitlab_api_token
            set_api_token(api_token)
            set_description(description)
            click_ok
          end

          private

          def select_gitlab_api_token
            find('.setting-name', text: "Kind").find(:xpath, "..").find('select').select "GitLab API token"
          end

          def set_api_token(api_token)
            fill_in '_.apiToken', with: api_token
          end

          def set_description(description)
            fill_in '_.description', with: description
          end

          def click_ok
            click_on 'OK'
          end

          def wait_for_page_to_load
            QA::Support::Waiter.wait_until(sleep_interval: 1.0) do
              page.has_css?('.setting-name', text: "Description")
            end
          end
        end
      end
    end
  end
end