Commit 51d23268 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'qa_extract_push_to_scenario' into 'master'

Turn" push a file" into a scenario

See merge request gitlab-org/gitlab-ce!15617
parents fb47f2a7 e415855c
...@@ -46,6 +46,10 @@ module QA ...@@ -46,6 +46,10 @@ module QA
autoload :Create, 'qa/scenario/gitlab/project/create' autoload :Create, 'qa/scenario/gitlab/project/create'
end end
module Repository
autoload :Push, 'qa/scenario/gitlab/repository/push'
end
module Sandbox module Sandbox
autoload :Prepare, 'qa/scenario/gitlab/sandbox/prepare' autoload :Prepare, 'qa/scenario/gitlab/sandbox/prepare'
end end
......
require "pry-byebug"
module QA
module Scenario
module Gitlab
module Repository
class Push < Scenario::Template
PAGE_REGEX_CHECK =
%r{\/#{Runtime::Namespace.sandbox_name}\/qa-test[^\/]+\/{1}[^\/]+\z}.freeze
attr_writer :file_name,
:file_content,
:commit_message,
:branch_name
def initialize
@file_name = 'file.txt'
@file_content = '# This is test project'
@commit_message = "Add #{@file_name}"
@branch_name = 'master'
end
def perform
Git::Repository.perform do |repository|
repository.location = Page::Project::Show.act do
unless PAGE_REGEX_CHECK.match(current_path)
raise "To perform this scenario the current page should be project show."
end
choose_repository_clone_http
repository_location
end
repository.use_default_credentials
repository.clone
repository.configure_identity('GitLab QA', 'root@gitlab.com')
repository.add_file(@file_name, @file_content)
repository.commit(@commit_message)
repository.push_changes(@branch_name)
end
end
end
end
end
end
end
...@@ -10,21 +10,10 @@ module QA ...@@ -10,21 +10,10 @@ module QA
scenario.description = 'project with repository' scenario.description = 'project with repository'
end end
Git::Repository.perform do |repository| Scenario::Gitlab::Repository::Push.perform do |scenario|
repository.location = Page::Project::Show.act do scenario.file_name = 'README.md'
choose_repository_clone_http scenario.file_content = '# This is test project'
repository_location scenario.commit_message = 'Add README.md'
end
repository.use_default_credentials
repository.act do
clone
configure_identity('GitLab QA', 'root@gitlab.com')
add_file('README.md', '# This is test project')
commit('Add README.md')
push_changes
end
end end
Page::Project::Show.act do Page::Project::Show.act do
......
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