diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-02 00:10:20 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-02 00:10:20 +0300 |
commit | cc77bdd6f5f12bea0f50064f3feadcd9c87009a6 (patch) | |
tree | b9347c56663684eaa5939984c9a604dc767f214e /spec/features | |
parent | 9cf7b70ac7b17ea3310ebdf83e94d1d5fd248b82 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/merge_request/user_views_comment_on_diff_file_spec.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/features/merge_request/user_views_comment_on_diff_file_spec.rb b/spec/features/merge_request/user_views_comment_on_diff_file_spec.rb new file mode 100644 index 00000000000..26dbf5605ec --- /dev/null +++ b/spec/features/merge_request/user_views_comment_on_diff_file_spec.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'User views comment on a diff file', :js, feature_category: :code_review_workflow do + include MergeRequestDiffHelpers + include RepoHelpers + + let_it_be(:project) { create(:project, :repository) } + let_it_be(:merge_request) do + create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test') + end + + let_it_be(:user) { create(:user) } + + before_all do + project.add_maintainer(user) + end + + before do + sign_in(user) + + visit(diffs_project_merge_request_path(project, merge_request)) + end + + context 'with invalid start_sha position' do + before do + diff_refs = Gitlab::Diff::DiffRefs.new( + base_sha: merge_request.diff_refs.base_sha, + start_sha: 'fakesha', + head_sha: merge_request.diff_refs.head_sha + ) + position = build(:file_diff_position, file: 'files/ruby/popen.rb', diff_refs: diff_refs) + create(:diff_note_on_merge_request, noteable: merge_request, project: project, position: position) + end + + it 'renders diffs' do + visit diffs_project_merge_request_path(project, merge_request) + + expect(page).to have_selector('.diff-file') + end + + it 'renders discussion on overview tab' do + visit project_merge_request_path(project, merge_request) + + expect(page).to have_selector('.note-discussion') + end + end +end |