diff options
Diffstat (limited to 'spec/features/issues/note_polling_spec.rb')
-rw-r--r-- | spec/features/issues/note_polling_spec.rb | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/spec/features/issues/note_polling_spec.rb b/spec/features/issues/note_polling_spec.rb index 80f57906506..9f08ecc214b 100644 --- a/spec/features/issues/note_polling_spec.rb +++ b/spec/features/issues/note_polling_spec.rb @@ -1,12 +1,14 @@ require 'spec_helper' -feature 'Issue notes polling', :feature, :js do - let(:project) { create(:empty_project, :public) } +feature 'Issue notes polling', :js do + include NoteInteractionHelpers + + let(:project) { create(:project, :public) } let(:issue) { create(:issue, project: project) } describe 'creates' do before do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it 'displays the new comment' do @@ -25,8 +27,8 @@ feature 'Issue notes polling', :feature, :js do let!(:existing_note) { create(:note, noteable: issue, project: project, author: user, note: note_text) } before do - login_as(user) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(user) + visit project_issue_path(project, issue) end it 'has .original-note-content to compare against' do @@ -48,7 +50,7 @@ feature 'Issue notes polling', :feature, :js do end it 'when editing but have not changed anything, and an update comes in, show the updated content in the textarea' do - find("#note_#{existing_note.id} .js-note-edit").click + click_edit_action(existing_note) expect(page).to have_field("note[note]", with: note_text) @@ -58,19 +60,18 @@ feature 'Issue notes polling', :feature, :js do end it 'when editing but you changed some things, and an update comes in, show a warning' do - find("#note_#{existing_note.id} .js-note-edit").click + click_edit_action(existing_note) expect(page).to have_field("note[note]", with: note_text) find("#note_#{existing_note.id} .js-note-text").set('something random') - update_note(existing_note, updated_text) expect(page).to have_selector(".alert") end it 'when editing but you changed some things, an update comes in, and you press cancel, show the updated content' do - find("#note_#{existing_note.id} .js-note-edit").click + click_edit_action(existing_note) expect(page).to have_field("note[note]", with: note_text) @@ -92,8 +93,8 @@ feature 'Issue notes polling', :feature, :js do let!(:existing_note) { create(:note, noteable: issue, project: project, author: user1, note: note_text) } before do - login_as(user2) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(user2) + visit project_issue_path(project, issue) end it 'has .original-note-content to compare against' do @@ -113,8 +114,8 @@ feature 'Issue notes polling', :feature, :js do let!(:system_note) { create(:system_note, noteable: issue, project: project, author: user, note: note_text) } before do - login_as(user) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(user) + visit project_issue_path(project, issue) end it 'has .original-note-content to compare against' do @@ -128,4 +129,12 @@ feature 'Issue notes polling', :feature, :js do note.update(note: new_text) page.execute_script('notes.refresh();') end + + def click_edit_action(note) + note_element = find("#note_#{note.id}") + + open_more_actions_dropdown(note) + + note_element.find('.js-note-edit').click + end end |