Commit 8cf9b74e authored by Walmyr Lima e Silva Filho's avatar Walmyr Lima e Silva Filho

Merge branch '196608-fix-qa-add_deploy_key_spec' into 'master'

Fix 'qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb'

Closes #196608

See merge request gitlab-org/gitlab!22975
parents ec7f69c4 18c5f93c
......@@ -115,12 +115,10 @@ export default {
<div role="rowheader" class="table-mobile-header">{{ s__('DeployKeys|Deploy key') }}</div>
<div class="table-mobile-content qa-key">
<strong class="title qa-key-title"> {{ deployKey.title }} </strong>
<div class="fingerprint qa-key-fingerprint">
<div class="fingerprint" data-qa-selector="key_md5_fingerprint">
{{ __('MD5') }}:{{ deployKey.fingerprint }}
</div>
<div class="fingerprint qa-key-fingerprint">
{{ __('SHA256') }}:{{ deployKey.fingerprint_sha256 }}
</div>
<div class="fingerprint">{{ __('SHA256') }}:{{ deployKey.fingerprint_sha256 }}</div>
</div>
</div>
<div class="table-section section-30 section-wrap">
......
......@@ -18,7 +18,7 @@ module QA
view 'app/assets/javascripts/deploy_keys/components/key.vue' do
element :key
element :key_title
element :key_fingerprint
element :key_md5_fingerprint
end
def add_key
......@@ -33,17 +33,17 @@ module QA
fill_in 'deploy_key_key', with: key
end
def find_fingerprint(title)
def find_md5_fingerprint(title)
within_project_deploy_keys do
find_element(:key, text: title)
.find(element_selector_css(:key_fingerprint)).text
.find(element_selector_css(:key_md5_fingerprint)).text.delete_prefix('MD5:')
end
end
def has_key?(title, fingerprint)
def has_key?(title, md5_fingerprint)
within_project_deploy_keys do
find_element(:key, text: title)
.has_css?(element_selector_css(:key_fingerprint), text: fingerprint)
.has_css?(element_selector_css(:key_md5_fingerprint), text: "MD5:#{md5_fingerprint}")
end
end
......@@ -53,12 +53,6 @@ module QA
end
end
def key_fingerprint
within_project_deploy_keys do
find_element(:key_fingerprint).text
end
end
private
def within_project_deploy_keys
......
......@@ -5,10 +5,10 @@ module QA
class DeployKey < Base
attr_accessor :title, :key
attribute :fingerprint do
attribute :md5_fingerprint do
Page::Project::Settings::Repository.perform do |setting|
setting.expand_deploy_keys do |key|
key.find_fingerprint(title)
key.find_md5_fingerprint(title)
end
end
end
......
......@@ -7,7 +7,7 @@ module QA
attr_accessor :title
def_delegators :key, :private_key, :public_key, :fingerprint
def_delegators :key, :private_key, :public_key, :md5_fingerprint
def key
@key ||= Runtime::Key::RSA.new
......
......@@ -4,7 +4,7 @@ module QA
module Runtime
module Key
class Base
attr_reader :name, :bits, :private_key, :public_key, :fingerprint
attr_reader :name, :bits, :private_key, :public_key, :md5_fingerprint
def initialize(name, bits)
@name = name
......@@ -29,7 +29,7 @@ module QA
def populate_key_data(path)
@private_key = ::File.binread(path)
@public_key = ::File.binread("#{path}.pub")
@fingerprint =
@md5_fingerprint =
`ssh-keygen -l -E md5 -f #{path} | cut -d' ' -f2 | cut -d: -f2-`.chomp
end
end
......
......@@ -13,7 +13,7 @@ module QA
end
expect(page).to have_content("Title: #{key_title}")
expect(page).to have_content(key.fingerprint)
expect(page).to have_content(key.md5_fingerprint)
Page::Main::Menu.perform(&:click_settings_link)
Page::Profile::Menu.perform(&:click_ssh_keys)
......@@ -23,7 +23,7 @@ module QA
end
expect(page).not_to have_content("Title: #{key_title}")
expect(page).not_to have_content(key.fingerprint)
expect(page).not_to have_content(key.md5_fingerprint)
end
end
end
......
......@@ -15,11 +15,11 @@ module QA
resource.key = deploy_key_value
end
expect(deploy_key.fingerprint).to eq key.fingerprint
expect(deploy_key.md5_fingerprint).to eq key.md5_fingerprint
Page::Project::Settings::Repository.perform do |setting|
setting.expand_deploy_keys do |keys|
expect(keys).to have_key(deploy_key_title, key.fingerprint)
expect(keys).to have_key(deploy_key_title, key.md5_fingerprint)
end
end
end
......
......@@ -52,7 +52,7 @@ module QA
Page::Profile::Menu.act { click_ssh_keys }
expect(page).to have_content(key_title)
expect(page).to have_content(key.fingerprint)
expect(page).to have_content(key.md5_fingerprint)
# Ensure project has replicated
Page::Main::Menu.perform { |menu| menu.go_to_projects }
......@@ -123,7 +123,7 @@ module QA
Page::Profile::Menu.act { click_ssh_keys }
expect(page).to have_content(key_title)
expect(page).to have_content(key.fingerprint)
expect(page).to have_content(key.md5_fingerprint)
# Ensure project has replicated
Page::Main::Menu.perform { |menu| menu.go_to_projects }
......
......@@ -52,7 +52,7 @@ module QA
end
expect(page).to have_content(key_title)
expect(page).to have_content(key.fingerprint)
expect(page).to have_content(key.md5_fingerprint)
# Ensure project has replicated
Page::Main::Menu.perform(&:go_to_projects)
......@@ -140,7 +140,7 @@ module QA
end
expect(page).to have_content(key_title)
expect(page).to have_content(key.fingerprint)
expect(page).to have_content(key.md5_fingerprint)
# Ensure project has replicated
Page::Main::Menu.perform(&:go_to_projects)
......
......@@ -58,7 +58,7 @@ module QA
Page::Profile::SSHKeys.perform do |ssh|
expect(ssh.keys_list).to have_content(key_title)
expect(ssh.keys_list).to have_content(key.fingerprint)
expect(ssh.keys_list).to have_content(key.md5_fingerprint)
end
Page::Main::Menu.perform(&:go_to_projects)
......
......@@ -47,7 +47,7 @@ module QA
Page::Profile::SSHKeys.perform do |ssh|
expect(ssh.keys_list).to have_content(key_title)
expect(ssh.keys_list).to have_content(key.fingerprint)
expect(ssh.keys_list).to have_content(key.md5_fingerprint)
end
Page::Main::Menu.perform(&:go_to_projects)
......
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