summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorSanad Liaquat <sliaquat@gitlab.com>2019-05-21 20:28:31 +0000
committerSanad Liaquat <sliaquat@gitlab.com>2019-05-21 20:28:31 +0000
commitbb5bbbaa1a64d18108470132bb2ed8ed5da52ce7 (patch)
treee4e7cedfb4459441049bffc3f3a8a069326eba10 /qa
parent9d98535621d498912d532daccddab4e2c883e9cb (diff)
parent6429ef77fff7a47484c6b7b43ed7719e0357ee16 (diff)
downloadgitlab-ce-bb5bbbaa1a64d18108470132bb2ed8ed5da52ce7.tar.gz
Merge branch 'dd-qa-api-delegation-project-cicd-vars' into 'master'
Delegate CiVariable fabrication to API See merge request gitlab-org/gitlab-ce!27924
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/resource/ci_variable.rb27
-rw-r--r--qa/qa/resource/project.rb1
-rw-r--r--qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb14
3 files changed, 40 insertions, 2 deletions
diff --git a/qa/qa/resource/ci_variable.rb b/qa/qa/resource/ci_variable.rb
index d82de4cb816..341d3c1ed7e 100644
--- a/qa/qa/resource/ci_variable.rb
+++ b/qa/qa/resource/ci_variable.rb
@@ -25,6 +25,33 @@ module QA
end
end
end
+
+ def fabricate_via_api!
+ resource_web_url(api_get)
+ rescue ResourceNotFoundError
+ super
+ end
+
+ def resource_web_url(resource)
+ super
+ rescue ResourceURLMissingError
+ # this particular resource does not expose a web_url property
+ end
+
+ def api_get_path
+ "/projects/#{project.id}/variables/#{key}"
+ end
+
+ def api_post_path
+ "/projects/#{project.id}/variables"
+ end
+
+ def api_post_body
+ {
+ key: key,
+ value: value
+ }
+ end
end
end
end
diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb
index de1e9f04c36..c1a0cff86d8 100644
--- a/qa/qa/resource/project.rb
+++ b/qa/qa/resource/project.rb
@@ -7,6 +7,7 @@ module QA
class Project < Base
include Events::Project
+ attribute :id
attribute :name
attribute :description
diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb
index 33f342edb08..561a8895329 100644
--- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb
+++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb
@@ -3,15 +3,25 @@
module QA
context 'Verify' do
describe 'CI variable support' do
- it 'user adds a CI variable' do
+ it 'user adds a CI variable', :smoke do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
- Page::Main::Login.act { sign_in_using_credentials }
+ Page::Main::Login.perform(&:sign_in_using_credentials)
+
+ project = Resource::Project.fabricate! do |project|
+ project.name = 'project-with-ci-variables'
+ project.description = 'project with CI variables'
+ end
Resource::CiVariable.fabricate! do |resource|
+ resource.project = project
resource.key = 'VARIABLE_KEY'
resource.value = 'some_CI_variable'
end
+ project.visit!
+
+ Page::Project::Menu.perform(&:go_to_ci_cd_settings)
+
Page::Project::Settings::CICD.perform do |settings|
settings.expand_ci_variables do |page|
expect(page).to have_field(with: 'VARIABLE_KEY')