Commit 7442310f authored by Peter Leitzen's avatar Peter Leitzen Committed by Luke Duncalfe

Wait for requests in `add_note` feature spec helper

This might make some feature specs less flaky.

Also, remove a bunch unnecessary `wait_for_requests` after
calling `add_note`.
parent 85ea6738
......@@ -63,8 +63,6 @@ RSpec.describe 'Issue promotion', :js do
it 'promotes the issue' do
add_note('/promote')
wait_for_requests
epic = Epic.last
expect(page).to have_content 'Promoted issue to an epic.'
......@@ -82,8 +80,6 @@ RSpec.describe 'Issue promotion', :js do
it 'promotes the issue' do
add_note('/promote')
wait_for_requests
epic = Epic.last
expect(page).to have_content 'Promoted issue to an epic.'
......@@ -115,8 +111,6 @@ RSpec.describe 'Issue promotion', :js do
it 'promotes the issue' do
add_note('/promote')
wait_for_requests
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.'
......
......@@ -29,7 +29,6 @@ RSpec.describe 'Resource weight events', :js do
target_project.add_maintainer(user)
add_note("/weight 2")
wait_for_requests
add_note("/weight 3\n/move #{target_project.full_path}")
end
......
......@@ -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)
add_note('/publish')
wait_for_requests
expect(page).not_to have_content('Issue published 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
expect(StatusPage::PublishWorker).to receive(:perform_async).with(user.id, project.id, issue.id)
add_note('/publish')
wait_for_requests
expect(page).to have_content('Issue published on status page.')
end
......@@ -51,7 +49,6 @@ RSpec.shared_examples 'status page quick actions' do
allow(StatusPage::PublishedIncident).to receive(:track).with(issue).and_raise('Error')
add_note('/publish')
wait_for_requests
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.')
......
......@@ -39,8 +39,6 @@ RSpec.describe "User comments on issue", :js do
add_note(comment)
wait_for_requests
expect(page.find('pre code').text).to eq code_block_content
end
......@@ -51,8 +49,6 @@ RSpec.describe "User comments on issue", :js do
add_note(comment)
wait_for_requests
expect(page.find('svg.mermaid')).to have_content html_content
within('svg.mermaid') { expect(page).not_to have_selector('img') }
end
......
......@@ -38,8 +38,6 @@ RSpec.describe 'User sees user popover', :js do
it "displays user popover in system note" do
add_note("/assign @#{user.username}")
wait_for_requests
find('.system-note-message .js-user-link').hover
page.within(popover_selector) do
......
......@@ -21,6 +21,8 @@ module Spec
find(".js-comment-submit-button").click
end
end
wait_for_requests
end
def edit_note(note_text_to_edit, new_note_text)
......
......@@ -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
add_note("this is done, close\n\n/close")
wait_for_requests
expect(page).not_to have_content '/close'
expect(page).to have_content 'this is done, close'
......
......@@ -54,8 +54,6 @@ RSpec.shared_examples 'clone quick action' do
# Note that this is missing one `-`
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(issue.reload).to be_open
end
......@@ -68,8 +66,6 @@ RSpec.shared_examples 'clone quick action' do
it 'does not clone the issue' do
add_note("/clone #{project_unauthorized.full_path}")
wait_for_requests
expect(page).to have_content "Cloned this issue to #{project_unauthorized.full_path}."
expect(issue.reload).to be_open
......@@ -83,8 +79,6 @@ RSpec.shared_examples 'clone quick action' do
it 'does not clone the issue' do
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(issue.reload).to be_open
end
......
......@@ -22,8 +22,6 @@ RSpec.shared_examples 'create_merge_request quick action' do
branch_name = 'invalid branch name'
add_note("/create_merge_request #{branch_name}")
wait_for_requests
expect_mr_quickaction(false, branch_name)
end
......@@ -31,16 +29,12 @@ RSpec.shared_examples 'create_merge_request quick action' do
branch_name = 'feature'
add_note("/create_merge_request #{branch_name}")
wait_for_requests
expect_mr_quickaction(false, branch_name)
end
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")
wait_for_requests
expect_mr_quickaction(true)
created_mr = project.merge_requests.last
......
......@@ -27,8 +27,6 @@ RSpec.shared_examples 'move quick action' do
it 'does not move the issue' do
add_note("/move #{project_unauthorized.full_path}")
wait_for_requests
expect(page).to have_content "Moved this issue to #{project_unauthorized.full_path}."
expect(issue.reload).to be_open
end
......@@ -38,8 +36,6 @@ RSpec.shared_examples 'move quick action' do
it 'does not move the issue' do
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(issue.reload).to be_open
end
......
......@@ -10,8 +10,6 @@ RSpec.shared_examples 'zoom quick actions' do
it 'skips addition silently' do
add_note("/zoom #{zoom_link}")
wait_for_requests
expect(page).not_to have_content('Zoom meeting added')
expect(page).not_to have_content('Failed to add a Zoom meeting')
expect(ZoomMeeting.canonical_meeting_url(issue.reload)).not_to eq(zoom_link)
......@@ -22,8 +20,6 @@ RSpec.shared_examples 'zoom quick actions' do
it 'adds a Zoom link' do
add_note("/zoom #{zoom_link}")
wait_for_requests
expect(page).to have_content('Zoom meeting added')
expect(ZoomMeeting.canonical_meeting_url(issue.reload)).to eq(zoom_link)
end
......@@ -35,8 +31,6 @@ RSpec.shared_examples 'zoom quick actions' do
it 'cannot add invalid zoom link' do
add_note("/zoom #{invalid_zoom_link}")
wait_for_requests
expect(page).to have_content('Failed to add a Zoom meeting')
expect(page).not_to have_content(zoom_link)
end
......@@ -64,8 +58,6 @@ RSpec.shared_examples 'zoom quick actions' do
it 'skips removal silently' do
add_note('/remove_zoom')
wait_for_requests
expect(page).not_to have_content('Zoom meeting removed')
expect(page).not_to have_content('Failed to remove a Zoom meeting')
expect(ZoomMeeting.canonical_meeting_url(issue.reload)).to be_nil
......@@ -78,8 +70,6 @@ RSpec.shared_examples 'zoom quick actions' do
it 'removes last Zoom link' do
add_note('/remove_zoom')
wait_for_requests
expect(page).to have_content('Zoom meeting removed')
expect(ZoomMeeting.canonical_meeting_url(issue.reload)).to be_nil
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