summaryrefslogtreecommitdiff
path: root/qa/qa/page/project/settings/secret_variables.rb
blob: c95c79f137d975810889939fc8a5483c9da6f09b (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
module QA
  module Page
    module Project
      module Settings
        class SecretVariables < Page::Base
          include Common

          view 'app/views/ci/variables/_variable_row.html.haml' do
            element :variable_row, '.ci-variable-row-body'
            element :variable_key, '.js-ci-variable-input-key'
            element :variable_value, '.js-ci-variable-input-value'
            element :key_placeholder, 'Input variable key'
            element :value_placeholder, 'Input variable value'
          end

          view 'app/views/ci/variables/_index.html.haml' do
            element :save_variables, '.js-secret-variables-save-button'
            element :reveal_values, '.js-secret-value-reveal-button'
          end

          def fill_variable_key(key)
            fill_in('Input variable key', with: key, match: :first)
          end

          def fill_variable_value(value)
            fill_in('Input variable value', with: value, match: :first)
          end

          def save_variables
            find('.js-secret-variables-save-button').click
          end

          def reveal_variables
            find('.js-secret-value-reveal-button').click
          end

          def variable_value(key)
            within('.ci-variable-row-body', text: key) do
              find('.js-ci-variable-input-value').value
            end
          end
        end
      end
    end
  end
end