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

Introduce expand_deploy_keys

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