summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-06-05 15:24:05 -0700
committerStan Hu <stanhu@gmail.com>2015-06-16 06:11:59 -0700
commita7932fe2fd63da4864afb01bff859f4e1fbe9576 (patch)
treecf217e07d0b4f468e0a3378407d7fddc29bd5310 /features
parent903132bc079970787333347209f6baebdd48800f (diff)
downloadgitlab-ce-a7932fe2fd63da4864afb01bff859f4e1fbe9576.tar.gz
Support commenting on a diff in side-by-side view
Closes https://github.com/gitlabhq/gitlabhq/issues/9283
Diffstat (limited to 'features')
-rw-r--r--features/project/commits/diff_comments.feature14
-rw-r--r--features/steps/project/commits/commits.rb9
-rw-r--r--features/steps/shared/diff_note.rb40
3 files changed, 55 insertions, 8 deletions
diff --git a/features/project/commits/diff_comments.feature b/features/project/commits/diff_comments.feature
index 56b9a13678d..4a2b870e082 100644
--- a/features/project/commits/diff_comments.feature
+++ b/features/project/commits/diff_comments.feature
@@ -77,3 +77,17 @@ Feature: Project Commits Diff Comments
And I submit the diff comment
Then I should not see the diff comment form
And I should see a discussion reply button
+
+ @javascript
+ Scenario: I can add a comment on a side-by-side commit diff (left side)
+ Given I open a diff comment form
+ And I click side-by-side diff button
+ When I leave a diff comment in a parallel view on the left side like "Old comment"
+ Then I should see a diff comment on the left side saying "Old comment"
+
+ @javascript
+ Scenario: I can add a comment on a side-by-side commit diff (right side)
+ Given I open a diff comment form
+ And I click side-by-side diff button
+ When I leave a diff comment in a parallel view on the right side like "New comment"
+ Then I should see a diff comment on the right side saying "New comment"
diff --git a/features/steps/project/commits/commits.rb b/features/steps/project/commits/commits.rb
index 4b19e3beed4..e6330ec457e 100644
--- a/features/steps/project/commits/commits.rb
+++ b/features/steps/project/commits/commits.rb
@@ -2,6 +2,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
+ include SharedDiffNote
include RepoHelpers
step 'I see project commits' do
@@ -88,14 +89,6 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
expect(links[1]['href']).to match %r{blob/#{sample_image_commit.new_blob_id}}
end
- step 'I click side-by-side diff button' do
- click_link "Side-by-side"
- end
-
- step 'I see side-by-side diff button' do
- expect(page).to have_content "Side-by-side"
- end
-
step 'I see inline diff button' do
expect(page).to have_content "Inline"
end
diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb
index a716ca5837c..c4f89ca31c9 100644
--- a/features/steps/shared/diff_note.rb
+++ b/features/steps/shared/diff_note.rb
@@ -28,6 +28,22 @@ module SharedDiffNote
end
end
+ step 'I leave a diff comment in a parallel view on the left side like "Old comment"' do
+ click_parallel_diff_line(sample_commit.line_code, 'old')
+ page.within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
+ fill_in "note[note]", with: "Old comment"
+ find(".js-comment-button").trigger("click")
+ end
+ end
+
+ step 'I leave a diff comment in a parallel view on the right side like "New comment"' do
+ click_parallel_diff_line(sample_commit.line_code, 'new')
+ page.within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
+ fill_in "note[note]", with: "New comment"
+ find(".js-comment-button").trigger("click")
+ end
+ end
+
step 'I preview a diff comment text like "Should fix it :smile:"' do
click_diff_line(sample_commit.line_code)
page.within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
@@ -102,6 +118,18 @@ module SharedDiffNote
end
end
+ step 'I should see a diff comment on the left side saying "Old comment"' do
+ page.within("#{diff_file_selector} .notes_content.parallel.old") do
+ expect(page).to have_content("Old comment")
+ end
+ end
+
+ step 'I should see a diff comment on the right side saying "New comment"' do
+ page.within("#{diff_file_selector} .notes_content.parallel.new") do
+ expect(page).to have_content("New comment")
+ end
+ end
+
step 'I should see a discussion reply button' do
page.within(diff_file_selector) do
expect(page).to have_button('Reply')
@@ -157,6 +185,14 @@ module SharedDiffNote
end
end
+ step 'I click side-by-side diff button' do
+ click_link "Side-by-side"
+ end
+
+ step 'I see side-by-side diff button' do
+ expect(page).to have_content "Side-by-side"
+ end
+
def diff_file_selector
".diff-file:nth-of-type(1)"
end
@@ -164,4 +200,8 @@ module SharedDiffNote
def click_diff_line(code)
find("button[data-line-code='#{code}']").click
end
+
+ def click_parallel_diff_line(code, line_type)
+ find("button[data-line-code='#{code}'][data-line-type='#{line_type}']").trigger('click')
+ end
end