Commit f851f13f authored by Lin Jen-Shin's avatar Lin Jen-Shin

Introduce expand_deploy_keys

parent bc5552b3
......@@ -2,18 +2,12 @@ module QA
module Page
module Project
module Settings
class DeployKeys < Repository
def initialize
super
expand('Deploy Keys')
end
def fill_new_deploy_key_title(title)
class DeployKeys < Page::Base
def fill_key_title(title)
fill_in 'deploy_key_title', with: title
end
def fill_new_deploy_key_key(key)
def fill_key_value(key)
fill_in 'deploy_key_key', with: key
end
......
......@@ -3,9 +3,19 @@ module QA
module Project
module Settings
class Repository < Page::Base
def expand(title)
def expand_deploy_keys(&block)
expand('.qa-expand-deploy-keys') do
DeployKeys.perform(&block)
end
end
private
def expand(selector)
page.within('#content-body') do
find('.qa-expand-deploy-keys').click
find(selector).click
yield
end
end
end
......
......@@ -15,19 +15,23 @@ module QA
end
given(:deploy_key_title) { 'deploy key title' }
given(:deploy_key_data) { Runtime::User.ssh_key }
given(:deploy_key_value) { Runtime::User.ssh_key }
scenario 'user adds a deploy key' do
Page::Project::Settings::DeployKeys.perform do |page|
page.fill_new_deploy_key_title(deploy_key_title)
page.fill_new_deploy_key_key(deploy_key_data)
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::DeployKeys.perform do |page|
Page::Project::Settings::Repository.perform do |setting|
setting.expand_deploy_keys do |page|
expect(page).to have_key_title(deploy_key_title)
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