Welcome to mirror list, hosted at ThFree Co, Russian Federation.

user_sees_note_updates_in_real_time_spec.rb « merge_requests « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 96f7c26944ef084a3cd008caa6a587fd16a934bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Merge request note updates in real time', :js, feature_category: :code_review_workflow do
  include NoteInteractionHelpers

  let_it_be(:project) { create(:project, :public, :repository) }
  let_it_be(:merge_request) { create(:merge_request, source_project: project) }

  before do
    visit project_merge_request_path(project, merge_request)
  end

  describe 'new notes' do
    it 'displays the new note' do
      note = create(:note, noteable: merge_request, project: project, note: 'Looks good!')

      expect(page).to have_selector("#note_#{note.id}", text: 'Looks good!')
    end
  end

  describe 'updated notes' do
    let(:note_text) { "Hello World" }
    let(:updated_text) { "Bye World" }
    let!(:existing_note) do
      create(:discussion_note_on_merge_request, noteable: merge_request, project: project, note: note_text)
    end

    it 'displays the updated note', :aggregate_failures do
      expect(page).to have_selector("#note_#{existing_note.id}", text: note_text)

      existing_note.update!(note: updated_text)
      expect(page).to have_selector("#note_#{existing_note.id}", text: updated_text)

      existing_note.resolve!(merge_request.author)
      expect(page).to have_selector(
        "#note_#{existing_note.id} .discussion-resolved-text",
        text: /\AResolved .* by #{merge_request.author.name}\z/
      )
    end
  end
end