Scrap the deploy key title and match it in test

This commit is contained in:
Lin Jen-Shin 2018-01-18 22:23:35 +08:00
parent 604c9133a7
commit 39a659a135
3 changed files with 14 additions and 10 deletions

View File

@ -4,6 +4,12 @@ module QA
class DeployKey < Factory::Base
attr_accessor :title, :key
product :title do
Page::Project::Settings::Repository.act do
expand_deploy_keys(&:key_title)
end
end
dependency Factory::Resource::Project, as: :project do |project|
project.name = 'project-to-deploy'
project.description = 'project for adding deploy key test'

View File

@ -29,9 +29,11 @@ module QA
click_on 'Add key'
end
def has_key_title?(title)
def key_title
page.within('.deploy-keys') do
page.find('.title', text: title)
# The instance might have public keys available, here we want
# the one from the project
page.first('.title').text
end
end
end

View File

@ -7,16 +7,12 @@ module QA
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
Factory::Resource::DeployKey.fabricate! do |deploy_key|
deploy_key.title = deploy_key_title
deploy_key.key = deploy_key_value
deploy_key = Factory::Resource::DeployKey.fabricate! do |resource|
resource.title = deploy_key_title
resource.key = deploy_key_value
end
Page::Project::Settings::Repository.perform do |setting|
setting.expand_deploy_keys do |page|
expect(page).to have_key_title(deploy_key_title)
end
end
expect(deploy_key.title).to eq(deploy_key_title)
end
end
end