diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-08 03:09:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-08 03:09:56 +0300 |
commit | 2824b15286295c161bac449af0d5235d31952eb3 (patch) | |
tree | cb1fc8eb52673de66432a208ad93914696d24203 /qa | |
parent | 17c8111494f51e79744c782db023804f5e4a7410 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/component/project/templates.rb | 15 | ||||
-rw-r--r-- | qa/qa/page/project/new.rb | 6 | ||||
-rw-r--r-- | qa/qa/resource/project.rb | 10 |
4 files changed, 35 insertions, 0 deletions
@@ -417,6 +417,10 @@ module QA module WebIDE autoload :Alert, 'qa/page/component/web_ide/alert' end + + module Project + autoload :Templates, 'qa/page/component/project/templates' + end end end diff --git a/qa/qa/page/component/project/templates.rb b/qa/qa/page/component/project/templates.rb new file mode 100644 index 00000000000..8baf15acdff --- /dev/null +++ b/qa/qa/page/component/project/templates.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module QA + module Page::Component + module Project + module Templates + def use_template_for_project(project_name) + within find_element(:template_option_row, text: project_name) do + click_element :use_template_button + end + end + end + end + end +end diff --git a/qa/qa/page/project/new.rb b/qa/qa/page/project/new.rb index 97214e22820..f6c015f64ea 100644 --- a/qa/qa/page/project/new.rb +++ b/qa/qa/page/project/new.rb @@ -5,6 +5,7 @@ module QA module Project class New < Page::Base include Page::Component::Select2 + include Page::Component::Project::Templates view 'app/views/projects/new.html.haml' do element :project_create_from_template_tab @@ -26,6 +27,11 @@ module QA element :import_github, "icon('github', text: 'GitHub')" # rubocop:disable QA/ElementWithPattern end + view 'app/views/projects/project_templates/_built_in_templates.html.haml' do + element :use_template_button + element :template_option_row + end + def choose_test_namespace choose_namespace(Runtime::Namespace.path) end diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb index f41328c2d82..00db5ea3a65 100644 --- a/qa/qa/resource/project.rb +++ b/qa/qa/resource/project.rb @@ -20,6 +20,7 @@ module QA attribute :standalone attribute :runners_token attribute :visibility + attribute :template_name attribute :group do Group.fabricate! @@ -52,6 +53,7 @@ module QA @initialize_with_readme = false @auto_devops_enabled = false @visibility = :public + @template_name = nil end def name=(raw_name) @@ -64,6 +66,13 @@ module QA Page::Group::Show.perform(&:go_to_new_project) end + if @template_name + 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::New.perform do |new_page| new_page.choose_test_namespace new_page.choose_name(@name) @@ -127,6 +136,7 @@ module QA end post_body[:repository_storage] = repository_storage if repository_storage + post_body[:template_name] = @template_name if @template_name post_body end |