Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
e90615ca
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e90615ca
编写于
10月 21, 2019
作者:
S
Sanad Liaquat
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'qa-add-group-file-template-tests' into 'master'
Add group file template tests See merge request gitlab-org/gitlab!16267
上级
b1e572c0
c253718e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
168 addition
and
3 deletion
+168
-3
ee/app/views/groups/_templates_setting.html.haml
ee/app/views/groups/_templates_setting.html.haml
+3
-3
qa/qa/ee/page/group/settings/general.rb
qa/qa/ee/page/group/settings/general.rb
+25
-0
qa/qa/page/component/select2.rb
qa/qa/page/component/select2.rb
+8
-0
qa/qa/page/file/shared/commit_button.rb
qa/qa/page/file/shared/commit_button.rb
+4
-0
qa/qa/specs/features/ee/browser_ui/1_manage/group/group_file_template_spec.rb
.../ee/browser_ui/1_manage/group/group_file_template_spec.rb
+128
-0
未找到文件。
ee/app/views/groups/_templates_setting.html.haml
浏览文件 @
e90615ca
-
return
unless
@group
.
feature_available?
(
:custom_file_templates_for_namespace
)
%section
.settings.no-animate
#js-templates
{
class:
(
'expanded'
if
expanded
)
}
%section
.settings.no-animate
#js-templates
{
class:
(
'expanded'
if
expanded
)
,
data:
{
qa_selector:
'file_template_repositories'
}
}
.settings-header
%h4
=
_
(
'Templates'
)
...
...
@@ -18,6 +18,6 @@
.form-text.text-muted
=
_
(
'Select a template repository'
)
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'user/group/index.md'
,
anchor:
'group-file-templates-premium'
),
target:
'_blank'
=
project_select_tag
(
'group[file_template_project_id]'
,
class:
'project-item-select hidden-filter-value'
,
toggle_class:
'js-project-search js-project-filter js-filter-submit'
,
dropdown_class:
'dropdown-menu-selectable dropdown-menu-project js-filter-submit'
,
=
project_select_tag
(
'group[file_template_project_id]'
,
class:
'project-item-select hidden-filter-value
qa-file-template-repository-dropdown
'
,
toggle_class:
'js-project-search js-project-filter js-filter-submit'
,
dropdown_class:
'dropdown-menu-selectable dropdown-menu-project js-filter-submit'
,
placeholder:
_
(
'Search projects'
),
idAttribute:
'id'
,
data:
{
order_by:
'last_activity_at'
,
idattribute:
'id'
,
simple_filter:
true
,
allow_clear:
true
},
value:
@group
.
checked_file_template_project_id
)
=
f
.
submit
_
(
'Save changes'
),
class:
"btn btn-success"
=
f
.
submit
_
(
'Save changes'
),
class:
"btn btn-success"
,
data:
{
qa_selector:
'save_changes_button'
}
qa/qa/ee/page/group/settings/general.rb
浏览文件 @
e90615ca
...
...
@@ -28,6 +28,12 @@ module QA
view
'ee/app/views/shared/_repository_size_limit_setting.html.haml'
do
element
:repository_size_limit_field
end
view
'ee/app/views/groups/_templates_setting.html.haml'
do
element
:file_template_repository_dropdown
element
:file_template_repositories
element
:save_changes_button
end
end
end
...
...
@@ -72,6 +78,25 @@ module QA
def
set_repository_size_limit
(
limit
)
find_element
(
:repository_size_limit_field
).
set
limit
end
def
current_file_template_repository
expand_section
(
:file_template_repositories
)
within_element
(
:file_template_repository_dropdown
)
do
current_selection
end
end
def
choose_file_template_repository
(
path
)
expand_section
(
:file_template_repositories
)
within_element
(
:file_template_repository_dropdown
)
do
clear_current_selection_if_present
end
click_element
:file_template_repository_dropdown
search_and_select
(
path
)
click_element
:save_changes_button
end
end
end
end
...
...
qa/qa/page/component/select2.rb
浏览文件 @
e90615ca
...
...
@@ -20,12 +20,20 @@ module QA
def
search_and_select
(
item_text
)
find
(
'.select2-input'
).
set
(
item_text
)
wait_for_search_to_complete
select_item
(
item_text
)
end
def
expand_select_list
find
(
'span.select2-arrow'
).
click
end
def
wait_for_search_to_complete
has_css?
(
'.select2-active'
)
has_no_css?
(
'.select2-active'
,
wait:
30
)
end
end
end
end
...
...
qa/qa/page/file/shared/commit_button.rb
浏览文件 @
e90615ca
...
...
@@ -13,6 +13,10 @@ module QA
def
commit_changes
click_element
(
:commit_button
)
wait
(
reload:
false
,
max:
60
)
do
finished_loading?
end
end
end
end
...
...
qa/qa/specs/features/ee/browser_ui/1_manage/group/group_file_template_spec.rb
0 → 100644
浏览文件 @
e90615ca
# frozen_string_literal: true
module
QA
context
'Manage'
do
describe
'Group file templates'
do
include
Support
::
Api
templates
=
[
{
type:
'Dockerfile'
,
template:
'custom_dockerfile'
,
name:
'Dockerfile/custom_dockerfile.dockerfile'
,
content:
'dockerfile template test'
},
{
type:
'.gitignore'
,
template:
'custom_gitignore'
,
name:
'gitignore/custom_gitignore.gitignore'
,
content:
'gitignore template test'
},
{
type:
'.gitlab-ci.yml'
,
template:
'custom_gitlab-ci'
,
name:
'gitlab-ci/custom_gitlab-ci.yml'
,
content:
'gitlab-ci template test'
},
{
type:
'LICENSE'
,
template:
'custom_license'
,
name:
'LICENSE/custom_license.txt'
,
content:
'license template test'
}
]
before
(
:all
)
do
login
@group
=
Resource
::
Group
.
fabricate_via_api!
do
|
group
|
group
.
path
=
'template-group'
end
@file_template_project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
group
=
@group
project
.
name
=
'group-file-template-project'
project
.
description
=
'Add group file templates'
project
.
initialize_with_readme
=
true
end
templates
.
each
do
|
template
|
Resource
::
File
.
fabricate_via_api!
do
|
file
|
file
.
project
=
@file_template_project
file
.
name
=
template
[
:name
]
file
.
content
=
template
[
:content
]
file
.
commit_message
=
'Add test file templates'
end
end
@project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
group
=
@group
project
.
name
=
'group-file-template-project-2'
project
.
description
=
'Add files for group file templates'
project
.
initialize_with_readme
=
true
end
Page
::
Main
::
Menu
.
perform
(
&
:sign_out
)
end
after
(
:all
)
do
login
unless
Page
::
Main
::
Menu
.
perform
{
|
p
|
p
.
has_personal_area?
(
wait:
0
)
}
remove_group_file_template_if_set
end
templates
.
each
do
|
template
|
it
"creates file via custom
#{
template
[
:type
]
}
file template"
do
login
set_file_template_if_not_already_set
@project
.
visit!
Page
::
Project
::
Show
.
perform
(
&
:create_new_file!
)
Page
::
File
::
Form
.
perform
do
|
form
|
form
.
select_template
template
[
:type
],
template
[
:template
]
end
expect
(
page
).
to
have_content
(
template
[
:content
])
Page
::
File
::
Form
.
perform
(
&
:commit_changes
)
expect
(
page
).
to
have_content
(
'The file has been successfully created.'
)
expect
(
page
).
to
have_content
(
template
[
:type
])
expect
(
page
).
to
have_content
(
'Add new file'
)
expect
(
page
).
to
have_content
(
template
[
:content
])
end
end
def
login
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
perform
(
&
:sign_in_using_admin_credentials
)
end
def
set_file_template_if_not_already_set
api_client
=
Runtime
::
API
::
Client
.
new
(
:gitlab
)
response
=
get
Runtime
::
API
::
Request
.
new
(
api_client
,
"/groups/
#{
@group
.
id
}
"
).
url
if
parse_body
(
response
)[
:file_template_project_id
]
return
else
@group
.
visit!
Page
::
Group
::
Menu
.
perform
(
&
:click_group_general_settings_item
)
Page
::
Group
::
Settings
::
General
.
perform
do
|
general
|
general
.
choose_file_template_repository
(
@file_template_project
.
name
)
end
end
end
def
remove_group_file_template_if_set
api_client
=
Runtime
::
API
::
Client
.
new
(
:gitlab
)
response
=
get
Runtime
::
API
::
Request
.
new
(
api_client
,
"/groups/
#{
@group
.
id
}
"
).
url
if
parse_body
(
response
)[
:file_template_project_id
]
put
Runtime
::
API
::
Request
.
new
(
api_client
,
"/groups/
#{
@group
.
id
}
"
).
url
,
{
file_template_project_id:
nil
}
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录