diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-12-29 17:40:47 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-01-02 17:27:01 +0300 |
commit | 7945878d45775e74046196bfd40291a1a7747724 (patch) | |
tree | 6b030a913b83d7a2666b3337e0ee4ec055b48b3e /qa | |
parent | 9f7fe677415e36dcf8a6d1621335d383196a5951 (diff) |
Introduce common project settings and just put
everything in the scenario without a before block.
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa.rb | 1 | ||||
-rw-r--r-- | qa/qa/page/project/settings/common.rb | 17 | ||||
-rw-r--r-- | qa/qa/page/project/settings/repository.rb | 12 | ||||
-rw-r--r-- | qa/qa/specs/features/project/add_deploy_key_spec.rb | 10 |
4 files changed, 24 insertions, 16 deletions
@@ -93,6 +93,7 @@ module QA autoload :Show, 'qa/page/project/show' module Settings + autoload :Common, 'qa/page/project/settings/common' autoload :Repository, 'qa/page/project/settings/repository' autoload :DeployKeys, 'qa/page/project/settings/deploy_keys' end diff --git a/qa/qa/page/project/settings/common.rb b/qa/qa/page/project/settings/common.rb new file mode 100644 index 00000000000..5d1d5120929 --- /dev/null +++ b/qa/qa/page/project/settings/common.rb @@ -0,0 +1,17 @@ +module QA + module Page + module Project + module Settings + module Common + def expand(selector) + page.within('#content-body') do + find(selector).click + + yield + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb index 941fde2f04f..034b0d09c1c 100644 --- a/qa/qa/page/project/settings/repository.rb +++ b/qa/qa/page/project/settings/repository.rb @@ -3,21 +3,13 @@ module QA module Project module Settings class Repository < Page::Base + include Common + 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(selector).click - - yield - end - end 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 448682ab977..43a85213501 100644 --- a/qa/qa/specs/features/project/add_deploy_key_spec.rb +++ b/qa/qa/specs/features/project/add_deploy_key_spec.rb @@ -1,6 +1,9 @@ module QA feature 'deploy keys support', :core do - before do + given(:deploy_key_title) { 'deploy key title' } + given(:deploy_key_value) { Runtime::User.ssh_key } + + scenario 'user adds a deploy key' do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } @@ -8,12 +11,7 @@ module QA deploy_key.title = deploy_key_title deploy_key.key = deploy_key_value end - end - given(:deploy_key_title) { 'deploy key title' } - 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| expect(page).to have_key_title(deploy_key_title) |