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

diff_notes_spec.rb « commit « projects « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6cebff1cc9a83e74024bc6b12a08232ba4c44b0b (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 'Commit diff', :js do
  include RepoHelpers

  let(:user)          { create(:user) }
  let(:project)       { create(:project, :public, :repository) }

  using RSpec::Parameterized::TableSyntax

  where(:view, :async_diff_file_loading) do
    'inline' | true
    'inline' | false
    'parallel' | true
    'parallel' | false
  end

  with_them do
    before do
      stub_feature_flags(async_commit_diff_files: async_diff_file_loading)
      project.add_maintainer(user)
      sign_in user
      visit project_commit_path(project, sample_commit.id, view: view)
    end

    it "adds comment to diff" do
      diff_line_num = first('.diff-line-num.new')

      diff_line_num.hover
      diff_line_num.find('.js-add-diff-note-button').click

      page.within(first('.diff-viewer')) do
        find('.js-note-text').set 'test comment'

        click_button 'Comment'

        expect(page).to have_content('test comment')
      end
    end
  end
end