Commit a9775930 authored by Luke Duncalfe's avatar Luke Duncalfe

Merge branch 'pl-feature-specs-add-note-wait' into 'master'

Wait for requests in `add_note` feature spec helper

See merge request gitlab-org/gitlab!54227
parents c951c3e2 7442310f
...@@ -63,8 +63,6 @@ RSpec.describe 'Issue promotion', :js do ...@@ -63,8 +63,6 @@ RSpec.describe 'Issue promotion', :js do
it 'promotes the issue' do it 'promotes the issue' do
add_note('/promote') add_note('/promote')
wait_for_requests
epic = Epic.last epic = Epic.last
expect(page).to have_content 'Promoted issue to an epic.' expect(page).to have_content 'Promoted issue to an epic.'
...@@ -82,8 +80,6 @@ RSpec.describe 'Issue promotion', :js do ...@@ -82,8 +80,6 @@ RSpec.describe 'Issue promotion', :js do
it 'promotes the issue' do it 'promotes the issue' do
add_note('/promote') add_note('/promote')
wait_for_requests
epic = Epic.last epic = Epic.last
expect(page).to have_content 'Promoted issue to an epic.' expect(page).to have_content 'Promoted issue to an epic.'
...@@ -115,8 +111,6 @@ RSpec.describe 'Issue promotion', :js do ...@@ -115,8 +111,6 @@ RSpec.describe 'Issue promotion', :js do
it 'promotes the issue' do it 'promotes the issue' do
add_note('/promote') add_note('/promote')
wait_for_requests
epic = Epic.last epic = Epic.last
expect(page).to have_content 'Promoted confidential issue to a non-confidential epic. Information in this issue is no longer confidential as epics are public to group members.' expect(page).to have_content 'Promoted confidential issue to a non-confidential epic. Information in this issue is no longer confidential as epics are public to group members.'
......
...@@ -29,7 +29,6 @@ RSpec.describe 'Resource weight events', :js do ...@@ -29,7 +29,6 @@ RSpec.describe 'Resource weight events', :js do
target_project.add_maintainer(user) target_project.add_maintainer(user)
add_note("/weight 2") add_note("/weight 2")
wait_for_requests
add_note("/weight 3\n/move #{target_project.full_path}") add_note("/weight 3\n/move #{target_project.full_path}")
end end
......
...@@ -15,7 +15,6 @@ RSpec.shared_examples 'status page quick actions' do ...@@ -15,7 +15,6 @@ RSpec.shared_examples 'status page quick actions' do
expect(StatusPage::PublishWorker).not_to receive(:perform_async).with(user.id, project.id, issue.id) expect(StatusPage::PublishWorker).not_to receive(:perform_async).with(user.id, project.id, issue.id)
add_note('/publish') add_note('/publish')
wait_for_requests
expect(page).not_to have_content('Issue published on status page.') expect(page).not_to have_content('Issue published on status page.')
expect(page).not_to have_content('Failed to publish issue on status page.') expect(page).not_to have_content('Failed to publish issue on status page.')
...@@ -26,7 +25,6 @@ RSpec.shared_examples 'status page quick actions' do ...@@ -26,7 +25,6 @@ RSpec.shared_examples 'status page quick actions' do
expect(StatusPage::PublishWorker).to receive(:perform_async).with(user.id, project.id, issue.id) expect(StatusPage::PublishWorker).to receive(:perform_async).with(user.id, project.id, issue.id)
add_note('/publish') add_note('/publish')
wait_for_requests
expect(page).to have_content('Issue published on status page.') expect(page).to have_content('Issue published on status page.')
end end
...@@ -51,7 +49,6 @@ RSpec.shared_examples 'status page quick actions' do ...@@ -51,7 +49,6 @@ RSpec.shared_examples 'status page quick actions' do
allow(StatusPage::PublishedIncident).to receive(:track).with(issue).and_raise('Error') allow(StatusPage::PublishedIncident).to receive(:track).with(issue).and_raise('Error')
add_note('/publish') add_note('/publish')
wait_for_requests
expect(page).not_to have_content("#{user.username} published this issue to the status page") expect(page).not_to have_content("#{user.username} published this issue to the status page")
expect(page).to have_content('Failed to publish issue on status page.') expect(page).to have_content('Failed to publish issue on status page.')
......
...@@ -39,8 +39,6 @@ RSpec.describe "User comments on issue", :js do ...@@ -39,8 +39,6 @@ RSpec.describe "User comments on issue", :js do
add_note(comment) add_note(comment)
wait_for_requests
expect(page.find('pre code').text).to eq code_block_content expect(page.find('pre code').text).to eq code_block_content
end end
...@@ -51,8 +49,6 @@ RSpec.describe "User comments on issue", :js do ...@@ -51,8 +49,6 @@ RSpec.describe "User comments on issue", :js do
add_note(comment) add_note(comment)
wait_for_requests
expect(page.find('svg.mermaid')).to have_content html_content expect(page.find('svg.mermaid')).to have_content html_content
within('svg.mermaid') { expect(page).not_to have_selector('img') } within('svg.mermaid') { expect(page).not_to have_selector('img') }
end end
......
...@@ -38,8 +38,6 @@ RSpec.describe 'User sees user popover', :js do ...@@ -38,8 +38,6 @@ RSpec.describe 'User sees user popover', :js do
it "displays user popover in system note" do it "displays user popover in system note" do
add_note("/assign @#{user.username}") add_note("/assign @#{user.username}")
wait_for_requests
find('.system-note-message .js-user-link').hover find('.system-note-message .js-user-link').hover
page.within(popover_selector) do page.within(popover_selector) do
......
...@@ -21,6 +21,8 @@ module Spec ...@@ -21,6 +21,8 @@ module Spec
find(".js-comment-submit-button").click find(".js-comment-submit-button").click
end end
end end
wait_for_requests
end end
def edit_note(note_text_to_edit, new_note_text) def edit_note(note_text_to_edit, new_note_text)
......
...@@ -44,7 +44,6 @@ RSpec.shared_examples 'close quick action' do |issuable_type| ...@@ -44,7 +44,6 @@ RSpec.shared_examples 'close quick action' do |issuable_type|
it 'creates the note and interprets the close quick action accordingly' do it 'creates the note and interprets the close quick action accordingly' do
add_note("this is done, close\n\n/close") add_note("this is done, close\n\n/close")
wait_for_requests
expect(page).not_to have_content '/close' expect(page).not_to have_content '/close'
expect(page).to have_content 'this is done, close' expect(page).to have_content 'this is done, close'
......
...@@ -54,8 +54,6 @@ RSpec.shared_examples 'clone quick action' do ...@@ -54,8 +54,6 @@ RSpec.shared_examples 'clone quick action' do
# Note that this is missing one `-` # Note that this is missing one `-`
add_note("/clone -with_notes #{target_project.full_path}") add_note("/clone -with_notes #{target_project.full_path}")
wait_for_requests
expect(page).to have_content 'Failed to clone this issue: wrong parameters.' expect(page).to have_content 'Failed to clone this issue: wrong parameters.'
expect(issue.reload).to be_open expect(issue.reload).to be_open
end end
...@@ -68,8 +66,6 @@ RSpec.shared_examples 'clone quick action' do ...@@ -68,8 +66,6 @@ RSpec.shared_examples 'clone quick action' do
it 'does not clone the issue' do it 'does not clone the issue' do
add_note("/clone #{project_unauthorized.full_path}") add_note("/clone #{project_unauthorized.full_path}")
wait_for_requests
expect(page).to have_content "Cloned this issue to #{project_unauthorized.full_path}." expect(page).to have_content "Cloned this issue to #{project_unauthorized.full_path}."
expect(issue.reload).to be_open expect(issue.reload).to be_open
...@@ -83,8 +79,6 @@ RSpec.shared_examples 'clone quick action' do ...@@ -83,8 +79,6 @@ RSpec.shared_examples 'clone quick action' do
it 'does not clone the issue' do it 'does not clone the issue' do
add_note("/clone not/valid") add_note("/clone not/valid")
wait_for_requests
expect(page).to have_content "Failed to clone this issue because target project doesn't exist." expect(page).to have_content "Failed to clone this issue because target project doesn't exist."
expect(issue.reload).to be_open expect(issue.reload).to be_open
end end
......
...@@ -22,8 +22,6 @@ RSpec.shared_examples 'create_merge_request quick action' do ...@@ -22,8 +22,6 @@ RSpec.shared_examples 'create_merge_request quick action' do
branch_name = 'invalid branch name' branch_name = 'invalid branch name'
add_note("/create_merge_request #{branch_name}") add_note("/create_merge_request #{branch_name}")
wait_for_requests
expect_mr_quickaction(false, branch_name) expect_mr_quickaction(false, branch_name)
end end
...@@ -31,16 +29,12 @@ RSpec.shared_examples 'create_merge_request quick action' do ...@@ -31,16 +29,12 @@ RSpec.shared_examples 'create_merge_request quick action' do
branch_name = 'feature' branch_name = 'feature'
add_note("/create_merge_request #{branch_name}") add_note("/create_merge_request #{branch_name}")
wait_for_requests
expect_mr_quickaction(false, branch_name) expect_mr_quickaction(false, branch_name)
end end
it 'creates a new merge request using issue iid and title as branch name when the branch name is empty' do it 'creates a new merge request using issue iid and title as branch name when the branch name is empty' do
add_note("/create_merge_request") add_note("/create_merge_request")
wait_for_requests
expect_mr_quickaction(true) expect_mr_quickaction(true)
created_mr = project.merge_requests.last created_mr = project.merge_requests.last
......
...@@ -27,8 +27,6 @@ RSpec.shared_examples 'move quick action' do ...@@ -27,8 +27,6 @@ RSpec.shared_examples 'move quick action' do
it 'does not move the issue' do it 'does not move the issue' do
add_note("/move #{project_unauthorized.full_path}") add_note("/move #{project_unauthorized.full_path}")
wait_for_requests
expect(page).to have_content "Moved this issue to #{project_unauthorized.full_path}." expect(page).to have_content "Moved this issue to #{project_unauthorized.full_path}."
expect(issue.reload).to be_open expect(issue.reload).to be_open
end end
...@@ -38,8 +36,6 @@ RSpec.shared_examples 'move quick action' do ...@@ -38,8 +36,6 @@ RSpec.shared_examples 'move quick action' do
it 'does not move the issue' do it 'does not move the issue' do
add_note("/move not/valid") add_note("/move not/valid")
wait_for_requests
expect(page).to have_content "Failed to move this issue because target project doesn't exist." expect(page).to have_content "Failed to move this issue because target project doesn't exist."
expect(issue.reload).to be_open expect(issue.reload).to be_open
end end
......
...@@ -10,8 +10,6 @@ RSpec.shared_examples 'zoom quick actions' do ...@@ -10,8 +10,6 @@ RSpec.shared_examples 'zoom quick actions' do
it 'skips addition silently' do it 'skips addition silently' do
add_note("/zoom #{zoom_link}") add_note("/zoom #{zoom_link}")
wait_for_requests
expect(page).not_to have_content('Zoom meeting added') expect(page).not_to have_content('Zoom meeting added')
expect(page).not_to have_content('Failed to add a Zoom meeting') expect(page).not_to have_content('Failed to add a Zoom meeting')
expect(ZoomMeeting.canonical_meeting_url(issue.reload)).not_to eq(zoom_link) expect(ZoomMeeting.canonical_meeting_url(issue.reload)).not_to eq(zoom_link)
...@@ -22,8 +20,6 @@ RSpec.shared_examples 'zoom quick actions' do ...@@ -22,8 +20,6 @@ RSpec.shared_examples 'zoom quick actions' do
it 'adds a Zoom link' do it 'adds a Zoom link' do
add_note("/zoom #{zoom_link}") add_note("/zoom #{zoom_link}")
wait_for_requests
expect(page).to have_content('Zoom meeting added') expect(page).to have_content('Zoom meeting added')
expect(ZoomMeeting.canonical_meeting_url(issue.reload)).to eq(zoom_link) expect(ZoomMeeting.canonical_meeting_url(issue.reload)).to eq(zoom_link)
end end
...@@ -35,8 +31,6 @@ RSpec.shared_examples 'zoom quick actions' do ...@@ -35,8 +31,6 @@ RSpec.shared_examples 'zoom quick actions' do
it 'cannot add invalid zoom link' do it 'cannot add invalid zoom link' do
add_note("/zoom #{invalid_zoom_link}") add_note("/zoom #{invalid_zoom_link}")
wait_for_requests
expect(page).to have_content('Failed to add a Zoom meeting') expect(page).to have_content('Failed to add a Zoom meeting')
expect(page).not_to have_content(zoom_link) expect(page).not_to have_content(zoom_link)
end end
...@@ -64,8 +58,6 @@ RSpec.shared_examples 'zoom quick actions' do ...@@ -64,8 +58,6 @@ RSpec.shared_examples 'zoom quick actions' do
it 'skips removal silently' do it 'skips removal silently' do
add_note('/remove_zoom') add_note('/remove_zoom')
wait_for_requests
expect(page).not_to have_content('Zoom meeting removed') expect(page).not_to have_content('Zoom meeting removed')
expect(page).not_to have_content('Failed to remove a Zoom meeting') expect(page).not_to have_content('Failed to remove a Zoom meeting')
expect(ZoomMeeting.canonical_meeting_url(issue.reload)).to be_nil expect(ZoomMeeting.canonical_meeting_url(issue.reload)).to be_nil
...@@ -78,8 +70,6 @@ RSpec.shared_examples 'zoom quick actions' do ...@@ -78,8 +70,6 @@ RSpec.shared_examples 'zoom quick actions' do
it 'removes last Zoom link' do it 'removes last Zoom link' do
add_note('/remove_zoom') add_note('/remove_zoom')
wait_for_requests
expect(page).to have_content('Zoom meeting removed') expect(page).to have_content('Zoom meeting removed')
expect(ZoomMeeting.canonical_meeting_url(issue.reload)).to be_nil expect(ZoomMeeting.canonical_meeting_url(issue.reload)).to be_nil
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment