Commit 8d38d489 authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'tomi/310521/import_large_mr' into 'master'

LMR QA | Main | Importing a project and tagging Tests

See merge request gitlab-org/gitlab!63527
parents c1e45452 b5856772
......@@ -21,5 +21,5 @@
= file_field_tag :file, class: ''
.row
.form-actions.col-sm-12
= submit_tag _('Import project'), class: 'gl-button btn btn-confirm'
= submit_tag _('Import project'), class: 'gl-button btn btn-confirm', data: { qa_selector: 'import_project_button' }
= link_to _('Cancel'), new_project_path, class: 'gl-button btn btn-default btn-cancel'
.row
.form-group.project-name.col-sm-12
= label_tag :name, _('Project name'), class: 'label-bold'
= text_field_tag :name, @name, placeholder: "My awesome project", class: "js-project-name form-control gl-form-input input-lg", autofocus: true, required: true, aria: { required: true }
= text_field_tag :name, @name, placeholder: "My awesome project", class: "js-project-name form-control gl-form-input input-lg", autofocus: true, required: true, aria: { required: true }, data: { qa_selector: 'project_name_field' }
.form-group.col-12.col-sm-6
= label_tag :namespace_id, _('Project URL'), class: 'label-bold'
.form-group
......@@ -18,4 +18,4 @@
= hidden_field_tag :namespace_id, current_user.namespace_id
.form-group.col-12.col-sm-6.project-path
= label_tag :path, _('Project slug'), class: 'label-bold'
= text_field_tag :path, @path, placeholder: "my-awesome-project", class: "js-path-name form-control gl-form-input", required: true, aria: { required: true }
= text_field_tag :path, @path, placeholder: "my-awesome-project", class: "js-path-name form-control gl-form-input", required: true, aria: { required: true }, data: { qa_selector: 'project_slug_field' }
......@@ -7,7 +7,7 @@
= _("Import project from")
.import-buttons
- if gitlab_project_import_enabled?
.import_gitlab_project.has-tooltip{ data: { container: 'body' } }
.import_gitlab_project.has-tooltip{ data: { container: 'body', qa_selector: 'gitlab_import_button' } }
= link_to new_import_gitlab_project_path, class: 'gl-button btn-default btn btn_import_gitlab_project', **tracking_attrs(track_label, 'click_button', 'gitlab_export') do
.gl-button-icon
= sprite_icon('tanuki')
......
......@@ -107,6 +107,7 @@ module QA
autoload :RegistryRepository, 'qa/resource/registry_repository'
autoload :Package, 'qa/resource/package'
autoload :PipelineSchedules, 'qa/resource/pipeline_schedules'
autoload :ImportProject, 'qa/resource/import_project'
module KubernetesCluster
autoload :Base, 'qa/resource/kubernetes_cluster/base'
......@@ -530,6 +531,11 @@ module QA
autoload :CommitModal, 'qa/page/component/commit_modal'
autoload :VisibilitySetting, 'qa/page/component/visibility_setting'
module Import
autoload :Gitlab, 'qa/page/component/import/gitlab'
autoload :Selection, 'qa/page/component/import/selection'
end
module Issuable
autoload :Common, 'qa/page/component/issuable/common'
autoload :Sidebar, 'qa/page/component/issuable/sidebar'
......
# frozen_string_literal: true
module QA
module Page
module Component
module Import
module Gitlab
def self.included(base)
super
base.view 'app/views/import/gitlab_projects/new.html.haml' do
element :import_project_button
end
base.view 'app/views/import/shared/_new_project_form.html.haml' do
element :project_name_field
element :project_slug_field
end
end
def set_imported_project_name(name)
fill_element(:project_name_field, name)
end
def attach_exported_file(path)
page.attach_file("file", path, make_visible: { display: 'block' })
end
def click_import_gitlab_project
click_element(:import_project_button)
wait_until(reload: false) do
has_notice?("The project was successfully imported.")
end
end
end
end
end
end
end
# frozen_string_literal: true
module QA
module Page
module Component
module Import
module Selection
def self.included(base)
super
base.view 'app/views/projects/_import_project_pane.html.haml' do
element :gitlab_import_button
end
end
def click_gitlab
click_element(:gitlab_import_button)
end
end
end
end
end
end
......@@ -8,6 +8,10 @@ module QA
include Page::Component::Select2
include Page::Component::VisibilitySetting
include Layout::Flash
include Page::Component::Import::Selection
include Page::Component::Import::Gitlab
view 'app/views/projects/_new_project_fields.html.haml' do
element :initialize_with_readme_checkbox
element :project_namespace_select
......
# frozen_string_literal: true
module QA
module Resource
class ImportProject < Resource::Project
attr_writer :file_path
def initialize
@name = "ImportedProject-#{SecureRandom.hex(8)}"
@file_path = ::File.join('qa', 'fixtures', 'export.tar.gz')
end
def fabricate!
self.import = true
super
group.visit!
Page::Group::Show.perform(&:go_to_new_project)
Page::Project::New.perform do |new_project|
new_project.click_import_project
new_project.click_gitlab
new_project.set_imported_project_name(@name)
new_project.attach_exported_file(@file_path)
new_project.click_import_gitlab_project
end
end
def fabricate_via_api!
raise NotImplementedError
end
end
end
end
......@@ -70,6 +70,8 @@ module QA
end
def fabricate!
return fabricate_large_merge_request if Runtime::Scenario.large_setup?
populate_target_and_source_if_required
project.visit!
......@@ -90,6 +92,8 @@ module QA
end
def fabricate_via_api!
return fabricate_large_merge_request if Runtime::Scenario.large_setup?
resource_web_url(api_get)
rescue ResourceNotFoundError, NoValueError # rescue if iid not populated
populate_target_and_source_if_required
......@@ -144,6 +148,15 @@ module QA
end
end
def fabricate_large_merge_request
@project = Resource::ImportProject.fabricate_via_browser_ui!
# Setting the name here, since otherwise some tests will look for an existing file in
# the proejct without ever knowing what is in it.
@file_name = "LICENSE"
visit("#{project.web_url}/-/merge_requests/1")
current_url
end
# Get MR comments
#
# @return [Array]
......
......@@ -19,7 +19,7 @@ module QA
Flow::Login.sign_in
end
it 'can be reverted', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1745' do
it 'can be reverted', :can_use_large_setup, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1745' do
revertable_merge_request.visit!
Page::MergeRequest::Show.perform do |merge_request|
......
......@@ -65,6 +65,8 @@ module QA
args.push(DEFAULT_TEST_PATH_ARGS) unless options.any? { |opt| opt =~ %r{/features/} }
end
Runtime::Scenario.define(:large_setup?, args.flatten.include?('can_use_large_setup'))
if Runtime::Scenario.attributes[:parallel]
ParallelRunner.run(args.flatten)
elsif Runtime::Scenario.attributes[:loop]
......
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