From edaa33dee2ff2f7ea3fac488d41558eb5f86d68c Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 20 Jan 2022 09:16:11 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-7-stable-ee --- spec/features/issues/issue_sidebar_spec.rb | 70 +--------------------- spec/features/issues/service_desk_spec.rb | 2 - .../features/issues/user_bulk_edits_issues_spec.rb | 20 +++++++ .../features/issues/user_comments_on_issue_spec.rb | 3 +- .../user_creates_branch_and_merge_request_spec.rb | 2 +- .../issues/user_scrolls_to_deeplinked_note_spec.rb | 33 ++++++++++ .../issues/user_sees_breadcrumb_links_spec.rb | 2 - 7 files changed, 59 insertions(+), 73 deletions(-) create mode 100644 spec/features/issues/user_scrolls_to_deeplinked_note_spec.rb (limited to 'spec/features/issues') diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb index 9da6694c681..868946814c3 100644 --- a/spec/features/issues/issue_sidebar_spec.rb +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -8,10 +8,9 @@ RSpec.describe 'Issue Sidebar' do let_it_be(:group) { create(:group, :nested) } let_it_be(:project) { create(:project, :public, namespace: group) } let_it_be(:user) { create(:user) } - let_it_be(:label) { create(:label, project: project, title: 'bug') } - let_it_be(:issue) { create(:labeled_issue, project: project, labels: [label]) } + let_it_be(:issue) { create(:issue, project: project) } + let_it_be(:label) { create(:label, project: project, name: 'Label') } let_it_be(:mock_date) { Date.today.at_beginning_of_month + 2.days } - let_it_be(:xss_label) { create(:label, project: project, title: '<script>alert("xss");</script>') } before do stub_incoming_email_setting(enabled: true, address: "p+%{key}@gl.ab") @@ -223,14 +222,6 @@ RSpec.describe 'Issue Sidebar' do restore_window_size open_issue_sidebar end - - it 'escapes XSS when viewing issue labels' do - page.within('.block.labels') do - click_on 'Edit' - - expect(page).to have_content '' - end - end end context 'editing issue milestone', :js do @@ -242,62 +233,7 @@ RSpec.describe 'Issue Sidebar' do end context 'editing issue labels', :js do - before do - issue.update!(labels: [label]) - page.within('.block.labels') do - click_on 'Edit' - end - end - - it 'shows the current set of labels' do - page.within('.issuable-show-labels') do - expect(page).to have_content label.title - end - end - - it 'shows option to create a project label' do - page.within('.block.labels') do - expect(page).to have_content 'Create project' - end - end - - context 'creating a project label', :js, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/27992' do - before do - page.within('.block.labels') do - click_link 'Create project' - end - end - - it 'shows dropdown switches to "create label" section' do - page.within('.block.labels') do - expect(page).to have_content 'Create project label' - end - end - - it 'adds new label' do - page.within('.block.labels') do - fill_in 'new_label_name', with: 'wontfix' - page.find('.suggest-colors a', match: :first).click - page.find('button', text: 'Create').click - - page.within('.dropdown-page-one') do - expect(page).to have_content 'wontfix' - end - end - end - - it 'shows error message if label title is taken' do - page.within('.block.labels') do - fill_in 'new_label_name', with: label.title - page.find('.suggest-colors a', match: :first).click - page.find('button', text: 'Create').click - - page.within('.dropdown-page-two') do - expect(page).to have_content 'Title has already been taken' - end - end - end - end + it_behaves_like 'labels sidebar widget' end context 'interacting with collapsed sidebar', :js do diff --git a/spec/features/issues/service_desk_spec.rb b/spec/features/issues/service_desk_spec.rb index 0a879fdd4d4..cc0d35afd60 100644 --- a/spec/features/issues/service_desk_spec.rb +++ b/spec/features/issues/service_desk_spec.rb @@ -9,8 +9,6 @@ RSpec.describe 'Service Desk Issue Tracker', :js do let_it_be(:support_bot) { User.support_bot } before do - stub_feature_flags(vue_issuables_list: true) - # The following two conditions equate to Gitlab::ServiceDesk.supported == true allow(Gitlab::IncomingEmail).to receive(:enabled?).and_return(true) allow(Gitlab::IncomingEmail).to receive(:supports_wildcard?).and_return(true) diff --git a/spec/features/issues/user_bulk_edits_issues_spec.rb b/spec/features/issues/user_bulk_edits_issues_spec.rb index 44c23813e3c..625303f89e4 100644 --- a/spec/features/issues/user_bulk_edits_issues_spec.rb +++ b/spec/features/issues/user_bulk_edits_issues_spec.rb @@ -104,6 +104,26 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do end end + describe 'select all issues' do + let!(:issue_2) { create(:issue, project: project) } + + before do + stub_feature_flags(vue_issues_list: true) + end + + it 'after selecting all issues, unchecking one issue only unselects that one issue' do + visit project_issues_path(project) + + click_button 'Edit issues' + check 'Select all' + uncheck issue.title + + expect(page).to have_unchecked_field 'Select all' + expect(page).to have_unchecked_field issue.title + expect(page).to have_checked_field issue_2.title + end + end + def create_closed create(:issue, project: project, state: :closed) end diff --git a/spec/features/issues/user_comments_on_issue_spec.rb b/spec/features/issues/user_comments_on_issue_spec.rb index 09d3ad15641..5d03aa1fc2b 100644 --- a/spec/features/issues/user_comments_on_issue_spec.rb +++ b/spec/features/issues/user_comments_on_issue_spec.rb @@ -11,6 +11,7 @@ RSpec.describe "User comments on issue", :js do before do stub_feature_flags(tribute_autocomplete: false) + stub_feature_flags(sandboxed_mermaid: false) project.add_guest(user) sign_in(user) @@ -49,7 +50,7 @@ RSpec.describe "User comments on issue", :js do add_note(comment) - expect(page.find('svg.mermaid')).to have_content html_content + expect(page.find('svg.mermaid')).not_to have_content 'javascript' within('svg.mermaid') { expect(page).not_to have_selector('img') } end diff --git a/spec/features/issues/user_creates_branch_and_merge_request_spec.rb b/spec/features/issues/user_creates_branch_and_merge_request_spec.rb index 6e8b3e4fb7c..875b0a60634 100644 --- a/spec/features/issues/user_creates_branch_and_merge_request_spec.rb +++ b/spec/features/issues/user_creates_branch_and_merge_request_spec.rb @@ -217,7 +217,7 @@ RSpec.describe 'User creates branch and merge request on issue page', :js do # Javascript debounces AJAX calls. # So we have to wait until AJAX requests are started. - # Details are in app/assets/javascripts/create_merge_request_dropdown.js + # Details are in app/assets/javascripts/issues/create_merge_request_dropdown.js # this.refDebounce = _.debounce(...) sleep 0.5 diff --git a/spec/features/issues/user_scrolls_to_deeplinked_note_spec.rb b/spec/features/issues/user_scrolls_to_deeplinked_note_spec.rb new file mode 100644 index 00000000000..1fa8f533869 --- /dev/null +++ b/spec/features/issues/user_scrolls_to_deeplinked_note_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'User scrolls to deep-linked note' do + let_it_be(:project) { create(:project, :public, :repository) } + let_it_be(:issue) { create(:issue, project: project) } + let_it_be(:comment_1) { create(:note_on_issue, noteable: issue, project: project, note: 'written first') } + let_it_be(:comments) { create_list(:note_on_issue, 20, noteable: issue, project: project, note: 'spacer note') } + + context 'on issue page', :js do + it 'on comment' do + visit project_issue_path(project, issue, anchor: "note_#{comment_1.id}") + + wait_for_requests + + expect(first_comment).to have_content(comment_1.note) + + bottom_of_title = find('.issue-sticky-header.gl-fixed').evaluate_script("this.getBoundingClientRect().bottom;") + top = first_comment.evaluate_script("this.getBoundingClientRect().top;") + + expect(top).to be_within(1).of(bottom_of_title) + end + end + + def all_comments + all('.timeline > .note.timeline-entry') + end + + def first_comment + all_comments.first + end +end diff --git a/spec/features/issues/user_sees_breadcrumb_links_spec.rb b/spec/features/issues/user_sees_breadcrumb_links_spec.rb index 9f8cd2a769d..669c7c45411 100644 --- a/spec/features/issues/user_sees_breadcrumb_links_spec.rb +++ b/spec/features/issues/user_sees_breadcrumb_links_spec.rb @@ -8,8 +8,6 @@ RSpec.describe 'New issue breadcrumb' do let(:user) { project.creator } before do - stub_feature_flags(vue_issuables_list: false) - sign_in(user) visit(new_project_issue_path(project)) end -- cgit v1.2.1