Commit 7377b97c authored by Lin Jen-Shin's avatar Lin Jen-Shin

QA: Add a scenario for adding a deploy key

parent 4e0b6bf7
...@@ -86,6 +86,11 @@ module QA ...@@ -86,6 +86,11 @@ module QA
module Project module Project
autoload :New, 'qa/page/project/new' autoload :New, 'qa/page/project/new'
autoload :Show, 'qa/page/project/show' autoload :Show, 'qa/page/project/show'
module Settings
autoload :Repository, 'qa/page/project/settings/repository'
autoload :DeployKey, 'qa/page/project/settings/deploy_key'
end
end end
module Admin module Admin
......
module QA
module Page
module Project
module Settings
class DeployKey < Repository
def initialize
super
expand('Deploy Keys')
end
def fill_new_deploy_key_title(title)
fill_in 'deploy_key_title', with: title
end
def fill_new_deploy_key_key(key)
fill_in 'deploy_key_key', with: key
end
def add_key
click_on 'Add key'
end
def has_key_title?(title)
page.within('.deploy-keys') do
page.find('.title', text: title)
end
end
end
end
end
end
end
module QA
module Page
module Project
module Settings
class Repository < Page::Base
def expand(title)
page.within('#content-body') do
find(
:xpath,
"//button[contains(text(), 'Expand')]" +
"[../h4[contains(text(), '#{title}')]]"
).click
end
end
end
end
end
end
end
...@@ -10,6 +10,12 @@ module QA ...@@ -10,6 +10,12 @@ module QA
end end
end end
def click_repository_setting
hover_setting do
click_link('Repository')
end
end
def repository_location def repository_location
find('#project_clone').value find('#project_clone').value
end end
...@@ -18,6 +24,20 @@ module QA ...@@ -18,6 +24,20 @@ module QA
find('.project-title').text find('.project-title').text
end end
def hover_setting
within_sidebar do
find('.nav-item-name', text: 'Settings').hover
yield
end
end
def within_sidebar
page.within('.sidebar-top-level-items') do
yield
end
end
def wait_for_push def wait_for_push
sleep 5 sleep 5
end end
......
...@@ -10,6 +10,15 @@ module QA ...@@ -10,6 +10,15 @@ module QA
def password def password
ENV['GITLAB_PASSWORD'] || '5iveL!fe' ENV['GITLAB_PASSWORD'] || '5iveL!fe'
end end
def ssh_key
'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFf6RYK3qu/RKF/3ndJmL5xgMLp3O9' \
'6x8lTay+QGZ0+9FnnAXMdUqBq/ZU6d/gyMB4IaW3nHzM1w049++yAB6UPCzMB8Uo27K5' \
'/jyZCtj7Vm9PFNjF/8am1kp46c/SeYicQgQaSBdzIW3UDEa1Ef68qroOlvpi9PYZ/tA7' \
'M0YP0K5PXX+E36zaIRnJVMPT3f2k+GnrxtjafZrwFdpOP/Fol5BQLBgcsyiU+LM1SuaC' \
'rzd8c9vyaTA1CxrkxaZh+buAi0PmdDtaDrHd42gqZkXCKavyvgM5o2CkQ5LJHCgzpXy0' \
'5qNFzmThBSkb+XtoxbyagBiGbVZtSVow6Xa7qewz= dummy@gitlab.com'
end
end end
end end
end end
module QA
feature 'add deploy key', :core do
before do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials }
Factory::Resource::Project.fabricate! do |scenario|
scenario.name = 'project-to-deploy'
scenario.description = 'project for adding deploy key test'
end
Page::Project::Show.act do
click_repository_setting
end
end
given(:deploy_key_title) { 'deploy key title' }
given(:deploy_key_data) { Runtime::User.ssh_key }
scenario 'user adds a deploy key' do
Page::Project::Settings::DeployKey.perform do |deploy_key|
deploy_key.fill_new_deploy_key_title(deploy_key_title)
deploy_key.fill_new_deploy_key_key(deploy_key_data)
deploy_key.add_key
end
Page::Project::Settings::DeployKey.perform do |deploy_key|
expect(deploy_key).to have_key_title(deploy_key_title)
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