diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /spec/features/issues | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'spec/features/issues')
-rw-r--r-- | spec/features/issues/csv_spec.rb | 22 | ||||
-rw-r--r-- | spec/features/issues/gfm_autocomplete_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/issues/issue_header_spec.rb | 9 | ||||
-rw-r--r-- | spec/features/issues/issue_sidebar_spec.rb | 59 | ||||
-rw-r--r-- | spec/features/issues/user_bulk_edits_issues_labels_spec.rb | 143 | ||||
-rw-r--r-- | spec/features/issues/user_edits_issue_spec.rb | 9 | ||||
-rw-r--r-- | spec/features/issues/user_invites_from_a_comment_spec.rb | 25 |
7 files changed, 93 insertions, 176 deletions
diff --git a/spec/features/issues/csv_spec.rb b/spec/features/issues/csv_spec.rb index b4c737495b4..9fd171bf44b 100644 --- a/spec/features/issues/csv_spec.rb +++ b/spec/features/issues/csv_spec.rb @@ -47,13 +47,13 @@ RSpec.describe 'Issues csv', :js do expect(page).to have_content "emailed to #{user.notification_email_or_default}" end - it 'includes a csv attachment', :sidekiq_might_not_need_inline do + it 'includes a csv attachment', :sidekiq_inline do request_csv expect(attachment.content_type).to include('text/csv') end - it 'ignores pagination', :sidekiq_might_not_need_inline do + it 'ignores pagination', :sidekiq_inline do create_list(:issue, 30, project: project, author: user) request_csv @@ -61,13 +61,13 @@ RSpec.describe 'Issues csv', :js do expect(csv.count).to eq 31 end - it 'uses filters from issue index', :sidekiq_might_not_need_inline do + it 'uses filters from issue index', :sidekiq_inline do request_csv(state: :closed) expect(csv.count).to eq 0 end - it 'ignores sorting from issue index', :sidekiq_might_not_need_inline do + it 'ignores sorting from issue index', :sidekiq_inline do issue2 = create(:labeled_issue, project: project, author: user, labels: [feature_label]) request_csv(sort: :label_priority) @@ -76,23 +76,11 @@ RSpec.describe 'Issues csv', :js do expect(csv.map { |row| row['Issue ID'] }).to eq expected end - it 'uses array filters, such as label_name', :sidekiq_might_not_need_inline do + it 'uses array filters, such as label_name', :sidekiq_inline do issue.update!(labels: [idea_label]) request_csv("label_name[]" => 'Bug') expect(csv.count).to eq 0 end - - it 'avoids excessive database calls' do - control_count = ActiveRecord::QueryRecorder.new { request_csv }.count - create_list(:labeled_issue, - 10, - project: project, - assignees: [user], - author: user, - milestone: milestone, - labels: [feature_label, idea_label]) - expect { request_csv }.not_to exceed_query_limit(control_count + 5) - end end diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index 0cefbae4d37..b0e4729db8b 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -180,7 +180,7 @@ RSpec.describe 'GFM autocomplete', :js do describe 'assignees' do it 'does not wrap with quotes for assignee values' do - fill_in 'Comment', with: "@#{user.username[0]}" + fill_in 'Comment', with: "@#{user.username}" find_highlighted_autocomplete_item.click diff --git a/spec/features/issues/issue_header_spec.rb b/spec/features/issues/issue_header_spec.rb index cf375d8fb67..3e27ce81860 100644 --- a/spec/features/issues/issue_header_spec.rb +++ b/spec/features/issues/issue_header_spec.rb @@ -4,7 +4,8 @@ require 'spec_helper' RSpec.describe 'issue header', :js do let_it_be(:user) { create(:user) } - let_it_be(:project) { create(:project) } + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, group: group) } let_it_be(:issue) { create(:issue, project: project) } let_it_be(:closed_issue) { create(:issue, :closed, project: project) } let_it_be(:closed_locked_issue) { create(:issue, :closed, :locked, project: project) } @@ -12,7 +13,7 @@ RSpec.describe 'issue header', :js do context 'when user has permission to update' do before do - project.add_maintainer(user) + group.add_owner(user) sign_in(user) end @@ -24,9 +25,10 @@ RSpec.describe 'issue header', :js do click_button 'Issue actions' end - it 'only shows the "New issue" and "Report abuse" items', :aggregate_failures do + it 'shows the "New issue", "Report abuse", and "Delete issue" items', :aggregate_failures do expect(page).to have_link 'New issue' expect(page).to have_link 'Report abuse' + expect(page).to have_button 'Delete issue' expect(page).not_to have_link 'Submit as spam' end end @@ -116,6 +118,7 @@ RSpec.describe 'issue header', :js do expect(page).to have_link 'New issue' expect(page).to have_link 'Report abuse' expect(page).not_to have_link 'Submit as spam' + expect(page).not_to have_button 'Delete issue' end end diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb index bd4be755a92..9da6694c681 100644 --- a/spec/features/issues/issue_sidebar_spec.rb +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -11,7 +11,6 @@ RSpec.describe 'Issue Sidebar' do let_it_be(:label) { create(:label, project: project, title: 'bug') } let_it_be(:issue) { create(:labeled_issue, project: project, labels: [label]) } let_it_be(:mock_date) { Date.today.at_beginning_of_month + 2.days } - let_it_be(:issue_with_due_date) { create(:issue, project: project, due_date: mock_date) } let_it_be(:xss_label) { create(:label, project: project, title: '<script>alert("xss");</script>') } before do @@ -201,30 +200,6 @@ RSpec.describe 'Issue Sidebar' do end end - context 'due date widget', :js do - let(:due_date_value) { find('[data-testid="due-date"] [data-testid="sidebar-date-value"]') } - - context 'when no due date exists' do - before do - visit_issue(project, issue) - end - - it "displays 'None'" do - expect(due_date_value.text).to have_content 'None' - end - end - - context 'when due date exists' do - before do - visit_issue(project, issue_with_due_date) - end - - it "displays the due date" do - expect(due_date_value.text).to have_content mock_date.strftime('%b %-d, %Y') - end - end - end - context 'as an allowed user' do before do project.add_developer(user) @@ -259,37 +234,11 @@ RSpec.describe 'Issue Sidebar' do end context 'editing issue milestone', :js do - let_it_be(:milestone_expired) { create(:milestone, project: project, title: 'Foo - expired', due_date: 5.days.ago) } - let_it_be(:milestone_no_duedate) { create(:milestone, project: project, title: 'Foo - No due date') } - let_it_be(:milestone1) { create(:milestone, project: project, title: 'Milestone-1', due_date: 20.days.from_now) } - let_it_be(:milestone2) { create(:milestone, project: project, title: 'Milestone-2', due_date: 15.days.from_now) } - let_it_be(:milestone3) { create(:milestone, project: project, title: 'Milestone-3', due_date: 10.days.from_now) } - - before do - page.within('.block.milestone') do - click_button 'Edit' - end - - wait_for_all_requests - end - - it 'shows milestones list in the dropdown' do - page.within('.block.milestone') do - # 5 milestones + "No milestone" = 6 items - expect(page.find('.gl-new-dropdown-contents')).to have_selector('li.gl-new-dropdown-item', count: 6) - end - end - - it 'shows expired milestone at the bottom of the list and milestone due earliest at the top of the list', :aggregate_failures do - page.within('.block.milestone .gl-new-dropdown-contents') do - expect(page.find('li:last-child')).to have_content milestone_expired.title + it_behaves_like 'milestone sidebar widget' + end - expect(page.all('li.gl-new-dropdown-item')[1]).to have_content milestone3.title - expect(page.all('li.gl-new-dropdown-item')[2]).to have_content milestone2.title - expect(page.all('li.gl-new-dropdown-item')[3]).to have_content milestone1.title - expect(page.all('li.gl-new-dropdown-item')[4]).to have_content milestone_no_duedate.title - end - end + context 'editing issue due date', :js do + it_behaves_like 'date sidebar widget' end context 'editing issue labels', :js do diff --git a/spec/features/issues/user_bulk_edits_issues_labels_spec.rb b/spec/features/issues/user_bulk_edits_issues_labels_spec.rb index 97df2d0208b..71213fb661f 100644 --- a/spec/features/issues/user_bulk_edits_issues_labels_spec.rb +++ b/spec/features/issues/user_bulk_edits_issues_labels_spec.rb @@ -12,6 +12,9 @@ RSpec.describe 'Issues > Labels bulk assignment' do let!(:issue1) { create(:issue, project: project, title: "Issue 1", labels: [frontend]) } let!(:issue2) { create(:issue, project: project, title: "Issue 2") } + let(:issue_1_selector) { "#issue_#{issue1.id}" } + let(:issue_2_selector) { "#issue_#{issue2.id}" } + context 'as an allowed user', :js do before do project.add_maintainer(user) @@ -44,10 +47,10 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it do - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue1.id}")).to have_content 'frontend' - expect(find("#issue_#{issue2.id}")).to have_content 'bug' - expect(find("#issue_#{issue2.id}")).not_to have_content 'frontend' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'frontend' + expect(find(issue_2_selector)).to have_content 'bug' + expect(find(issue_2_selector)).not_to have_content 'frontend' end end @@ -60,10 +63,10 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it do - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue1.id}")).to have_content 'frontend' - expect(find("#issue_#{issue2.id}")).to have_content 'bug' - expect(find("#issue_#{issue2.id}")).not_to have_content 'frontend' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'frontend' + expect(find(issue_2_selector)).to have_content 'bug' + expect(find(issue_2_selector)).not_to have_content 'frontend' end end @@ -75,10 +78,10 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it do - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue1.id}")).to have_content 'frontend' - expect(find("#issue_#{issue2.id}")).not_to have_content 'bug' - expect(find("#issue_#{issue2.id}")).not_to have_content 'frontend' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'frontend' + expect(find(issue_2_selector)).not_to have_content 'bug' + expect(find(issue_2_selector)).not_to have_content 'frontend' end end @@ -90,10 +93,10 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it do - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue1.id}")).to have_content 'frontend' - expect(find("#issue_#{issue2.id}")).not_to have_content 'bug' - expect(find("#issue_#{issue2.id}")).not_to have_content 'frontend' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'frontend' + expect(find(issue_2_selector)).not_to have_content 'bug' + expect(find(issue_2_selector)).not_to have_content 'frontend' end end end @@ -107,10 +110,10 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it do - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue1.id}")).to have_content 'feature' - expect(find("#issue_#{issue2.id}")).to have_content 'bug' - expect(find("#issue_#{issue2.id}")).to have_content 'feature' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'feature' + expect(find(issue_2_selector)).to have_content 'bug' + expect(find(issue_2_selector)).to have_content 'feature' end end @@ -122,10 +125,10 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it do - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue1.id}")).to have_content 'feature' - expect(find("#issue_#{issue2.id}")).not_to have_content 'bug' - expect(find("#issue_#{issue2.id}")).not_to have_content 'feature' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'feature' + expect(find(issue_2_selector)).not_to have_content 'bug' + expect(find(issue_2_selector)).not_to have_content 'feature' end end end @@ -144,8 +147,8 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it do - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue2.id}")).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_2_selector)).to have_content 'bug' end end @@ -164,10 +167,10 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it do - expect(find("#issue_#{issue1.id}")).not_to have_content 'bug' - expect(find("#issue_#{issue1.id}")).not_to have_content 'feature' - expect(find("#issue_#{issue2.id}")).not_to have_content 'bug' - expect(find("#issue_#{issue2.id}")).not_to have_content 'feature' + expect(find(issue_1_selector)).not_to have_content 'bug' + expect(find(issue_1_selector)).not_to have_content 'feature' + expect(find(issue_2_selector)).not_to have_content 'bug' + expect(find(issue_2_selector)).not_to have_content 'feature' end end @@ -183,8 +186,8 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it do - expect(find("#issue_#{issue1.id}")).not_to have_content 'bug' - expect(find("#issue_#{issue2.id}")).to have_content 'feature' + expect(find(issue_1_selector)).not_to have_content 'bug' + expect(find(issue_2_selector)).to have_content 'feature' end end @@ -203,10 +206,10 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it do - expect(find("#issue_#{issue1.id}")).not_to have_content 'bug' - expect(find("#issue_#{issue1.id}")).to have_content 'feature' - expect(find("#issue_#{issue2.id}")).not_to have_content 'bug' - expect(find("#issue_#{issue2.id}")).to have_content 'feature' + expect(find(issue_1_selector)).not_to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'feature' + expect(find(issue_2_selector)).not_to have_content 'bug' + expect(find(issue_2_selector)).to have_content 'feature' end end end @@ -222,18 +225,18 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it 'keeps labels' do - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue2.id}")).to have_content 'feature' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_2_selector)).to have_content 'feature' check 'Select all' open_milestone_dropdown(['First Release']) update_issues - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue1.id}")).to have_content 'First Release' - expect(find("#issue_#{issue2.id}")).to have_content 'feature' - expect(find("#issue_#{issue2.id}")).to have_content 'First Release' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'First Release' + expect(find(issue_2_selector)).to have_content 'feature' + expect(find(issue_2_selector)).to have_content 'First Release' end end @@ -244,18 +247,18 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it 'keeps existing label and new label is present' do - expect(find("#issue_#{issue1.id}")).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'bug' check 'Select all' open_milestone_dropdown ['First Release'] open_labels_dropdown ['feature'] update_issues - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue1.id}")).to have_content 'feature' - expect(find("#issue_#{issue1.id}")).to have_content 'First Release' - expect(find("#issue_#{issue2.id}")).to have_content 'feature' - expect(find("#issue_#{issue2.id}")).to have_content 'First Release' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'feature' + expect(find(issue_1_selector)).to have_content 'First Release' + expect(find(issue_2_selector)).to have_content 'feature' + expect(find(issue_2_selector)).to have_content 'First Release' end end @@ -269,9 +272,9 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it 'keeps existing label and new label is present' do - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue2.id}")).to have_content 'feature' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_2_selector)).to have_content 'feature' check 'Select all' @@ -279,11 +282,11 @@ RSpec.describe 'Issues > Labels bulk assignment' do unmark_labels_in_dropdown ['feature'] update_issues - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue1.id}")).not_to have_content 'feature' - expect(find("#issue_#{issue1.id}")).to have_content 'First Release' - expect(find("#issue_#{issue2.id}")).not_to have_content 'feature' - expect(find("#issue_#{issue2.id}")).to have_content 'First Release' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_1_selector)).not_to have_content 'feature' + expect(find(issue_1_selector)).to have_content 'First Release' + expect(find(issue_2_selector)).not_to have_content 'feature' + expect(find(issue_2_selector)).to have_content 'First Release' end end @@ -300,19 +303,19 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it 'keeps labels' do - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue1.id}")).to have_content 'First Release' - expect(find("#issue_#{issue2.id}")).to have_content 'feature' - expect(find("#issue_#{issue2.id}")).to have_content 'First Release' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'First Release' + expect(find(issue_2_selector)).to have_content 'feature' + expect(find(issue_2_selector)).to have_content 'First Release' check 'Select all' open_milestone_dropdown(['No milestone']) update_issues - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue1.id}")).not_to have_content 'First Release' - expect(find("#issue_#{issue2.id}")).to have_content 'feature' - expect(find("#issue_#{issue2.id}")).not_to have_content 'First Release' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_1_selector)).not_to have_content 'First Release' + expect(find(issue_2_selector)).to have_content 'feature' + expect(find(issue_2_selector)).not_to have_content 'First Release' end end end @@ -324,7 +327,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do end it do - expect(find("#issue_#{issue1.id}")).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'bug' check_issue issue1 open_labels_dropdown ['feature'] @@ -333,8 +336,8 @@ RSpec.describe 'Issues > Labels bulk assignment' do update_issues sleep 1 # needed - expect(find("#issue_#{issue1.id}")).to have_content 'bug' - expect(find("#issue_#{issue1.id}")).to have_content 'feature' + expect(find(issue_1_selector)).to have_content 'bug' + expect(find(issue_1_selector)).to have_content 'feature' end end @@ -350,7 +353,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do update_issues - expect(find("#issue_#{issue1.id}")).to have_content 'feature' + expect(find(issue_1_selector)).to have_content 'feature' end end @@ -381,12 +384,12 @@ RSpec.describe 'Issues > Labels bulk assignment' do update_issues - first_issue = find("#issue_#{issue1.id}") + first_issue = find(issue_1_selector) expect(first_issue).not_to have_content 'bug' expect(first_issue).to have_content 'feature' expect(first_issue).to have_content 'wontfix' - second_issue = find("#issue_#{issue2.id}") + second_issue = find(issue_2_selector) expect(second_issue).not_to have_content 'bug' expect(second_issue).not_to have_content 'feature' expect(second_issue).to have_content 'wontfix' diff --git a/spec/features/issues/user_edits_issue_spec.rb b/spec/features/issues/user_edits_issue_spec.rb index 76cec2502e3..a036a9a5bbc 100644 --- a/spec/features/issues/user_edits_issue_spec.rb +++ b/spec/features/issues/user_edits_issue_spec.rb @@ -15,7 +15,6 @@ RSpec.describe "Issues > User edits issue", :js do context 'with authorized user' do before do - stub_feature_flags(labels_widget: false) project.add_developer(user) project_with_milestones.add_developer(user) sign_in(user) @@ -146,12 +145,12 @@ RSpec.describe "Issues > User edits issue", :js do fill_in 'Comment', with: '/label ~syzygy' click_button 'Comment' - expect(page).to have_text('added syzygy label just now') + expect(page).to have_text('added syzygy label just now', wait: 300) page.within '.block.labels' do # Remove `verisimilitude` label within '.gl-label' do - click_button + click_button 'Remove label' end expect(page).to have_text('syzygy') @@ -418,7 +417,7 @@ RSpec.describe "Issues > User edits issue", :js do it 'adds due date to issue' do date = Date.today.at_beginning_of_month + 2.days - page.within '[data-testid="due-date"]' do + page.within '[data-testid="sidebar-due-date"]' do click_button 'Edit' page.within '.pika-single' do click_button date.day @@ -433,7 +432,7 @@ RSpec.describe "Issues > User edits issue", :js do it 'removes due date from issue' do date = Date.today.at_beginning_of_month + 2.days - page.within '[data-testid="due-date"]' do + page.within '[data-testid="sidebar-due-date"]' do click_button 'Edit' page.within '.pika-single' do diff --git a/spec/features/issues/user_invites_from_a_comment_spec.rb b/spec/features/issues/user_invites_from_a_comment_spec.rb deleted file mode 100644 index 82061f6ed79..00000000000 --- a/spec/features/issues/user_invites_from_a_comment_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -require "spec_helper" - -RSpec.describe "User invites from a comment", :js do - let_it_be(:project) { create(:project_empty_repo, :public) } - let_it_be(:issue) { create(:issue, project: project) } - let_it_be(:user) { project.owner } - - before do - sign_in(user) - end - - it "launches the invite modal from invite link on a comment" do - stub_experiments(invite_members_in_comment: :invite_member_link) - - visit project_issue_path(project, issue) - - page.within(".new-note") do - click_button 'Invite Member' - end - - expect(page).to have_content("You're inviting members to the") - end -end |