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
ced47ed4
Commit
ced47ed4
authored
Jan 28, 2021
by
Desiree Chevalier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add e2e test for default mr templates
Adds an e2e test for default mr templates and updates qa selectors.
parent
2a366afb
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
76 additions
and
30 deletions
+76
-30
app/views/projects/_merge_request_merge_method_settings.html.haml
...s/projects/_merge_request_merge_method_settings.html.haml
+1
-1
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+5
-5
app/views/projects/settings/_general.html.haml
app/views/projects/settings/_general.html.haml
+2
-2
ee/app/views/projects/_merge_request_approvals_settings.html.haml
...iews/projects/_merge_request_approvals_settings.html.haml
+2
-2
ee/app/views/projects/_merge_request_settings.html.haml
ee/app/views/projects/_merge_request_settings.html.haml
+1
-1
qa/qa/ee/page/project/settings/main.rb
qa/qa/ee/page/project/settings/main.rb
+2
-2
qa/qa/ee/page/project/settings/merge_request.rb
qa/qa/ee/page/project/settings/merge_request.rb
+11
-0
qa/qa/page/project/settings/main.rb
qa/qa/page/project/settings/main.rb
+5
-8
qa/qa/page/project/settings/merge_request.rb
qa/qa/page/project/settings/merge_request.rb
+4
-4
qa/qa/resource/merge_request.rb
qa/qa/resource/merge_request.rb
+1
-1
qa/qa/specs/features/ee/browser_ui/3_create/merge_request/default_merge_request_template_spec.rb
...eate/merge_request/default_merge_request_template_spec.rb
+38
-0
spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb
...cts/settings/user_manages_merge_requests_settings_spec.rb
+4
-4
No files found.
app/views/projects/_merge_request_merge_method_settings.html.haml
View file @
ced47ed4
...
...
@@ -22,7 +22,7 @@
=
s_
(
'ProjectSettings|When conflicts arise the user is given the option to rebase'
)
.form-check.mb-2
=
form
.
radio_button
:merge_method
,
:ff
,
class:
"js-merge-method-radio
qa-radio-button-merge-ff form-check-input"
=
form
.
radio_button
:merge_method
,
:ff
,
class:
"js-merge-method-radio
form-check-input"
,
data:
{
qa_selector:
'merge_ff_radio_button'
}
=
label_tag
:project_merge_method_ff
,
class:
'form-check-label'
do
=
s_
(
'ProjectSettings|Fast-forward merge'
)
.text-secondary
...
...
app/views/projects/edit.html.haml
View file @
ced47ed4
...
...
@@ -27,7 +27,7 @@
=
render
"visibility_modal"
=
f
.
submit
_
(
'Save changes'
),
class:
"btn gl-button btn-success
#{
(
'js-confirm-danger'
if
show_visibility_confirm_modal?
(
@project
))
}
"
,
data:
{
qa_selector:
'visibility_features_permissions_save_button'
,
check_field_name:
(
"project[visibility_level]"
if
show_visibility_confirm_modal?
(
@project
)),
check_compare_value:
@project
.
visibility_level
}
%section
.
qa-merge-request-settings.rspec-merge-request-settings.settings.merge-requests-feature.no-animate
#js-merge-request-settings
{
class:
[(
'expanded'
if
expanded
),
(
'hidden'
if
@project
.
project_feature
.
send
(
:merge_requests_access_level
)
==
0
)]
}
%section
.
rspec-merge-request-settings.settings.merge-requests-feature.no-animate
#js-merge-request-settings
{
class:
[(
'expanded'
if
expanded
),
(
'hidden'
if
@project
.
project_feature
.
send
(
:merge_requests_access_level
)
==
0
)],
data:
{
qa_selector:
'merge_request_settings_content'
}
}
.settings-header
%h4
.settings-title.js-settings-toggle.js-settings-toggle-trigger-only
=
_
(
'Merge requests'
)
%button
.btn.gl-button.btn-default.js-settings-toggle
{
type:
'button'
}=
expanded
?
_
(
'Collapse'
)
:
_
(
'Expand'
)
...
...
@@ -39,7 +39,7 @@
=
form_for
@project
,
remote:
true
,
html:
{
multipart:
true
,
class:
"merge-request-settings-form js-mr-settings-form"
},
authenticity_token:
true
do
|
f
|
%input
{
name:
'update_section'
,
type:
'hidden'
,
value:
'js-merge-request-settings'
}
=
render
'projects/merge_request_settings'
,
form:
f
=
f
.
submit
_
(
'Save changes'
),
class:
"btn gl-button btn-success
qa-save-merge-request-changes rspec-save-merge-request-changes"
=
f
.
submit
_
(
'Save changes'
),
class:
"btn gl-button btn-success
rspec-save-merge-request-changes"
,
data:
{
qa_selector:
'save_merge_request_changes_button'
}
=
render_if_exists
'projects/merge_request_approvals_settings'
,
expanded:
expanded
...
...
@@ -60,7 +60,7 @@
=
render
'projects/service_desk_settings'
%section
.
qa-advanced-settings.settings.advanced-settings.no-animate
#js-project-advanced-settings
{
class:
(
'expanded'
if
expanded
)
}
%section
.
settings.advanced-settings.no-animate
#js-project-advanced-settings
{
class:
(
'expanded'
if
expanded
),
data:
{
qa_selector:
'advanced_settings_content'
}
}
.settings-header
%h4
.settings-title.js-settings-toggle.js-settings-toggle-trigger-only
=
_
(
'Advanced'
)
%button
.btn.gl-button.btn-default.js-settings-toggle
{
type:
'button'
}=
expanded
?
_
(
'Collapse'
)
:
_
(
'Expand'
)
...
...
@@ -96,8 +96,8 @@
.input-group-prepend
.input-group-text
#{
Gitlab
::
Utils
.
append_path
(
root_url
,
@project
.
namespace
.
full_path
)
}
/
=
f
.
text_field
:path
,
class:
'form-control
qa-project-path-field h-auto'
=
f
.
submit
_
(
'Change path'
),
class:
"gl-button btn btn-warning
qa-change-path-button"
=
f
.
text_field
:path
,
class:
'form-control
h-auto'
,
data:
{
qa_selector:
'project_path_field'
}
=
f
.
submit
_
(
'Change path'
),
class:
"gl-button btn btn-warning
"
,
data:
{
qa_selector:
'change_path_button'
}
=
render
'transfer'
,
project:
@project
...
...
app/views/projects/settings/_general.html.haml
View file @
ced47ed4
...
...
@@ -7,7 +7,7 @@
.form-group.col-md-5
=
f
.
label
:name
,
class:
'label-bold'
,
for:
'project_name_edit'
do
=
_
(
'Project name'
)
=
f
.
text_field
:name
,
class:
'form-control gl-form-input
qa-project-name-field'
,
id:
"project_name_edit"
=
f
.
text_field
:name
,
class:
'form-control gl-form-input
'
,
id:
"project_name_edit"
,
data:
{
qa_selector:
'project_name_field'
}
.form-group.col-md-7
=
f
.
label
:id
,
class:
'label-bold'
do
...
...
@@ -40,4 +40,4 @@
%hr
=
link_to
_
(
'Remove avatar'
),
project_avatar_path
(
@project
),
data:
{
confirm:
_
(
'Avatar will be removed. Are you sure?'
)},
method: :delete
,
class:
'btn btn-link'
=
f
.
submit
_
(
'Save changes'
),
class:
"gl-button btn btn-success gl-mt-6
qa-save-naming-topics-avatar-button"
=
f
.
submit
_
(
'Save changes'
),
class:
"gl-button btn btn-success gl-mt-6
"
,
data:
{
qa_selector:
'save_naming_topics_avatar_button'
}
ee/app/views/projects/_merge_request_approvals_settings.html.haml
View file @
ced47ed4
-
return
unless
@project
.
feature_available?
(
:merge_requests
,
current_user
)
-
return
unless
@project
.
feature_available?
(
:merge_request_approvers
,
current_user
)
%section
.settings.merge-requests-feature.no-animate
#js-merge-request-approval-settings
{
class:
[(
'expanded'
if
expanded
)],
data:
{
qa_selector:
'merge_request_approvals_settings'
}
}
%section
.settings.merge-requests-feature.no-animate
#js-merge-request-approval-settings
{
class:
[(
'expanded'
if
expanded
)],
data:
{
qa_selector:
'merge_request_approvals_settings
_content
'
}
}
.settings-header
%h4
.settings-title.js-settings-toggle.js-settings-toggle-trigger-only
=
_
(
"Merge request approvals"
)
%button
.gl-button.btn.btn-default.js-settings-toggle
{
type:
'button'
}=
expanded
?
_
(
"Collapse"
)
:
_
(
"Expand"
)
...
...
@@ -13,4 +13,4 @@
=
form_for
@project
,
remote:
true
,
html:
{
class:
"merge-request-approval-settings-form js-mr-approvals-form"
},
authenticity_token:
true
do
|
f
|
%input
{
name:
'update_section'
,
type:
'hidden'
,
value:
'js-merge-request-approval-settings'
}
=
render
'projects/merge_request_approvals_settings_form'
,
form:
f
,
project:
@project
=
f
.
submit
_
(
"Save changes"
),
class:
"btn gl-button btn-success
qa-save-merge-request-approval-settings-button gl-mt-4"
=
f
.
submit
_
(
"Save changes"
),
class:
"btn gl-button btn-success
gl-mt-4"
,
data:
{
qa_selector:
'save_merge_request_approval_settings_button'
}
ee/app/views/projects/_merge_request_settings.html.haml
View file @
ced47ed4
...
...
@@ -15,7 +15,7 @@
=
form
.
label
:merge_requests_template
,
class:
'label-bold'
do
=
_
(
'Default description template for merge requests'
)
=
link_to
sprite_icon
(
'question-o'
),
help_page_path
(
'user/project/description_templates'
),
target:
'_blank'
=
form
.
text_area
:merge_requests_template
,
class:
"form-control"
,
rows:
3
=
form
.
text_area
:merge_requests_template
,
class:
"form-control"
,
rows:
3
,
data:
{
qa_selector:
'default_merge_request_template_field'
}
.text-secondary
-
link_start
=
'<a href="%{url}" target="_blank" rel="noopener noreferrer">'
.
html_safe
%
{
url:
help_page_path
(
'user/markdown'
)
}
=
_
(
'Description parsed with %{link_start}GitLab Flavored Markdown%{link_end}'
).
html_safe
%
{
link_start:
link_start
,
link_end:
'</a>'
.
html_safe
}
qa/qa/ee/page/project/settings/main.rb
View file @
ced47ed4
...
...
@@ -17,7 +17,7 @@ module QA
end
view
'ee/app/views/projects/_merge_request_approvals_settings.html.haml'
do
element
:merge_request_approvals_settings
element
:merge_request_approvals_settings
_content
end
end
end
...
...
@@ -29,7 +29,7 @@ module QA
end
def
expand_merge_request_approvals_settings
(
&
block
)
expand_content
(
:merge_request_approvals_settings
)
do
expand_content
(
:merge_request_approvals_settings
_content
)
do
MergeRequestApprovals
.
perform
(
&
block
)
end
end
...
...
qa/qa/ee/page/project/settings/merge_request.rb
View file @
ced47ed4
...
...
@@ -18,6 +18,10 @@ module QA
element
:merged_results_pipeline_checkbox
end
view
'ee/app/views/projects/_merge_request_settings.html.haml'
do
element
:default_merge_request_template_field
end
view
'ee/app/views/projects/_merge_trains_settings.html.haml'
do
element
:merge_trains_checkbox
end
...
...
@@ -37,6 +41,13 @@ module QA
click_merge_trains_checkbox
click_save_changes
end
def
set_default_merge_request_template
(
template
)
fill_element
(
:default_merge_request_template_field
,
template
)
click_save_changes
wait_for_requests
end
end
end
end
...
...
qa/qa/page/project/settings/main.rb
View file @
ced47ed4
...
...
@@ -11,8 +11,9 @@ module QA
include
Component
::
Breadcrumbs
view
'app/views/projects/edit.html.haml'
do
element
:advanced_settings
element
:merge_request_settings
element
:advanced_settings_content
element
:merge_request_settings_content
element
:visibility_features_permissions_content
end
view
'app/views/projects/settings/_general.html.haml'
do
...
...
@@ -20,10 +21,6 @@ module QA
element
:save_naming_topics_avatar_button
end
view
'app/views/projects/edit.html.haml'
do
element
:visibility_features_permissions_content
end
def
rename_project_to
(
name
)
fill_project_name
(
name
)
click_save_changes
...
...
@@ -38,13 +35,13 @@ module QA
end
def
expand_advanced_settings
(
&
block
)
expand_content
(
:advanced_settings
)
do
expand_content
(
:advanced_settings
_content
)
do
Advanced
.
perform
(
&
block
)
end
end
def
expand_merge_requests_settings
(
&
block
)
expand_content
(
:merge_request_settings
)
do
expand_content
(
:merge_request_settings
_content
)
do
MergeRequest
.
perform
(
&
block
)
end
end
...
...
qa/qa/page/project/settings/merge_request.rb
View file @
ced47ed4
...
...
@@ -8,11 +8,11 @@ module QA
include
QA
::
Page
::
Settings
::
Common
view
'app/views/projects/edit.html.haml'
do
element
:save_merge_request_changes
element
:save_merge_request_changes
_button
end
view
'app/views/projects/_merge_request_merge_method_settings.html.haml'
do
element
:
radio_button_merge_ff
element
:
merge_ff_radio_button
end
view
'app/views/projects/_merge_request_merge_checks_settings.html.haml'
do
...
...
@@ -20,11 +20,11 @@ module QA
end
def
click_save_changes
click_element
:save_merge_request_changes
click_element
:save_merge_request_changes
_button
end
def
enable_ff_only
click_element
:
radio_button_merge_ff
click_element
:
merge_ff_radio_button
click_save_changes
end
...
...
qa/qa/resource/merge_request.rb
View file @
ced47ed4
...
...
@@ -75,7 +75,7 @@ module QA
Page
::
MergeRequest
::
New
.
perform
do
|
new_page
|
new_page
.
fill_title
(
@title
)
new_page
.
choose_template
(
@template
)
if
@template
new_page
.
fill_description
(
@description
)
unless
@template
new_page
.
fill_description
(
@description
)
if
@description
&&
!
@template
new_page
.
choose_milestone
(
@milestone
)
if
@milestone
new_page
.
assign_to_me
if
@assignee
==
'me'
labels
.
each
do
|
label
|
...
...
qa/qa/specs/features/ee/browser_ui/3_create/merge_request/default_merge_request_template_spec.rb
0 → 100644
View file @
ced47ed4
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Create'
do
describe
'Default merge request templates'
do
let
(
:default_template_project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'default-mr-template-project'
end
end
let
(
:template_content
)
{
'This is a default merge request template'
}
before
do
Flow
::
Login
.
sign_in
end
it
'uses default template when creating a merge request'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1232'
do
default_template_project
.
visit!
Page
::
Project
::
Menu
.
perform
(
&
:go_to_general_settings
)
Page
::
Project
::
Settings
::
Main
.
perform
(
&
:expand_merge_requests_settings
)
Page
::
Project
::
Settings
::
MergeRequest
.
perform
do
|
mr_settings
|
mr_settings
.
set_default_merge_request_template
(
template_content
)
end
Resource
::
MergeRequest
.
fabricate_via_browser_ui!
do
|
merge_request
|
merge_request
.
project
=
default_template_project
merge_request
.
description
=
nil
end
Page
::
MergeRequest
::
Show
.
perform
do
|
merge_request
|
expect
(
merge_request
).
to
have_description
(
template_content
)
end
end
end
end
end
spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb
View file @
ced47ed4
...
...
@@ -133,7 +133,7 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do
it
'when unchecked sets :remove_source_branch_after_merge to false'
do
uncheck
(
'project_remove_source_branch_after_merge'
)
within
(
'.merge-request-settings-form'
)
do
find
(
'.
qa
-save-merge-request-changes'
)
find
(
'.
rspec
-save-merge-request-changes'
)
click_on
(
'Save changes'
)
end
...
...
@@ -157,7 +157,7 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do
choose
(
'project_project_setting_attributes_squash_option_default_on'
)
within
(
'.merge-request-settings-form'
)
do
find
(
'.
qa
-save-merge-request-changes'
)
find
(
'.
rspec
-save-merge-request-changes'
)
click_on
(
'Save changes'
)
end
...
...
@@ -172,7 +172,7 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do
choose
(
'project_project_setting_attributes_squash_option_always'
)
within
(
'.merge-request-settings-form'
)
do
find
(
'.
qa
-save-merge-request-changes'
)
find
(
'.
rspec
-save-merge-request-changes'
)
click_on
(
'Save changes'
)
end
...
...
@@ -187,7 +187,7 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do
choose
(
'project_project_setting_attributes_squash_option_never'
)
within
(
'.merge-request-settings-form'
)
do
find
(
'.
qa
-save-merge-request-changes'
)
find
(
'.
rspec
-save-merge-request-changes'
)
click_on
(
'Save changes'
)
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