summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-12-22 03:04:25 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-12-28 17:20:33 +0800
commit7377b97c5faf375d659c8e338982760d0d6bbb25 (patch)
treea1e726b4589e938c6fefa2fc70802b8375993b9d /qa
parent4e0b6bf714f6e009c5a3ded5c3250ac9e178412f (diff)
downloadgitlab-ce-7377b97c5faf375d659c8e338982760d0d6bbb25.tar.gz
QA: Add a scenario for adding a deploy key
Diffstat (limited to 'qa')
-rw-r--r--qa/qa.rb5
-rw-r--r--qa/qa/page/project/settings/deploy_key.rb33
-rw-r--r--qa/qa/page/project/settings/repository.rb19
-rw-r--r--qa/qa/page/project/show.rb20
-rw-r--r--qa/qa/runtime/user.rb9
-rw-r--r--qa/qa/specs/features/project/add_deploy_key_spec.rb33
6 files changed, 119 insertions, 0 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index 340f5e35c67..c303a4e7883 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -86,6 +86,11 @@ module QA
module Project
autoload :New, 'qa/page/project/new'
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
module Admin
diff --git a/qa/qa/page/project/settings/deploy_key.rb b/qa/qa/page/project/settings/deploy_key.rb
new file mode 100644
index 00000000000..27a6c26efd5
--- /dev/null
+++ b/qa/qa/page/project/settings/deploy_key.rb
@@ -0,0 +1,33 @@
+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
diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb
new file mode 100644
index 00000000000..740fb91d62e
--- /dev/null
+++ b/qa/qa/page/project/settings/repository.rb
@@ -0,0 +1,19 @@
+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
diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb
index 3b2bac84f3f..239fe8efdfd 100644
--- a/qa/qa/page/project/show.rb
+++ b/qa/qa/page/project/show.rb
@@ -10,6 +10,12 @@ module QA
end
end
+ def click_repository_setting
+ hover_setting do
+ click_link('Repository')
+ end
+ end
+
def repository_location
find('#project_clone').value
end
@@ -18,6 +24,20 @@ module QA
find('.project-title').text
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
sleep 5
end
diff --git a/qa/qa/runtime/user.rb b/qa/qa/runtime/user.rb
index 60027c89ab1..a01f9c08ea0 100644
--- a/qa/qa/runtime/user.rb
+++ b/qa/qa/runtime/user.rb
@@ -10,6 +10,15 @@ module QA
def password
ENV['GITLAB_PASSWORD'] || '5iveL!fe'
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
diff --git a/qa/qa/specs/features/project/add_deploy_key_spec.rb b/qa/qa/specs/features/project/add_deploy_key_spec.rb
new file mode 100644
index 00000000000..b549a710fd0
--- /dev/null
+++ b/qa/qa/specs/features/project/add_deploy_key_spec.rb
@@ -0,0 +1,33 @@
+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