Commit 4b1da850 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Also test if the fingerprint is correct

parent 05d98606
...@@ -53,10 +53,10 @@ ...@@ -53,10 +53,10 @@
</i> </i>
</div> </div>
<div class="deploy-key-content key-list-item-info"> <div class="deploy-key-content key-list-item-info">
<strong class="title"> <strong class="title qa-key-title">
{{ deployKey.title }} {{ deployKey.title }}
</strong> </strong>
<div class="description"> <div class="description qa-key-fingerprint">
{{ deployKey.fingerprint }} {{ deployKey.fingerprint }}
</div> </div>
</div> </div>
......
...@@ -10,6 +10,12 @@ module QA ...@@ -10,6 +10,12 @@ module QA
end end
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| dependency Factory::Resource::Project, as: :project do |project|
project.name = 'project-to-deploy' project.name = 'project-to-deploy'
project.description = 'project for adding deploy key test' project.description = 'project for adding deploy key test'
......
...@@ -41,7 +41,21 @@ module QA ...@@ -41,7 +41,21 @@ module QA
end end
def click_element(name) 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 end
def self.path def self.path
......
...@@ -14,8 +14,8 @@ module QA ...@@ -14,8 +14,8 @@ module QA
end end
view 'app/assets/javascripts/deploy_keys/components/key.vue' do view 'app/assets/javascripts/deploy_keys/components/key.vue' do
element :key_title, /class=".*title.*"/ element :key_title, /class=".*qa-key-title.*"/
element :key_title_field, '{{ deployKey.title }}' element :key_fingerprint, /class=".*qa-key-fingerprint.*"/
end end
def fill_key_title(title) def fill_key_title(title)
...@@ -31,8 +31,22 @@ module QA ...@@ -31,8 +31,22 @@ module QA
end end
def key_title def key_title
page.within('.qa-project-deploy-keys') do within_project_deploy_keys do
page.find('.title').text 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 end
end end
......
module QA module QA
feature 'deploy keys support', :core do feature 'deploy keys support', :core do
given(:key) { Runtime::RSAKey.new }
given(:deploy_key_title) { 'deploy key title' } 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 scenario 'user adds a deploy key' do
Runtime::Browser.visit(:gitlab, Page::Main::Login) Runtime::Browser.visit(:gitlab, Page::Main::Login)
...@@ -13,6 +14,7 @@ module QA ...@@ -13,6 +14,7 @@ module QA
end end
expect(deploy_key.title).to eq(deploy_key_title) expect(deploy_key.title).to eq(deploy_key_title)
expect(deploy_key.fingerprint).to eq(key.fingerprint)
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment