Commit b712e50c authored by Stan Hu's avatar Stan Hu

Fix flaky spec in user_posts_notes_spec.rb

The test was previously failing because it was possible for a note to be
deleted before the browser rendered the page, so there was note to
reply.  We fix this by deleting the note only after the page has been
displayed and the user has clicked the reply button.

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/238463
parent 8b384988
...@@ -108,15 +108,14 @@ RSpec.describe 'Merge request > User posts notes', :js do ...@@ -108,15 +108,14 @@ RSpec.describe 'Merge request > User posts notes', :js do
end end
context 'when comment is deleted' do context 'when comment is deleted' do
before do
note.delete
end
it 'shows an error message' do it 'shows an error message' do
find('.js-reply-button').click find('.js-reply-button').click
page.within('.discussion-reply-holder') do page.within('.discussion-reply-holder') do
fill_in 'note[note]', with: 'A reply' fill_in 'note[note]', with: 'A reply'
note.delete
click_button 'Add comment now' click_button 'Add comment now'
expect(page).to have_content('Your comment could not be submitted because discussion to reply to cannot be found') expect(page).to have_content('Your comment could not be submitted because discussion to reply to cannot be found')
......
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