summaryrefslogtreecommitdiff
path: root/qa/qa/resource
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/resource')
-rw-r--r--qa/qa/resource/file.rb43
-rw-r--r--qa/qa/resource/group.rb2
-rw-r--r--qa/qa/resource/issue.rb15
-rw-r--r--qa/qa/resource/project_imported_from_github.rb1
-rw-r--r--qa/qa/resource/project_snippet.rb8
-rw-r--r--qa/qa/resource/runner.rb2
-rw-r--r--qa/qa/resource/snippet.rb32
-rw-r--r--qa/qa/resource/user.rb2
8 files changed, 84 insertions, 21 deletions
diff --git a/qa/qa/resource/file.rb b/qa/qa/resource/file.rb
index f573f3e89f0..0d2bf9890ea 100644
--- a/qa/qa/resource/file.rb
+++ b/qa/qa/resource/file.rb
@@ -5,14 +5,21 @@ module QA
class File < Base
attr_accessor :author_email,
:author_name,
- :branch,
:content,
:commit_message,
:name
+ attr_writer :branch
attribute :project do
Project.fabricate! do |resource|
resource.name = 'project-with-new-file'
+
+ # Creating the first file via the Wed IDE is tested in
+ # browser_ui/3_create/web_ide/create_first_file_in_web_ide_spec.rb
+ # So here we want to use the old blob viewer, which is not
+ # available via the UI unless at least one file exists, which
+ # is why we create the project with a readme file.
+ resource.initialize_with_readme = true
end
end
@@ -22,28 +29,23 @@ module QA
@commit_message = 'QA Test - Commit message'
end
+ def branch
+ @branch ||= "master"
+ end
+
def fabricate!
project.visit!
- Page::Project::Show.perform(&:create_first_new_file!)
-
- Page::Project::WebIDE::Edit.perform do |ide|
- ide.add_file(@name, @content)
- ide.commit_changes(@commit_message)
- ide.go_to_project
- end
+ Page::Project::Show.perform(&:create_new_file!)
- Page::Project::Show.perform do |project|
- project.click_file(@name)
+ Page::File::Form.perform do |form|
+ form.add_name(@name)
+ form.add_content(@content)
+ form.add_commit_message(@commit_message)
+ form.commit_changes
end
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/#{CGI.escape(project.path_with_namespace)}/repository/files/#{CGI.escape(@name)}"
end
@@ -54,13 +56,20 @@ module QA
def api_post_body
{
- branch: @branch || "master",
+ branch: branch,
author_email: @author_email || Runtime::User.default_email,
author_name: @author_name || Runtime::User.username,
content: content,
commit_message: commit_message
}
end
+
+ private
+
+ def transform_api_resource(api_resource)
+ api_resource[:web_url] = "#{Runtime::Scenario.gitlab_address}/#{project.full_path}/-/tree/#{branch}/#{api_resource[:file_path]}"
+ api_resource
+ end
end
end
end
diff --git a/qa/qa/resource/group.rb b/qa/qa/resource/group.rb
index 1cb33a7c71c..2e29ec9a6a7 100644
--- a/qa/qa/resource/group.rb
+++ b/qa/qa/resource/group.rb
@@ -44,7 +44,7 @@ module QA
# Ensure that the group was actually created
group_show.wait_until(sleep_interval: 1) do
group_show.has_text?(path) &&
- group_show.has_new_project_or_subgroup_dropdown?
+ group_show.has_new_project_and_new_subgroup_buttons?
end
end
end
diff --git a/qa/qa/resource/issue.rb b/qa/qa/resource/issue.rb
index d96d8d744d2..a6bd8987077 100644
--- a/qa/qa/resource/issue.rb
+++ b/qa/qa/resource/issue.rb
@@ -57,6 +57,21 @@ module QA
hash[:weight] = @weight if @weight
end
end
+
+ def api_put_path
+ "/projects/#{project.id}/issues/#{iid}"
+ end
+
+ def set_issue_assignees(assignee_ids:)
+ put_body = { assignee_ids: assignee_ids }
+ response = put Runtime::API::Request.new(api_client, api_put_path).url, put_body
+
+ unless response.code == HTTP_STATUS_OK
+ raise ResourceUpdateFailedError, "Could not update issue assignees to #{assignee_ids}. Request returned (#{response.code}): `#{response}`."
+ end
+
+ QA::Runtime::Logger.debug("Successfully updated issue assignees to #{assignee_ids}")
+ end
end
end
end
diff --git a/qa/qa/resource/project_imported_from_github.rb b/qa/qa/resource/project_imported_from_github.rb
index df28d63b113..0b817b345fd 100644
--- a/qa/qa/resource/project_imported_from_github.rb
+++ b/qa/qa/resource/project_imported_from_github.rb
@@ -6,6 +6,7 @@ module QA
module Resource
class ProjectImportedFromGithub < Resource::Project
def fabricate!
+ self.import = true
super
group.visit!
diff --git a/qa/qa/resource/project_snippet.rb b/qa/qa/resource/project_snippet.rb
index 6fa38baaa91..c262499664e 100644
--- a/qa/qa/resource/project_snippet.rb
+++ b/qa/qa/resource/project_snippet.rb
@@ -31,6 +31,14 @@ module QA
new_snippet.click_create_snippet_button
end
end
+
+ def api_get_path
+ "/projects/#{project.id}/snippets/#{snippet_id}"
+ end
+
+ def api_post_path
+ "/projects/#{project.id}/snippets"
+ end
end
end
end
diff --git a/qa/qa/resource/runner.rb b/qa/qa/resource/runner.rb
index b2a36f92ffe..2a0823d648e 100644
--- a/qa/qa/resource/runner.rb
+++ b/qa/qa/resource/runner.rb
@@ -29,7 +29,7 @@ module QA
end
def executor_image
- @executor_image || 'registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-alpine-ruby-2.6'
+ @executor_image || 'registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-alpine-ruby-2.7'
end
def fabricate_via_api!
diff --git a/qa/qa/resource/snippet.rb b/qa/qa/resource/snippet.rb
index c4ea6447209..6fdcb1cd29b 100644
--- a/qa/qa/resource/snippet.rb
+++ b/qa/qa/resource/snippet.rb
@@ -3,7 +3,7 @@
module QA
module Resource
class Snippet < Base
- attr_accessor :title, :description, :file_content, :visibility, :file_name
+ attr_accessor :title, :description, :file_content, :visibility, :file_name, :snippet_id
def initialize
@title = 'New snippet title'
@@ -36,6 +36,36 @@ module QA
new_page.click_create_snippet_button
end
end
+
+ def fabricate_via_api!
+ resource_web_url(api_post)
+ rescue ResourceNotFoundError
+ super
+ end
+
+ def api_get_path
+ "/snippets/#{snippet_id}"
+ end
+
+ def api_post_path
+ '/snippets'
+ end
+
+ def api_post_body
+ {
+ title: title,
+ description: description,
+ visibility: visibility.downcase,
+ files: all_file_contents
+ }
+ end
+
+ def all_file_contents
+ @files.insert(0, { name: @file_name, content: @file_content })
+ @files.each do |file|
+ file[:file_path] = file.delete(:name)
+ end
+ end
end
end
end
diff --git a/qa/qa/resource/user.rb b/qa/qa/resource/user.rb
index 5cd4147e154..ca30ff12480 100644
--- a/qa/qa/resource/user.rb
+++ b/qa/qa/resource/user.rb
@@ -75,7 +75,7 @@ module QA
end
else
Page::Main::Login.perform do |login|
- login.switch_to_register_tab
+ login.switch_to_register_page
end
Page::Main::SignUp.perform do |signup|
signup.sign_up!(self)