Commit 9f7fe677 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Introduce Factory::Resource::DeployKey

parent f851f13f
......@@ -24,6 +24,7 @@ module QA
autoload :Sandbox, 'qa/factory/resource/sandbox'
autoload :Group, 'qa/factory/resource/group'
autoload :Project, 'qa/factory/resource/project'
autoload :DeployKey, 'qa/factory/resource/deploy_key'
end
module Repository
......
module QA
module Factory
module Resource
class DeployKey < Factory::Base
attr_accessor :title, :key
dependency Factory::Resource::Project, as: :project do |project|
project.name = 'project-to-deploy'
project.description = 'project for adding deploy key test'
end
def fabricate!
project.visit!
Page::Menu::Side.act do
click_repository_setting
end
Page::Project::Settings::Repository.perform do |setting|
setting.expand_deploy_keys do |page|
page.fill_key_title(title)
page.fill_key_value(key)
page.add_key
end
end
end
end
end
end
end
......@@ -4,13 +4,9 @@ module QA
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
Factory::Resource::Project.fabricate! do |scenario|
scenario.name = 'project-to-deploy'
scenario.description = 'project for adding deploy key test'
end
Page::Menu::Side.act do
click_repository_setting
Factory::Resource::DeployKey.fabricate! do |deploy_key|
deploy_key.title = deploy_key_title
deploy_key.key = deploy_key_value
end
end
......@@ -18,15 +14,6 @@ module QA
given(:deploy_key_value) { Runtime::User.ssh_key }
scenario 'user adds a deploy key' do
Page::Project::Settings::Repository.perform do |setting|
setting.expand_deploy_keys do |page|
page.fill_key_title(deploy_key_title)
page.fill_key_value(deploy_key_value)
page.add_key
end
end
Page::Project::Settings::Repository.perform do |setting|
setting.expand_deploy_keys do |page|
expect(page).to have_key_title(deploy_key_title)
......
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