diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-12-29 10:40:46 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-01-02 17:27:01 +0300 |
commit | f851f13f1bba5503f8219e975fd326573c6a40d5 (patch) | |
tree | 40f081f96024187fd96e1901edb7adfb4f1ba2aa /qa | |
parent | bc5552b3594142b6f54a7ac2bc80ee80066c2064 (diff) |
Introduce expand_deploy_keys
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/page/project/settings/deploy_keys.rb | 12 | ||||
-rw-r--r-- | qa/qa/page/project/settings/repository.rb | 14 | ||||
-rw-r--r-- | qa/qa/specs/features/project/add_deploy_key_spec.rb | 18 |
3 files changed, 26 insertions, 18 deletions
diff --git a/qa/qa/page/project/settings/deploy_keys.rb b/qa/qa/page/project/settings/deploy_keys.rb index a8aa571f1f2..4028b8cccc5 100644 --- a/qa/qa/page/project/settings/deploy_keys.rb +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -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 diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb index 5d73911c697..941fde2f04f 100644 --- a/qa/qa/page/project/settings/repository.rb +++ b/qa/qa/page/project/settings/repository.rb @@ -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 diff --git a/qa/qa/specs/features/project/add_deploy_key_spec.rb b/qa/qa/specs/features/project/add_deploy_key_spec.rb index 015b3624c20..dd2747d23e4 100644 --- a/qa/qa/specs/features/project/add_deploy_key_spec.rb +++ b/qa/qa/specs/features/project/add_deploy_key_spec.rb @@ -15,18 +15,22 @@ 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 + page.add_key + end end - Page::Project::Settings::DeployKeys.perform do |page| - expect(page).to have_key_title(deploy_key_title) + 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 |