diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-04 15:10:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-04 15:10:55 +0300 |
commit | f2fd07aa1c0bfb732b80c3d028cd23c91547991c (patch) | |
tree | 7b2c53ef4b4caddb65b2443ecd34dfa2289719ab /spec/features | |
parent | 9f0d27648937cb04d685ca9207f5c45f3ac98010 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/boards/board_filters_spec.rb | 1 | ||||
-rw-r--r-- | spec/features/boards/boards_spec.rb | 35 | ||||
-rw-r--r-- | spec/features/boards/issue_ordering_spec.rb | 1 | ||||
-rw-r--r-- | spec/features/boards/sidebar_labels_spec.rb | 1 | ||||
-rw-r--r-- | spec/features/boards/sidebar_spec.rb | 1 | ||||
-rw-r--r-- | spec/features/boards/user_adds_lists_to_board_spec.rb | 1 | ||||
-rw-r--r-- | spec/features/boards/user_visits_board_spec.rb | 3 | ||||
-rw-r--r-- | spec/features/groups/board_sidebar_spec.rb | 1 | ||||
-rw-r--r-- | spec/features/incidents/user_views_incident_spec.rb | 60 | ||||
-rw-r--r-- | spec/features/issues/user_bulk_edits_issues_labels_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/issues/user_bulk_edits_issues_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/merge_requests/user_mass_updates_spec.rb | 2 |
12 files changed, 68 insertions, 44 deletions
diff --git a/spec/features/boards/board_filters_spec.rb b/spec/features/boards/board_filters_spec.rb index 1184aea1114..eab92de7e8a 100644 --- a/spec/features/boards/board_filters_spec.rb +++ b/spec/features/boards/board_filters_spec.rb @@ -22,6 +22,7 @@ RSpec.describe 'Issue board filters', :js do let(:filter_submit) { find('.gl-search-box-by-click-search-button') } before do + stub_feature_flags(apollo_boards: false) project.add_maintainer(user) sign_in(user) diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index a09c9d258dc..fee9b5b378e 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -19,6 +19,7 @@ RSpec.describe 'Project issue boards', :js do context 'signed in user' do before do + stub_feature_flags(apollo_boards: false) project.add_maintainer(user) project.add_maintainer(user2) @@ -29,7 +30,7 @@ RSpec.describe 'Project issue boards', :js do context 'no lists' do before do - visit_project_board_path_without_query_limit(project, board) + visit_project_board(project, board) end it 'creates default lists' do @@ -73,7 +74,7 @@ RSpec.describe 'Project issue boards', :js do let_it_be(:issue10) { create(:labeled_issue, project: project, title: 'issue +', description: 'A+ great issue', labels: [a_plus]) } before do - visit_project_board_path_without_query_limit(project, board) + visit_project_board(project, board) end it 'shows description tooltip on list title', :quarantine do @@ -124,7 +125,7 @@ RSpec.describe 'Project issue boards', :js do it 'infinite scrolls list' do create_list(:labeled_issue, 30, project: project, labels: [planning]) - visit_project_board_path_without_query_limit(project, board) + visit_project_board(project, board) page.within(find('.board:nth-child(2)')) do expect(page.find('.board-header')).to have_content('38') @@ -203,7 +204,7 @@ RSpec.describe 'Project issue boards', :js do expect(find('.board:nth-child(3) [data-testid="board-list-header"]')).to have_content(planning.title) # Make sure list positions are preserved after a reload - visit_project_board_path_without_query_limit(project, board) + visit_project_board(project, board) expect(find('.board:nth-child(2) [data-testid="board-list-header"]')).to have_content(development.title) expect(find('.board:nth-child(3) [data-testid="board-list-header"]')).to have_content(planning.title) @@ -215,15 +216,19 @@ RSpec.describe 'Project issue boards', :js do let_it_be(:list2) { create(:list, board: board, label: development, position: 1) } it 'changes position of list' do - visit_project_board_path_without_query_limit(project, board) + inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do + visit_project_board(project, board) + end drag(list_from_index: 0, list_to_index: 1, selector: '.board-header') expect(find('.board:nth-child(1) [data-testid="board-list-header"]')).to have_content(development.title) expect(find('.board:nth-child(2) [data-testid="board-list-header"]')).to have_content(planning.title) - # Make sure list positions are preserved after a reload - visit_project_board_path_without_query_limit(project, board) + inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do + # Make sure list positions are preserved after a reload + visit_project_board(project, board) + end expect(find('.board:nth-child(1) [data-testid="board-list-header"]')).to have_content(development.title) expect(find('.board:nth-child(2) [data-testid="board-list-header"]')).to have_content(planning.title) @@ -234,7 +239,9 @@ RSpec.describe 'Project issue boards', :js do selector = '.board:not(.is-ghost) .board-header' expect(page).to have_selector(selector, text: development.title, count: 1) - drag(list_from_index: 2, list_to_index: 1, selector: '.board-header', perform_drop: false) + inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do + drag(list_from_index: 2, list_to_index: 1, selector: '.board-header', perform_drop: false) + end expect(page).to have_selector(selector, text: development.title, count: 1) end @@ -492,7 +499,7 @@ RSpec.describe 'Project issue boards', :js do context 'keyboard shortcuts' do before do - visit_project_board_path_without_query_limit(project, board) + visit_project_board(project, board) wait_for_requests end @@ -505,6 +512,7 @@ RSpec.describe 'Project issue boards', :js do context 'signed out user' do before do + stub_feature_flags(apollo_boards: false) visit project_board_path(project, board) wait_for_requests end @@ -526,6 +534,7 @@ RSpec.describe 'Project issue boards', :js do let_it_be(:user_guest) { create(:user) } before do + stub_feature_flags(apollo_boards: false) project.add_guest(user_guest) sign_in(user_guest) visit project_board_path(project, board) @@ -587,11 +596,9 @@ RSpec.describe 'Project issue boards', :js do end end - def visit_project_board_path_without_query_limit(project, board) - inspect_requests(inject_headers: { 'X-GITLAB-DISABLE-SQL-QUERY-LIMIT' => 'https://gitlab.com/gitlab-org/gitlab/-/issues/323426' }) do - visit project_board_path(project, board) + def visit_project_board(project, board) + visit project_board_path(project, board) - wait_for_requests - end + wait_for_requests end end diff --git a/spec/features/boards/issue_ordering_spec.rb b/spec/features/boards/issue_ordering_spec.rb index 57f2bf26752..a3dda3b9d2f 100644 --- a/spec/features/boards/issue_ordering_spec.rb +++ b/spec/features/boards/issue_ordering_spec.rb @@ -15,6 +15,7 @@ RSpec.describe 'Issue Boards', :js do let!(:issue3) { create(:labeled_issue, project: project, title: 'testing 3', labels: [label], relative_position: 1) } before do + stub_feature_flags(apollo_boards: false) project.add_maintainer(user) sign_in(user) diff --git a/spec/features/boards/sidebar_labels_spec.rb b/spec/features/boards/sidebar_labels_spec.rb index 511233b50c0..12d91e9c5a8 100644 --- a/spec/features/boards/sidebar_labels_spec.rb +++ b/spec/features/boards/sidebar_labels_spec.rb @@ -20,6 +20,7 @@ RSpec.describe 'Project issue boards sidebar labels', :js do let(:card) { find('.board:nth-child(2)').first('.board-card') } before do + stub_feature_flags(apollo_boards: false) project.add_maintainer(user) sign_in(user) diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb index 0e914ae19d1..2b2a412194a 100644 --- a/spec/features/boards/sidebar_spec.rb +++ b/spec/features/boards/sidebar_spec.rb @@ -15,6 +15,7 @@ RSpec.describe 'Project issue boards sidebar', :js do let_it_be(:issue, reload: true) { create(:issue, project: project, relative_position: 1) } before do + stub_feature_flags(apollo_boards: false) project.add_maintainer(user) sign_in(user) diff --git a/spec/features/boards/user_adds_lists_to_board_spec.rb b/spec/features/boards/user_adds_lists_to_board_spec.rb index a1728d066cd..480a88a6b84 100644 --- a/spec/features/boards/user_adds_lists_to_board_spec.rb +++ b/spec/features/boards/user_adds_lists_to_board_spec.rb @@ -31,6 +31,7 @@ RSpec.describe 'User adds lists', :js do with_them do before do + stub_feature_flags(apollo_boards: false) sign_in(user) set_cookie('sidebar_collapsed', 'true') diff --git a/spec/features/boards/user_visits_board_spec.rb b/spec/features/boards/user_visits_board_spec.rb index 5587d9560a2..c386477fa9d 100644 --- a/spec/features/boards/user_visits_board_spec.rb +++ b/spec/features/boards/user_visits_board_spec.rb @@ -44,6 +44,7 @@ RSpec.describe 'User visits issue boards', :js do with_them do before do + stub_feature_flags(apollo_boards: false) visit board_path wait_for_requests @@ -59,6 +60,7 @@ RSpec.describe 'User visits issue boards', :js do end context "project boards" do + stub_feature_flags(apollo_boards: false) let_it_be(:board) { create_default(:board, project: project) } let_it_be(:backlog_list) { create_default(:backlog_list, board: board) } @@ -68,6 +70,7 @@ RSpec.describe 'User visits issue boards', :js do end context "group boards" do + stub_feature_flags(apollo_boards: false) let_it_be(:board) { create_default(:board, group: group) } let_it_be(:backlog_list) { create_default(:backlog_list, board: board) } diff --git a/spec/features/groups/board_sidebar_spec.rb b/spec/features/groups/board_sidebar_spec.rb index aa42b29b3ac..10ef28f3fbc 100644 --- a/spec/features/groups/board_sidebar_spec.rb +++ b/spec/features/groups/board_sidebar_spec.rb @@ -19,6 +19,7 @@ RSpec.describe 'Group Issue Boards', :js do let(:card) { find('.board:nth-child(1)').first('.board-card') } before do + stub_feature_flags(apollo_boards: false) sign_in(user) visit group_board_path(group, board) diff --git a/spec/features/incidents/user_views_incident_spec.rb b/spec/features/incidents/user_views_incident_spec.rb index a669966502e..054a084ea9c 100644 --- a/spec/features/incidents/user_views_incident_spec.rb +++ b/spec/features/incidents/user_views_incident_spec.rb @@ -4,12 +4,16 @@ require "spec_helper" RSpec.describe "User views incident" do let_it_be(:project) { create(:project_empty_repo, :public) } - let_it_be(:user) { create(:user) } - let_it_be(:incident) { create(:incident, project: project, description: "# Description header\n\n**Lorem** _ipsum_ dolor sit [amet](https://example.com)", author: user) } - let_it_be(:note) { create(:note, noteable: incident, project: project, author: user) } + let_it_be(:guest) { create(:user) } + let_it_be(:developer) { create(:user) } + let_it_be(:user) { developer } + let(:author) { developer } + let(:description) { "# Description header\n\n**Lorem** _ipsum_ dolor sit [amet](https://example.com)" } + let(:incident) { create(:incident, project: project, description: description, author: author) } before_all do - project.add_developer(user) + project.add_developer(developer) + project.add_guest(guest) end before do @@ -18,57 +22,61 @@ RSpec.describe "User views incident" do visit(project_issues_incident_path(project, incident)) end - it { expect(page).to have_header_with_correct_id_and_link(1, "Description header", "description-header") } + specify do + expect(page).to have_header_with_correct_id_and_link(1, 'Description header', 'description-header') + end it_behaves_like 'page meta description', ' Description header Lorem ipsum dolor sit amet' describe 'user actions' do it 'shows the merge request and incident actions', :js, :aggregate_failures do + expected_href = new_project_issue_path(project, + issuable_template: 'incident', + issue: { issue_type: 'incident' }, + add_related_issue: incident.iid) + click_button 'Incident actions' - expect(page).to have_link('New related incident', href: new_project_issue_path(project, { issuable_template: 'incident', issue: { issue_type: 'incident' }, add_related_issue: incident.iid })) + expect(page).to have_link('New related incident', href: expected_href) expect(page).to have_button('Create merge request') expect(page).to have_button('Close incident') end - context 'when user is a guest' do - before do - project.add_guest(user) + context 'when user is guest' do + let(:user) { guest } - login_as(user) + context 'and author' do + let(:author) { guest } - visit(project_issues_incident_path(project, incident)) + it 'does not show the incident actions', :js do + expect(page).not_to have_button('Incident actions') + end end - it 'does not show the incident actions', :js, :aggregate_failures do - expect(page).not_to have_button('Incident actions') + context 'and not author' do + it 'shows incident actions', :js do + click_button 'Incident actions' + + expect(page).to have_link 'Report abuse' + end end end end context 'when the project is archived' do - before do + before_all do project.update!(archived: true) - visit(project_issues_incident_path(project, incident)) end - it 'hides the merge request and incident actions', :aggregate_failures do - expect(page).not_to have_link('New incident') - expect(page).not_to have_button('Create merge request') - expect(page).not_to have_link('Close incident') + it 'does not show the incident actions', :js do + expect(page).not_to have_button('Incident actions') end end describe 'user status' do - subject { visit(project_issues_incident_path(project, incident)) } - context 'when showing status of the author of the incident' do - it_behaves_like 'showing user status' do - let(:user_with_status) { user } - end - end + subject { visit(project_issues_incident_path(project, incident)) } - context 'when showing status of a user who commented on an incident', :js do it_behaves_like 'showing user status' do let(:user_with_status) { user } end 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 4837d13574c..2a201e0bc23 100644 --- a/spec/features/issues/user_bulk_edits_issues_labels_spec.rb +++ b/spec/features/issues/user_bulk_edits_issues_labels_spec.rb @@ -417,7 +417,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do click_button 'Select milestone' wait_for_requests items.map do |item| - click_link item + click_button item end end diff --git a/spec/features/issues/user_bulk_edits_issues_spec.rb b/spec/features/issues/user_bulk_edits_issues_spec.rb index 1ef2918adec..d7fad355cb4 100644 --- a/spec/features/issues/user_bulk_edits_issues_spec.rb +++ b/spec/features/issues/user_bulk_edits_issues_spec.rb @@ -80,7 +80,7 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do click_button 'Edit issues' check 'Select all' click_button 'Select milestone' - click_link milestone.title + click_button milestone.title click_update_issues_button expect(page.find('.issue')).to have_content milestone.title @@ -97,7 +97,7 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do click_button 'Edit issues' check 'Select all' click_button 'Select milestone' - click_link 'No milestone' + click_button 'No milestone' click_update_issues_button expect(find('.issue:first-of-type')).not_to have_text milestone.title diff --git a/spec/features/merge_requests/user_mass_updates_spec.rb b/spec/features/merge_requests/user_mass_updates_spec.rb index cf9760bcd7f..5c3cb098e28 100644 --- a/spec/features/merge_requests/user_mass_updates_spec.rb +++ b/spec/features/merge_requests/user_mass_updates_spec.rb @@ -130,7 +130,7 @@ RSpec.describe 'Merge requests > User mass updates', :js do click_button 'Edit merge requests' check 'Select all' click_button 'Select milestone' - click_link text + click_button text click_update_merge_requests_button end |