Commit e4a381dd authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'add-ee-import-project-lib' into 'master'

Define ways to import external repo with CI/CD

See merge request gitlab-org/gitlab!42049
parents 5d84bc4f 9acd8904
- return unless ci_cd_projects_available?
%li.nav-item{ class: active_when(active_tab == 'ci_cd_only'), role: 'presentation' }
%a.nav-link{ href: '#ci-cd-project-pane', id: 'ci-cd-project-tab', data: { toggle: 'tab', experiment_track_label: 'cicd_for_external_repo' }, role: 'tab' }
%a.nav-link{ href: '#ci-cd-project-pane', id: 'ci-cd-project-tab', data: { qa_selector: 'ci_cd_project_tab', toggle: 'tab', experiment_track_label: 'cicd_for_external_repo' }, role: 'tab' }
%span.d-none.d-sm-block
= _('CI/CD for external repo')
%span.d-block.d-sm-none
......
......@@ -197,6 +197,7 @@ module QA
autoload :Epic, 'qa/ee/resource/epic'
autoload :GroupLabel, 'qa/ee/resource/group_label'
autoload :GroupIteration, 'qa/ee/resource/group_iteration'
autoload :ImportRepoWithCICD, 'qa/ee/resource/import_repo_with_ci_cd'
module Board
autoload :BaseBoard, 'qa/ee/resource/board/base_board'
......
......@@ -27,6 +27,10 @@ module QA
element :use_template_button
element :template_option_row
end
view 'ee/app/views/projects/_new_ci_cd_only_project_tab.html.haml' do
element :ci_cd_project_tab
end
end
end
......@@ -45,6 +49,10 @@ module QA
def instance_template_tab_badge_text
find_element(:instance_template_tab_badge).text
end
def click_ci_cd_for_external_repo
click_element :ci_cd_project_tab
end
end
end
end
......
# frozen_string_literal: true
module QA
module EE
module Resource
class ImportRepoWithCICD < QA::Resource::ProjectImportedFromGithub
def fabricate!
super
end
def go_to_import_tab
QA::Page::Project::New.perform(&:click_ci_cd_for_external_repo)
end
end
end
end
end
......@@ -12,6 +12,8 @@ module QA
attr_accessor :repository_storage # requires admin access
attr_writer :initialize_with_readme
attr_writer :auto_devops_enabled
attr_writer :github_personal_access_token
attr_writer :github_repository_path
attribute :default_branch
attribute :id
......@@ -22,6 +24,7 @@ module QA
attribute :runners_token
attribute :visibility
attribute :template_name
attribute :import
attribute :group do
Group.fabricate!
......@@ -57,6 +60,7 @@ module QA
@auto_devops_enabled = false
@visibility = :public
@template_name = nil
@import = false
self.name = "the_awesome_project"
end
......@@ -66,6 +70,8 @@ module QA
end
def fabricate!
return if @import
unless @standalone
group.visit!
Page::Group::Show.perform(&:go_to_new_project)
......
......@@ -4,28 +4,25 @@ require 'securerandom'
module QA
module Resource
class ProjectImportedFromGithub < Base
attr_accessor :name
attr_writer :personal_access_token, :github_repository_path
attribute :group do
Group.fabricate!
end
class ProjectImportedFromGithub < Resource::Project
def fabricate!
super
group.visit!
Page::Group::Show.perform(&:go_to_new_project)
Page::Project::New.perform(&:click_import_project)
go_to_import_tab
Page::Project::New.perform(&:click_github_link)
Page::Project::Import::Github.perform do |import_page|
import_page.add_personal_access_token(@personal_access_token)
import_page.add_personal_access_token(@github_personal_access_token)
import_page.import!(@github_repository_path, @name)
end
end
def go_to_import_tab
Page::Project::New.perform(&:click_import_project)
end
end
end
end
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