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
8c70f4c2
Commit
8c70f4c2
authored
Apr 06, 2021
by
Tomislav Nikić
Committed by
Mark Lapierre
Apr 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suggestions on a Merge Request | E2E & Cleanup
parent
c624b1e0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
13 deletions
+92
-13
app/assets/javascripts/vue_shared/components/markdown/apply_suggestion.vue
...ripts/vue_shared/components/markdown/apply_suggestion.vue
+3
-0
app/views/projects/merge_requests/show.html.haml
app/views/projects/merge_requests/show.html.haml
+1
-1
qa/qa/page/merge_request/show.rb
qa/qa/page/merge_request/show.rb
+17
-0
qa/qa/specs/features/browser_ui/3_create/merge_request/suggestions/batch_suggestion_spec.rb
...create/merge_request/suggestions/batch_suggestion_spec.rb
+11
-12
qa/qa/specs/features/browser_ui/3_create/merge_request/suggestions/custom_commit_suggestion_spec.rb
...erge_request/suggestions/custom_commit_suggestion_spec.rb
+60
-0
No files found.
app/assets/javascripts/vue_shared/components/markdown/apply_suggestion.vue
View file @
8c70f4c2
...
...
@@ -34,6 +34,7 @@ export default {
boundary=
"window"
right
menu-class=
"gl-w-full!"
data-qa-selector=
"apply_suggestion_button"
@
shown=
"$refs.commitMessage.$el.focus()"
>
<gl-dropdown-form
class=
"gl-px-4! gl-m-0!"
>
...
...
@@ -44,12 +45,14 @@ export default {
v-model=
"message"
:placeholder=
"defaultCommitMessage"
submit-on-enter
data-qa-selector=
"commit_message_textbox"
@
submit=
"onApply"
/>
<gl-button
class=
"gl-w-auto! gl-mt-3 gl-text-center! gl-hover-text-white! gl-transition-medium! float-right"
category=
"primary"
variant=
"success"
data-qa-selector=
"commit_with_custom_message_button"
@
click=
"onApply"
>
{{
__
(
'
Apply
'
)
}}
...
...
app/views/projects/merge_requests/show.html.haml
View file @
8c70f4c2
...
...
@@ -28,7 +28,7 @@
=
_
(
"Overview"
)
%span
.badge.badge-pill
=
@merge_request
.
related_notes
.
user
.
count
-
if
@merge_request
.
source_project
=
render
"projects/merge_requests/tabs/tab"
,
name:
"commits"
,
class:
"commits-tab"
do
=
render
"projects/merge_requests/tabs/tab"
,
name:
"commits"
,
class:
"commits-tab"
,
qa_selector:
"commits_tab"
do
=
tab_link_for
@merge_request
,
:commits
do
=
_
(
"Commits"
)
%span
.badge.badge-pill
=
@commits_count
...
...
qa/qa/page/merge_request/show.rb
View file @
8c70f4c2
...
...
@@ -49,6 +49,7 @@ module QA
view
'app/views/projects/merge_requests/show.html.haml'
do
element
:notes_tab
element
:commits_tab
element
:diffs_tab
end
...
...
@@ -111,6 +112,12 @@ module QA
element
:cherry_pick_button
end
view
'app/assets/javascripts/vue_shared/components/markdown/apply_suggestion.vue'
do
element
:apply_suggestion_button
element
:commit_message_textbox
element
:commit_with_custom_message_button
end
def
start_review
click_element
(
:start_review_button
)
...
...
@@ -177,6 +184,10 @@ module QA
wait_for_requests
end
def
click_commits_tab
click_element
(
:commits_tab
)
end
def
click_diffs_tab
click_element
(
:diffs_tab
)
click_element
(
:dismiss_popover_button
)
if
has_element?
(
:dismiss_popover_button
,
wait:
1
)
...
...
@@ -356,6 +367,12 @@ module QA
click_element
(
:comment_now_button
)
end
def
apply_suggestion_with_message
(
message
)
click_element
(
:apply_suggestion_button
)
fill_element
(
:commit_message_textbox
,
message
)
click_element
(
:commit_with_custom_message_button
)
end
def
add_suggestion_to_batch
all_elements
(
:add_suggestion_batch_button
,
minimum:
1
).
first
.
click
end
...
...
qa/qa/specs/features/browser_ui/3_create/
transient/apply
_suggestion_spec.rb
→
qa/qa/specs/features/browser_ui/3_create/
merge_request/suggestions/batch
_suggestion_spec.rb
View file @
8c70f4c2
...
...
@@ -2,25 +2,23 @@
module
QA
RSpec
.
describe
'Create'
do
context
'
Transient tests
'
,
:transient
do
context
'
Add batch suggestions to a Merge Request
'
,
:transient
do
let
(
:project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'
project-for-transient-tes
t'
project
.
name
=
'
suggestions_projec
t'
end
end
let
(
:code_for_merge
)
do
Pathname
.
new
(
__dir__
)
.
join
(
'../../../../../fixtures/metrics_dashboards/templating.yml'
)
end
let
(
:merge_request
)
do
Resource
::
MergeRequest
.
fabricate_via_api!
do
|
merge_request
|
merge_request
.
project
=
project
merge_request
.
title
=
'Transient MR'
merge_request
.
description
=
'detecting transient bugs'
merge_request
.
file_content
=
File
.
read
(
code_for_merge
)
merge_request
.
title
=
'Needs some suggestions'
merge_request
.
description
=
'... so please add them.'
merge_request
.
file_content
=
File
.
read
(
Pathname
.
new
(
__dir__
)
.
join
(
'../../../../../../fixtures/metrics_dashboards/templating.yml'
)
)
end
end
...
...
@@ -30,6 +28,7 @@ module QA
before
do
project
.
add_member
(
dev_user
)
Flow
::
Login
.
sign_in
(
as:
dev_user
,
skip_page_validation:
true
)
merge_request
.
visit!
...
...
@@ -38,7 +37,7 @@ module QA
[
4
,
6
,
10
,
13
].
each
do
|
line_number
|
Page
::
MergeRequest
::
Show
.
perform
do
|
merge_request
|
merge_request
.
add_suggestion_to_diff
(
"This is the
#{
line_number
}
suggestion
!"
,
line_number
)
merge_request
.
add_suggestion_to_diff
(
"This is the
suggestion for line number
#{
line_number
}
!"
,
line_number
)
end
end
...
...
qa/qa/specs/features/browser_ui/3_create/merge_request/suggestions/custom_commit_suggestion_spec.rb
0 → 100644
View file @
8c70f4c2
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Create'
do
context
'Add suggestions to a Merge Request'
do
let
(
:commit_message
)
{
'Applying suggested change for testing purposes.'
}
let
(
:project
)
do
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'suggestions_project'
end
end
let
(
:merge_request
)
do
Resource
::
MergeRequest
.
fabricate_via_api!
do
|
merge_request
|
merge_request
.
project
=
project
merge_request
.
title
=
'Needs some suggestions'
merge_request
.
description
=
'... so please add them.'
merge_request
.
file_content
=
File
.
read
(
Pathname
.
new
(
__dir__
)
.
join
(
'../../../../../../fixtures/metrics_dashboards/templating.yml'
)
)
end
end
let
(
:dev_user
)
do
Resource
::
User
.
fabricate_or_use
(
Runtime
::
Env
.
gitlab_qa_username_1
,
Runtime
::
Env
.
gitlab_qa_password_1
)
end
before
do
project
.
add_member
(
dev_user
)
Flow
::
Login
.
sign_in
(
as:
dev_user
,
skip_page_validation:
true
)
merge_request
.
visit!
Page
::
MergeRequest
::
Show
.
perform
do
|
merge_request
|
merge_request
.
click_diffs_tab
merge_request
.
add_suggestion_to_diff
(
'This is the suggestion for line number 4!'
,
4
)
end
Flow
::
Login
.
sign_in
merge_request
.
visit!
end
it
'applies a single suggestion with a custom message'
do
Page
::
MergeRequest
::
Show
.
perform
do
|
merge_request
|
merge_request
.
click_diffs_tab
merge_request
.
apply_suggestion_with_message
(
commit_message
)
expect
(
merge_request
).
to
have_css
(
'.badge-success'
,
text:
'Applied'
)
merge_request
.
click_commits_tab
expect
(
merge_request
).
to
have_content
(
commit_message
)
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