Commit 7945878d authored by Lin Jen-Shin's avatar Lin Jen-Shin

Introduce common project settings and just put

everything in the scenario without a before block.
parent 9f7fe677
...@@ -93,6 +93,7 @@ module QA ...@@ -93,6 +93,7 @@ module QA
autoload :Show, 'qa/page/project/show' autoload :Show, 'qa/page/project/show'
module Settings module Settings
autoload :Common, 'qa/page/project/settings/common'
autoload :Repository, 'qa/page/project/settings/repository' autoload :Repository, 'qa/page/project/settings/repository'
autoload :DeployKeys, 'qa/page/project/settings/deploy_keys' autoload :DeployKeys, 'qa/page/project/settings/deploy_keys'
end end
......
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
...@@ -3,21 +3,13 @@ module QA ...@@ -3,21 +3,13 @@ module QA
module Project module Project
module Settings module Settings
class Repository < Page::Base class Repository < Page::Base
include Common
def expand_deploy_keys(&block) def expand_deploy_keys(&block)
expand('.qa-expand-deploy-keys') do expand('.qa-expand-deploy-keys') do
DeployKeys.perform(&block) DeployKeys.perform(&block)
end end
end end
private
def expand(selector)
page.within('#content-body') do
find(selector).click
yield
end
end
end end
end end
end end
......
module QA module QA
feature 'deploy keys support', :core do 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) Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials } Page::Main::Login.act { sign_in_using_credentials }
...@@ -8,12 +11,7 @@ module QA ...@@ -8,12 +11,7 @@ module QA
deploy_key.title = deploy_key_title deploy_key.title = deploy_key_title
deploy_key.key = deploy_key_value deploy_key.key = deploy_key_value
end 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| Page::Project::Settings::Repository.perform do |setting|
setting.expand_deploy_keys do |page| setting.expand_deploy_keys do |page|
expect(page).to have_key_title(deploy_key_title) 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