summaryrefslogtreecommitdiff
path: root/features/steps/shared
diff options
context:
space:
mode:
Diffstat (limited to 'features/steps/shared')
-rw-r--r--features/steps/shared/diff_note.rb44
-rw-r--r--features/steps/shared/note.rb14
2 files changed, 36 insertions, 22 deletions
diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb
index c4f89ca31c9..27a95aeb19a 100644
--- a/features/steps/shared/diff_note.rb
+++ b/features/steps/shared/diff_note.rb
@@ -20,11 +20,14 @@ module SharedDiffNote
end
step 'I leave a diff comment like "Typo, please fix"' do
- click_diff_line(sample_commit.line_code)
- page.within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
- fill_in "note[note]", with: "Typo, please fix"
- find(".js-comment-button").trigger("click")
- sleep 0.05
+ page.within(diff_file_selector) do
+ click_diff_line(sample_commit.line_code)
+
+ page.within("form[rel$='#{sample_commit.line_code}']") do
+ fill_in "note[note]", with: "Typo, please fix"
+ find(".js-comment-button").trigger("click")
+ sleep 0.05
+ end
end
end
@@ -45,28 +48,37 @@ module SharedDiffNote
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
- fill_in "note[note]", with: "Should fix it :smile:"
- find('.js-md-preview-button').click
+ page.within(diff_file_selector) do
+ click_diff_line(sample_commit.line_code)
+
+ page.within("form[rel$='#{sample_commit.line_code}']") do
+ fill_in "note[note]", with: "Should fix it :smile:"
+ find('.js-md-preview-button').click
+ end
end
end
step 'I preview another diff comment text like "DRY this up"' do
- click_diff_line(sample_commit.del_line_code)
+ page.within(diff_file_selector) do
+ click_diff_line(sample_commit.del_line_code)
- page.within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do
- fill_in "note[note]", with: "DRY this up"
- find('.js-md-preview-button').click
+ page.within("form[rel$='#{sample_commit.del_line_code}']") do
+ fill_in "note[note]", with: "DRY this up"
+ find('.js-md-preview-button').click
+ end
end
end
step 'I open a diff comment form' do
- click_diff_line(sample_commit.line_code)
+ page.within(diff_file_selector) do
+ click_diff_line(sample_commit.line_code)
+ end
end
step 'I open another diff comment form' do
- click_diff_line(sample_commit.del_line_code)
+ page.within(diff_file_selector) do
+ click_diff_line(sample_commit.del_line_code)
+ end
end
step 'I write a diff comment like ":-1: I don\'t like this"' do
@@ -194,7 +206,7 @@ module SharedDiffNote
end
def diff_file_selector
- ".diff-file:nth-of-type(1)"
+ '.diff-file:nth-of-type(1)'
end
def click_diff_line(code)
diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb
index b2675546a14..f6aabfefeff 100644
--- a/features/steps/shared/note.rb
+++ b/features/steps/shared/note.rb
@@ -2,8 +2,10 @@ module SharedNote
include Spinach::DSL
step 'I delete a comment' do
- find('.note').hover
- find(".js-note-delete").click
+ page.within('.notes') do
+ find('.note').hover
+ find(".js-note-delete").click
+ end
end
step 'I haven\'t written any comment text' do
@@ -16,7 +18,6 @@ module SharedNote
page.within(".js-main-target-form") do
fill_in "note[note]", with: "XML attached"
click_button "Add Comment"
- sleep 0.05
end
end
@@ -123,13 +124,14 @@ module SharedNote
end
step 'I edit the last comment with a +1' do
- find(".note").hover
- find('.js-note-edit').click
+ page.within(".notes") do
+ find(".note").hover
+ find('.js-note-edit').click
+ end
page.within(".current-note-edit-form") do
fill_in 'note[note]', with: '+1 Awesome!'
click_button 'Save Comment'
- sleep 0.05
end
end