Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
09e233d2
Commit
09e233d2
authored
Jan 08, 2019
by
Sanad Liaquat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for group level project template
parent
6da54c0d
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
178 additions
and
9 deletions
+178
-9
app/views/projects/new.html.haml
app/views/projects/new.html.haml
+1
-1
ee/app/views/groups/_custom_project_templates_setting.html.haml
.../views/groups/_custom_project_templates_setting.html.haml
+3
-3
ee/app/views/projects/_project_templates.html.haml
ee/app/views/projects/_project_templates.html.haml
+2
-2
ee/app/views/users/_custom_project_templates_from_groups.html.haml
...ews/users/_custom_project_templates_from_groups.html.haml
+2
-2
qa/qa/ee.rb
qa/qa/ee.rb
+2
-0
qa/qa/ee/page/group/settings/general.rb
qa/qa/ee/page/group/settings/general.rb
+33
-0
qa/qa/ee/page/project/new.rb
qa/qa/ee/page/project/new.rb
+40
-0
qa/qa/ee/page/project/show.rb
qa/qa/ee/page/project/show.rb
+6
-0
qa/qa/page/component/select2.rb
qa/qa/page/component/select2.rb
+6
-0
qa/qa/page/project/new.rb
qa/qa/page/project/new.rb
+6
-0
qa/qa/page/settings/common.rb
qa/qa/page/settings/common.rb
+1
-1
qa/qa/specs/features/browser_ui/1_manage/ee_group/group_level_project_template_spec.rb
...ui/1_manage/ee_group/group_level_project_template_spec.rb
+76
-0
No files found.
app/views/projects/new.html.haml
View file @
09e233d2
...
...
@@ -38,7 +38,7 @@
%span
.d-block.d-sm-none
Blank
%li
.nav-item
{
role:
'presentation'
}
%a
.nav-link
{
href:
'#create-from-template-pane'
,
id:
'create-from-template-tab'
,
data:
{
toggle:
'tab'
,
track_label:
'create_from_template'
,
track_event:
"click_tab"
},
role:
'tab'
}
%span
.d-none.d-sm-block
Create from template
%span
.d-none.d-sm-block
.qa-project-create-from-template-tab
Create from template
%span
.d-block.d-sm-none
Template
%li
.nav-item
{
role:
'presentation'
}
%a
.nav-link
{
href:
'#import-project-pane'
,
id:
'import-project-tab'
,
data:
{
toggle:
'tab'
,
track_label:
'import_project'
,
track_event:
"click_tab"
},
role:
'tab'
}
...
...
ee/app/views/groups/_custom_project_templates_setting.html.haml
View file @
09e233d2
-
return
unless
::
Gitlab
::
CurrentSettings
.
custom_project_templates_enabled?
-
expanded
=
Rails
.
env
.
test?
%section
.settings.no-animate
{
class:
(
'expanded'
if
expanded
)
}
%section
.settings.no-animate
.qa-custom-project-templates
{
class:
(
'expanded'
if
expanded
)
}
.settings-header
%h4
=
s_
(
'GroupSettings|Custom project templates'
)
...
...
@@ -19,6 +19,6 @@
.form-group
=
f
.
label
:custom_project_templates_group_id
,
class:
'label-bold'
do
=
_
(
'Custom project templates'
)
=
groups_select_tag
(
'group[custom_project_templates_group_id]'
,
data:
{
parent_id:
@group
.
id
},
selected:
@group
.
custom_project_templates_group_id
,
class:
'input-clamp allowClear'
,
multiple:
false
)
=
groups_select_tag
(
'group[custom_project_templates_group_id]'
,
data:
{
parent_id:
@group
.
id
},
selected:
@group
.
custom_project_templates_group_id
,
class:
'input-clamp allowClear
qa-custom-project-template-select
'
,
multiple:
false
)
=
f
.
submit
_
(
'Save changes'
),
class:
'btn btn-success'
=
f
.
submit
_
(
'Save changes'
),
class:
'btn btn-success
qa-save-changes-button
'
ee/app/views/projects/_project_templates.html.haml
View file @
09e233d2
...
...
@@ -13,9 +13,9 @@
=
_
(
'Instance'
)
%span
.badge.badge-pill
=
project_template_count
%li
.custom-group-project-templates-tab
%a
.nav-link.js-custom-group-project-templates-nav-link
{
href:
"#custom-group-project-templates"
,
data:
{
toggle:
'tab'
}
}
%a
.nav-link.js-custom-group-project-templates-nav-link
.qa-group-templates-tab
{
href:
"#custom-group-project-templates"
,
data:
{
toggle:
'tab'
}
}
=
_
(
'Group'
)
%span
.badge.badge-pill
%span
.badge.badge-pill
.qa-group-template-tab-badge
=
group_project_templates_count
(
group_id
)
.tab-content
...
...
ee/app/views/users/_custom_project_templates_from_groups.html.haml
View file @
09e233d2
...
...
@@ -20,7 +20,7 @@
=
group
.
projects
.
count
-
group
.
projects
.
each
do
|
project
|
.template-option.align-items-center
.template-option.align-items-center
.qa-template-option-row
.avatar-container.s40
=
project_icon
(
project
,
alt:
project
.
name
,
class:
'btn-template-icon avatar s40 avatar-tile'
,
lazy:
false
)
.description.prepend-left-5
...
...
@@ -34,7 +34,7 @@
=
_
(
'Preview'
)
%label
.btn.btn-success.custom-template-button.choose-template.append-bottom-0
{
for:
project
.
name
}
%input
{
type:
"radio"
,
autocomplete:
"off"
,
name:
"project[template_name]"
,
id:
project
.
name
,
value:
project
.
name
,
data:
{
subgroup_id:
project
.
namespace_id
}
}
%span
%span
.qa-use-template-button
=
_
(
'Use template'
)
=
paginate
groups_with_project_templates
,
params:
{
controller:
'users'
,
action:
'available_templates'
,
username:
current_user
.
username
},
theme:
'gitlab'
,
remote:
true
...
...
qa/qa/ee.rb
View file @
09e233d2
...
...
@@ -22,6 +22,7 @@ module QA
module
Settings
autoload
:SamlSSO
,
'qa/ee/page/group/settings/saml_sso'
autoload
:LDAPSync
,
'qa/ee/page/group/settings/ldap_sync'
autoload
:General
,
'qa/ee/page/group/settings/general'
end
end
...
...
@@ -50,6 +51,7 @@ module QA
end
module
Project
autoload
:New
,
'qa/ee/page/project/new'
autoload
:Show
,
'qa/ee/page/project/show'
module
Issue
...
...
qa/qa/ee/page/group/settings/general.rb
0 → 100644
View file @
09e233d2
# frozen_string_literal: true
module
QA
module
EE
module
Page
module
Group
module
Settings
class
General
<
QA
::
Page
::
Base
include
::
QA
::
Page
::
Component
::
Select2
include
::
QA
::
Page
::
Settings
::
Common
view
'ee/app/views/groups/_custom_project_templates_setting.html.haml'
do
element
:custom_project_template_select
element
:custom_project_templates
element
:save_changes_button
end
def
choose_custom_project_template
(
path
)
expand_section
(
:custom_project_templates
)
within_element
(
:custom_project_template_select
)
do
clear_current_selection_if_present
end
click_element
:custom_project_template_select
search_and_select
(
path
)
click_element
:save_changes_button
end
end
end
end
end
end
end
qa/qa/ee/page/project/new.rb
0 → 100644
View file @
09e233d2
# frozen_string_literal: true
module
QA
module
EE
module
Page
module
Project
module
New
def
self
.
prepended
(
page
)
page
.
module_eval
do
view
'ee/app/views/projects/_project_templates.html.haml'
do
element
:group_templates_tab
element
:group_template_tab_badge
end
view
'ee/app/views/users/_custom_project_templates_from_groups.html.haml'
do
element
:use_template_button
element
:template_option_row
end
end
end
def
go_to_create_from_template_group_tab
go_to_create_from_template
click_element
(
:group_templates_tab
)
end
def
group_template_tab_badge_text
find_element
(
:group_template_tab_badge
).
text
end
def
use_template_for_project
(
project_name
)
within
find_element
(
:template_option_row
,
project_name
)
do
click_element
:use_template_button
end
end
end
end
end
end
end
qa/qa/ee/page/project/show.rb
View file @
09e233d2
...
...
@@ -18,6 +18,12 @@ module QA
def
wait_until_geo_max_replication_time
(
max_wait:
Runtime
::
Geo
.
max_file_replication_time
)
wait
(
max:
max_wait
)
{
yield
}
end
def
wait_for_import_success
wait
(
reload:
false
)
do
has_text?
(
'The project was successfully imported.'
)
end
end
end
end
end
...
...
qa/qa/page/component/select2.rb
View file @
09e233d2
...
...
@@ -6,6 +6,12 @@ module QA
find
(
'.select2-result-label'
,
text:
item_text
).
click
end
def
clear_current_selection_if_present
if
has_css?
(
'a > abbr.select2-search-choice-close'
,
wait:
1.0
)
find
(
'a > abbr.select2-search-choice-close'
).
click
end
end
def
search_and_select
(
item_text
)
find
(
'.select2-input'
).
set
(
item_text
)
select_item
(
item_text
)
...
...
qa/qa/page/project/new.rb
View file @
09e233d2
...
...
@@ -3,8 +3,10 @@ module QA
module
Project
class
New
<
Page
::
Base
include
Page
::
Component
::
Select2
prepend
EE
::
Page
::
Project
::
New
view
'app/views/projects/new.html.haml'
do
element
:project_create_from_template_tab
element
:import_project_tab
,
"Import project"
# rubocop:disable QA/ElementWithPattern
end
...
...
@@ -44,6 +46,10 @@ module QA
click_on
'Create project'
end
def
go_to_create_from_template
click_element
(
:project_create_from_template_tab
)
end
def
set_visibility
(
visibility
)
choose
visibility
end
...
...
qa/qa/page/settings/common.rb
View file @
09e233d2
...
...
@@ -11,7 +11,7 @@ module QA
wait
(
reload:
false
)
do
click_button
'Expand'
unless
first
(
'button'
,
text:
'Collapse'
)
page
.
has_content?
(
'Collapse'
)
has_content?
(
'Collapse'
)
end
yield
if
block_given?
...
...
qa/qa/specs/features/browser_ui/1_manage/ee_group/group_level_project_template_spec.rb
0 → 100644
View file @
09e233d2
# frozen_string_literal: true
require
'securerandom'
module
QA
context
:manage
do
describe
'Group level project template'
do
let
(
:files
)
do
[
{
name:
'file.txt'
,
content:
'foo'
},
{
name:
'README.md'
,
content:
'bar'
}
]
end
it
'user creates and uses group level project template'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
perform
(
&
:sign_in_using_credentials
)
template_container_group_name
=
"template-container-group-
#{
SecureRandom
.
hex
(
8
)
}
"
group
=
QA
::
Resource
::
Group
.
fabricate!
do
|
group
|
group
.
path
=
template_container_group_name
group
.
description
=
'Template container group'
end
template_project
=
Resource
::
Project
.
fabricate!
do
|
project
|
project
.
name
=
'template-project-1'
project
.
group
=
group
end
Resource
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
push
.
project
=
template_project
push
.
files
=
files
push
.
commit_message
=
'Add test files'
end
Page
::
Main
::
Menu
.
perform
(
&
:go_to_groups
)
Page
::
Dashboard
::
Groups
.
perform
{
|
page
|
page
.
go_to_group
(
Runtime
::
Namespace
.
sandbox_name
)
}
Page
::
Project
::
Menu
.
perform
(
&
:go_to_settings
)
EE
::
Page
::
Group
::
Settings
::
General
.
perform
do
|
settings
|
settings
.
choose_custom_project_template
(
"
#{
template_container_group_name
}
"
)
end
Page
::
Main
::
Menu
.
perform
(
&
:go_to_groups
)
Page
::
Dashboard
::
Groups
.
perform
{
|
page
|
page
.
go_to_group
(
Runtime
::
Namespace
.
sandbox_name
)
}
Page
::
Group
::
Show
.
perform
(
&
:go_to_new_project
)
Page
::
Project
::
New
.
perform
do
|
page
|
page
.
go_to_create_from_template_group_tab
expect
(
page
.
group_template_tab_badge_text
).
to
eq
"1"
expect
(
page
).
to
have_text
(
template_container_group_name
)
expect
(
page
).
to
have_text
(
template_project
.
name
)
page
.
use_template_for_project
(
template_project
.
name
)
page
.
choose_name
(
'Project using group level project template'
)
page
.
add_description
(
'Project using group level project template'
)
page
.
set_visibility
(
'Public'
)
page
.
create_new_project
end
Page
::
Project
::
Show
.
perform
(
&
:wait_for_import_success
)
files
.
each
do
|
file
|
expect
(
page
).
to
have_content
(
file
[
:name
])
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment