diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-01-22 11:25:14 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-01-22 11:25:14 +0300 |
commit | 4b1da8502f4625116447014b18adc7e1986e038e (patch) | |
tree | 66e944b8a56e3f36cecc7b683246460ce0220cee /qa | |
parent | 05d986065b48b325be763c287c96af4b48b0cc16 (diff) |
Also test if the fingerprint is correct
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/factory/resource/deploy_key.rb | 6 | ||||
-rw-r--r-- | qa/qa/page/base.rb | 16 | ||||
-rw-r--r-- | qa/qa/page/project/settings/deploy_keys.rb | 22 | ||||
-rw-r--r-- | qa/qa/specs/features/project/add_deploy_key_spec.rb | 4 |
4 files changed, 42 insertions, 6 deletions
diff --git a/qa/qa/factory/resource/deploy_key.rb b/qa/qa/factory/resource/deploy_key.rb index 671114d38b1..d161e57ec99 100644 --- a/qa/qa/factory/resource/deploy_key.rb +++ b/qa/qa/factory/resource/deploy_key.rb @@ -10,6 +10,12 @@ module QA end end + product :fingerprint do + Page::Project::Settings::Repository.act do + expand_deploy_keys(&:key_fingerprint) + end + end + dependency Factory::Resource::Project, as: :project do |project| project.name = 'project-to-deploy' project.description = 'project for adding deploy key test' diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index ea4c920c82c..81ba80cdbaf 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -41,7 +41,21 @@ module QA end def click_element(name) - find(Page::Element.new(name).selector_css).click + find_element(name).click + end + + def find_element(name) + find(element_selector_css(name)) + end + + def within_element(name) + page.within(element_selector_css(name)) do + yield + end + end + + def element_selector_css(name) + Page::Element.new(name).selector_css end def self.path diff --git a/qa/qa/page/project/settings/deploy_keys.rb b/qa/qa/page/project/settings/deploy_keys.rb index f9e40bf4252..332e84724c7 100644 --- a/qa/qa/page/project/settings/deploy_keys.rb +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -14,8 +14,8 @@ module QA end view 'app/assets/javascripts/deploy_keys/components/key.vue' do - element :key_title, /class=".*title.*"/ - element :key_title_field, '{{ deployKey.title }}' + element :key_title, /class=".*qa-key-title.*"/ + element :key_fingerprint, /class=".*qa-key-fingerprint.*"/ end def fill_key_title(title) @@ -31,8 +31,22 @@ module QA end def key_title - page.within('.qa-project-deploy-keys') do - page.find('.title').text + within_project_deploy_keys do + find_element(:key_title).text + end + end + + def key_fingerprint + within_project_deploy_keys do + find_element(:key_fingerprint).text + end + end + + private + + def within_project_deploy_keys + within_element(:project_deploy_keys) do + yield end end end diff --git a/qa/qa/specs/features/project/add_deploy_key_spec.rb b/qa/qa/specs/features/project/add_deploy_key_spec.rb index 54852bfce4d..67d302a5593 100644 --- a/qa/qa/specs/features/project/add_deploy_key_spec.rb +++ b/qa/qa/specs/features/project/add_deploy_key_spec.rb @@ -1,7 +1,8 @@ module QA feature 'deploy keys support', :core do + given(:key) { Runtime::RSAKey.new } given(:deploy_key_title) { 'deploy key title' } - given(:deploy_key_value) { Runtime::RSAKey.new.public_key } + given(:deploy_key_value) { key.public_key } scenario 'user adds a deploy key' do Runtime::Browser.visit(:gitlab, Page::Main::Login) @@ -13,6 +14,7 @@ module QA end expect(deploy_key.title).to eq(deploy_key_title) + expect(deploy_key.fingerprint).to eq(key.fingerprint) end end end |