diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-04-21 01:18:18 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-04-21 01:18:18 +0800 |
commit | 0446419a83b6e2641b5d1356f36945017102e97c (patch) | |
tree | 396ec177f9de9696b58010b7418d8a5b8ced59b3 /qa | |
parent | f718ccf2025765cdf631a105b093fcfd72ea8cae (diff) | |
download | gitlab-ce-0446419a83b6e2641b5d1356f36945017102e97c.tar.gz |
Use qa selectors for secret variables
The problem of using .js-ci-variable-input-value is that,
whenever the value is hidden, then this selector won't be set,
instead, .js-secret-value-placeholder would be set.
If we just fill the value, the value is revealed. But if
we visit this later, the values were be hidden. This means
we don't have a consistent way to count the values.
Adding an unique qa selector to both revealed and hidden
values would make it easier to track the values.
To make it look more consistent, let's also do the same
for the key.
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/page/project/settings/secret_variables.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/qa/qa/page/project/settings/secret_variables.rb b/qa/qa/page/project/settings/secret_variables.rb index 89f1424a5fa..ba3633cff9e 100644 --- a/qa/qa/page/project/settings/secret_variables.rb +++ b/qa/qa/page/project/settings/secret_variables.rb @@ -7,10 +7,8 @@ module QA 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' + element :variable_key, '.qa-ci-variable-input-key' + element :variable_value, '.qa-ci-variable-input-value' end view 'app/views/ci/variables/_index.html.haml' do @@ -19,10 +17,13 @@ module QA end def fill_variable(key, value) - all('.js-ci-variable-input-key')[-1].set(key) + keys = all('.qa-ci-variable-input-key') + index = keys.size - 1 + # After we fill the key, JS would generate another field so - # we need to fill the one before last one instead of last one - all('.js-ci-variable-input-value')[-2].set(value) + # we need to use the same index to find the corresponding one. + keys[index].set(key) + all('.qa-ci-variable-input-value')[index].set(value) end def save_variables @@ -35,7 +36,7 @@ module QA def variable_value(key) within('.ci-variable-row-body', text: key) do - find('.js-ci-variable-input-value').value + find('.qa-ci-variable-input-value').value end end end |