summaryrefslogtreecommitdiff
path: root/qa/qa/page/project/settings/deploy_keys.rb
blob: 211699599e1f63c776820b66e3f4ca86002b6195 (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
module QA
  module Page
    module Project
      module Settings
        class DeployKeys < Page::Base
          view 'app/views/projects/deploy_keys/_form.html.haml' do
            element :deploy_key_title, 'text_field :title'
            element :deploy_key_key, 'text_area :key'
          end

          view 'app/assets/javascripts/deploy_keys/components/app.vue' do
            element :deploy_keys_section, /class=".*deploy\-keys.*"/
          end

          view 'app/assets/javascripts/deploy_keys/components/key.vue' do
            element :key_title, /class=".*title.*"/
            element :key_title_field, '{{ deployKey.title }}'
          end

          def fill_key_title(title)
            fill_in 'deploy_key_title', with: title
          end

          def fill_key_value(key)
            fill_in 'deploy_key_key', with: key
          end

          def add_key
            click_on 'Add key'
          end

          def key_title
            page.within('.deploy-keys') do
              # The instance might have public keys available, here we want
              # the one from the project
              page.first('.title').text
            end
          end
        end
      end
    end
  end
end