Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/resource/pipeline.rb')
-rw-r--r--qa/qa/resource/pipeline.rb53
1 files changed, 53 insertions, 0 deletions
diff --git a/qa/qa/resource/pipeline.rb b/qa/qa/resource/pipeline.rb
new file mode 100644
index 00000000000..a115de3e825
--- /dev/null
+++ b/qa/qa/resource/pipeline.rb
@@ -0,0 +1,53 @@
+# frozen_string_literal: true
+
+module QA
+ module Resource
+ class Pipeline < Base
+ attribute :project do
+ Resource::Project.fabricate! do |project|
+ project.name = 'project-with-pipeline'
+ end
+ end
+
+ attribute :id
+ attribute :status
+ attribute :ref
+ attribute :sha
+
+ # array in form
+ # [
+ # { key: 'UPLOAD_TO_S3', variable_type: 'file', value: true },
+ # { key: 'SOMETHING', variable_type: 'env_var', value: 'yes' }
+ # ]
+ attribute :variables
+
+ def initialize
+ @ref = 'master'
+ @variables = []
+ end
+
+ def fabricate!
+ project.visit!
+
+ Page::Project::Menu.perform(&:click_ci_cd_pipelines)
+ Page::Project::Pipeline::Index.perform(&:click_run_pipeline_button)
+ Page::Project::Pipeline::New.perform(&:click_run_pipeline_button)
+ end
+
+ def api_get_path
+ "/projects/#{project.id}/pipelines/#{id}"
+ end
+
+ def api_post_path
+ "/projects/#{project.id}/pipeline"
+ end
+
+ def api_post_body
+ {
+ ref: ref,
+ variables: variables
+ }
+ end
+ end
+ end
+end