summaryrefslogtreecommitdiff
path: root/qa/qa/resource/project.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/resource/project.rb')
-rw-r--r--qa/qa/resource/project.rb36
1 files changed, 30 insertions, 6 deletions
diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb
index 78e2ba8a248..645f4e97ee0 100644
--- a/qa/qa/resource/project.rb
+++ b/qa/qa/resource/project.rb
@@ -30,6 +30,8 @@ module QA
"#{sandbox_path}#{group.path}/#{name}" if group
end
+ alias_method :full_path, :path_with_namespace
+
def sandbox_path
group.respond_to?('sandbox') ? "#{group.sandbox.path}/" : ''
end
@@ -54,6 +56,8 @@ module QA
@auto_devops_enabled = false
@visibility = :public
@template_name = nil
+
+ self.name = "the_awesome_project"
end
def name=(raw_name)
@@ -67,12 +71,14 @@ module QA
end
if @template_name
+ QA::Flow::Project.go_to_create_project_from_template
Page::Project::New.perform do |new_page|
- new_page.click_create_from_template_tab
new_page.use_template_for_project(@template_name)
end
end
+ Page::Project::NewExperiment.perform(&:click_blank_project_link) if Page::Project::NewExperiment.perform(&:shown?)
+
Page::Project::New.perform do |new_page|
new_page.choose_test_namespace
new_page.choose_name(@name)
@@ -89,6 +95,10 @@ module QA
super
end
+ def has_file?(file_path)
+ repository_tree.any? { |file| file[:path] == file_path }
+ end
+
def api_get_path
"/projects/#{CGI.escape(path_with_namespace)}"
end
@@ -109,6 +119,14 @@ module QA
"#{api_get_path}/runners"
end
+ def api_repository_branches_path
+ "#{api_get_path}/repository/branches"
+ end
+
+ def api_repository_tree_path
+ "#{api_get_path}/repository/tree"
+ end
+
def api_pipelines_path
"#{api_get_path}/pipelines"
end
@@ -149,11 +167,9 @@ module QA
raise ResourceUpdateFailedError, "Could not change repository storage to #{new_storage}. Request returned (#{response.code}): `#{response}`."
end
- wait_until do
- reload!
-
- api_response[:repository_storage] == new_storage
- end
+ wait_until(sleep_interval: 1) { Runtime::API::RepositoryStorageMoves.has_status?(self, 'finished', new_storage) }
+ rescue Support::Repeater::RepeaterConditionExceededError
+ raise Runtime::API::RepositoryStorageMoves::RepositoryStorageMovesError, 'Timed out while waiting for the repository storage move to finish'
end
def import_status
@@ -180,6 +196,14 @@ module QA
parse_body(response)
end
+ def repository_branches
+ parse_body(get(Runtime::API::Request.new(api_client, api_repository_branches_path).url))
+ end
+
+ def repository_tree
+ parse_body(get(Runtime::API::Request.new(api_client, api_repository_tree_path).url))
+ end
+
def pipelines
parse_body(get(Runtime::API::Request.new(api_client, api_pipelines_path).url))
end