Skip to content
Snippets Groups Projects
Unverified Commit b3fc72ce authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett
Browse files

Added new spec descriptions and scenarios

parent 122e191b
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -27,93 +27,168 @@ feature 'Diffs URL', js: true, feature: true do
let(:comment_button_class) { '.add-diff-note' }
 
before(:each) do
visit diffs_namespace_project_merge_request_path @project.namespace, @project, @merge_request
visit diffs_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)
click_link 'Side-by-side'
@old_line_number = first '.diff-line-num.old_line:not(.empty-cell)'
@new_line_number = first '.diff-line-num.new_line:not(.empty-cell)'
@old_line = first '.line_content[data-line-type="old"]'
@new_line = first '.line_content[data-line-type="new"]'
# @old_line_number = first '.diff-line-num.old_line:not(.empty-cell)'
# @new_line_number = first '.diff-line-num.new_line:not(.empty-cell)'
# @old_line = first '.line_content[data-line-type="old"]'
# @new_line = first '.line_content[data-line-type="new"]'
end
 
it 'shows a comment button on the old side when hovering over an old line number' do
@old_line_number.hover
expect(@old_line_number).to have_css comment_button_class
expect(@new_line_number).not_to have_css comment_button_class
context 'with an old line on the left and no line on the right' do
it 'should allow commenting on the left side' do
puts first('//*[contains(concat(" ", @class, " "), " line_holder ") and child::*[contains(concat(" ", @class, " "), " line_content ") and contains(concat(" ", @class, " "), " old ")] and child::*[contains(concat(" ", @class, " ")," line_content ") and contains(concat(" ", @class, " ")," new ")]]')
expect(page).to have_content 'NOPE'
end
it 'should not allow commenting on the right side' do
end
end
 
it 'shows a comment button on the old side when hovering over an old line' do
@old_line.hover
expect(@old_line_number).to have_css comment_button_class
expect(@new_line_number).not_to have_css comment_button_class
context 'with no line on the left and a new line on the right' do
it 'should allow commenting on the right side' do
end
it 'should not allow commenting on the left side' do
end
end
 
it 'shows a comment button on the new side when hovering over a new line number' do
@new_line_number.hover
expect(@new_line_number).to have_css comment_button_class
expect(@old_line_number).not_to have_css comment_button_class
context 'with an old line on the left and a new line on the right' do
it 'should allow commenting on the left side' do
end
it 'should allow commenting on the right side' do
end
end
 
it 'shows a comment button on the new side when hovering over a new line' do
@new_line.hover
expect(@new_line_number).to have_css comment_button_class
expect(@old_line_number).not_to have_css comment_button_class
context 'with an unchanged line on the left and an unchanged line on the right' do
it 'should allow commenting on the left side' do
end
it 'should allow commenting on the right side' do
end
end
context 'with a match line' do
it 'should not allow commenting on the left side' do
end
it 'should not allow commenting on the right side' do
end
end
# it 'shows a comment button on the old side when hovering over an old line number' do
# @old_line_number.hover
# expect(@old_line_number).to have_css comment_button_class
# expect(@new_line_number).not_to have_css comment_button_class
# end
#
# it 'shows a comment button on the old side when hovering over an old line' do
# @old_line.hover
# expect(@old_line_number).to have_css comment_button_class
# expect(@new_line_number).not_to have_css comment_button_class
# end
#
# it 'shows a comment button on the new side when hovering over a new line number' do
# @new_line_number.hover
# expect(@new_line_number).to have_css comment_button_class
# expect(@old_line_number).not_to have_css comment_button_class
# end
#
# it 'shows a comment button on the new side when hovering over a new line' do
# @new_line.hover
# expect(@new_line_number).to have_css comment_button_class
# expect(@old_line_number).not_to have_css comment_button_class
# end
end
 
context 'when hovering over the inline view diff file' do
let(:comment_button_class) { '.add-diff-note' }
 
before(:each) do
visit diffs_namespace_project_merge_request_path @project.namespace, @project, @merge_request
visit diffs_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)
click_link 'Inline'
@old_line_number = first '.diff-line-num.old_line:not(.unfold)'
@new_line_number = first '.diff-line-num.new_line:not(.unfold)'
@new_line = first '.line_content:not(.match)'
# @old_line_number = first '.diff-line-num.old_line:not(.unfold)'
# @new_line_number = first '.diff-line-num.new_line:not(.unfold)'
# @new_line = first '.line_content:not(.match)'
end
 
it 'shows a comment button on the old side when hovering over an old line number' do
@old_line_number.hover
expect(@old_line_number).to have_css comment_button_class
expect(@new_line_number).not_to have_css comment_button_class
end
context 'with a new line' do
it 'should allow commenting' do
 
it 'shows a comment button on the new side when hovering over a new line number' do
@new_line_number.hover
expect(@old_line_number).to have_css comment_button_class
expect(@new_line_number).not_to have_css comment_button_class
end
end
 
it 'shows a comment button on the new side when hovering over a new line' do
@new_line.hover
expect(@old_line_number).to have_css comment_button_class
expect(@new_line_number).not_to have_css comment_button_class
context 'with an old line' do
it 'should allow commenting' do
end
end
end
 
context 'when clicking a comment button' do
let(:test_note_comment) { 'this is a test note!' }
let(:note_class) { '.new-note' }
context 'with an unchanged line' do
it 'should allow commenting' do
 
before(:each) do
visit diffs_namespace_project_merge_request_path @project.namespace, @project, @merge_request
click_link 'Inline'
first('.diff-line-num.old_line:not(.unfold)').hover
find('.add-diff-note').click
end
end
 
it 'shows a note form' do
expect(page).to have_css note_class
end
context 'with a match line' do
it 'should not allow commenting' do
 
it 'can be submitted and viewed' do
fill_in 'note[note]', with: :test_note_comment
click_button 'Comment'
expect(page).to have_content :test_note_comment
end
end
 
it 'can be closed' do
find('.note-form-actions .btn-cancel').click
expect(page).not_to have_css note_class
end
# it 'shows a comment button on the old side when hovering over an old line number' do
# @old_line_number.hover
# expect(@old_line_number).to have_css comment_button_class
# expect(@new_line_number).not_to have_css comment_button_class
# end
#
# it 'shows a comment button on the new side when hovering over a new line number' do
# @new_line_number.hover
# expect(@old_line_number).to have_css comment_button_class
# expect(@new_line_number).not_to have_css comment_button_class
# end
#
# it 'shows a comment button on the new side when hovering over a new line' do
# @new_line.hover
# expect(@old_line_number).to have_css comment_button_class
# expect(@new_line_number).not_to have_css comment_button_class
# end
end
# context 'when clicking a comment button' do
# let(:test_note_comment) { 'this is a test note!' }
# let(:note_class) { '.new-note' }
#
# before(:each) do
# visit diffs_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)
# click_link 'Inline'
# first('.diff-line-num.old_line:not(.unfold)').hover
# find('.add-diff-note').click
# end
#
# it 'shows a note form' do
# expect(page).to have_css note_class
# end
#
# it 'can be submitted and viewed' do
# fill_in 'note[note]', with: test_note_comment
# click_button 'Comment'
# expect(page).to have_content test_note_comment
# end
#
# it 'can be closed' do
# find('.note-form-actions .btn-cancel').click
# expect(page).not_to have_css note_class
# end
# end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment