summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-12-29 16:35:54 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-01-02 22:27:01 +0800
commit9f7fe677415e36dcf8a6d1621335d383196a5951 (patch)
tree7ffcff942dc29454c6eff5fc8bed63207c5581a0 /qa
parentf851f13f1bba5503f8219e975fd326573c6a40d5 (diff)
downloadgitlab-ce-9f7fe677415e36dcf8a6d1621335d383196a5951.tar.gz
Introduce Factory::Resource::DeployKey
Diffstat (limited to 'qa')
-rw-r--r--qa/qa.rb1
-rw-r--r--qa/qa/factory/resource/deploy_key.rb31
-rw-r--r--qa/qa/specs/features/project/add_deploy_key_spec.rb19
3 files changed, 35 insertions, 16 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index 3c63c18483b..8001a1a3bd0 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -24,6 +24,7 @@ module QA
autoload :Sandbox, 'qa/factory/resource/sandbox'
autoload :Group, 'qa/factory/resource/group'
autoload :Project, 'qa/factory/resource/project'
+ autoload :DeployKey, 'qa/factory/resource/deploy_key'
end
module Repository
diff --git a/qa/qa/factory/resource/deploy_key.rb b/qa/qa/factory/resource/deploy_key.rb
new file mode 100644
index 00000000000..7c58e70bcc4
--- /dev/null
+++ b/qa/qa/factory/resource/deploy_key.rb
@@ -0,0 +1,31 @@
+module QA
+ module Factory
+ module Resource
+ class DeployKey < Factory::Base
+ attr_accessor :title, :key
+
+ dependency Factory::Resource::Project, as: :project do |project|
+ project.name = 'project-to-deploy'
+ project.description = 'project for adding deploy key test'
+ end
+
+ def fabricate!
+ project.visit!
+
+ Page::Menu::Side.act do
+ click_repository_setting
+ end
+
+ Page::Project::Settings::Repository.perform do |setting|
+ setting.expand_deploy_keys do |page|
+ page.fill_key_title(title)
+ page.fill_key_value(key)
+
+ page.add_key
+ end
+ end
+ 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 dd2747d23e4..448682ab977 100644
--- a/qa/qa/specs/features/project/add_deploy_key_spec.rb
+++ b/qa/qa/specs/features/project/add_deploy_key_spec.rb
@@ -4,13 +4,9 @@ module QA
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::Menu::Side.act do
- click_repository_setting
+ Factory::Resource::DeployKey.fabricate! do |deploy_key|
+ deploy_key.title = deploy_key_title
+ deploy_key.key = deploy_key_value
end
end
@@ -20,15 +16,6 @@ module QA
scenario 'user adds a deploy key' do
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
- end
- end
-
- Page::Project::Settings::Repository.perform do |setting|
- setting.expand_deploy_keys do |page|
expect(page).to have_key_title(deploy_key_title)
end
end