diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 2760096e44098391933312c394262ab720620697..66c2149d447b38324a0ab19022965e243b336dc8 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -19,11 +19,8 @@ class Projects::IssuesController < Projects::ApplicationController before_action :disable_query_limiting, only: [:create_merge_request, :move, :bulk_update] before_action :check_issues_available! before_action :issue, unless: ->(c) { ISSUES_EXCEPT_ACTIONS.include?(c.action_name.to_sym) } - before_action :redirect_if_work_item, unless: ->(c) { work_item_redirect_except_actions.include?(c.action_name.to_sym) } before_action :require_incident_for_incident_routes, only: :show - after_action :log_issue_show, only: :show - before_action :set_issuables_index, if: ->(c) { SET_ISSUABLES_INDEX_ONLY_ACTIONS.include?(c.action_name.to_sym) && !index_html_request? } @@ -31,6 +28,9 @@ class Projects::IssuesController < Projects::ApplicationController SET_ISSUABLES_INDEX_ONLY_ACTIONS.include?(c.action_name.to_sym) && !index_html_request? && params[:search].present? } + before_action :redirect_if_work_item, unless: ->(c) { work_item_redirect_except_actions.include?(c.action_name.to_sym) } + before_action :redirect_index_to_work_items, only: :index + # Allow write(create) issue before_action :authorize_create_issue!, only: [:new, :create] @@ -72,6 +72,8 @@ class Projects::IssuesController < Projects::ApplicationController push_frontend_feature_flag(:work_items_view_preference, current_user) end + after_action :log_issue_show, only: :show + around_action :allow_gitaly_ref_name_caching, only: [:discussions] respond_to :html @@ -474,6 +476,13 @@ def redirect_if_work_item redirect_to project_work_item_path(project, issue.iid, params: request.query_parameters) end + def redirect_index_to_work_items + return unless index_html_request? && ::Feature.enabled?(:work_item_planning_view, project.group) + + params = request.query_parameters.except("type").merge('type[]' => 'issue') + redirect_to project_work_items_path(project, params: params) + end + def require_incident_for_incident_routes return unless params[:incident_tab].present? return if issue.work_item_type&.incident? diff --git a/ee/spec/features/issues/blocking_issues_spec.rb b/ee/spec/features/issues/blocking_issues_spec.rb index 0dbd94ef156a085ae35e4abddc9a11776d494793..0041500036cc344213b17c6a4f48146b6d54af5f 100644 --- a/ee/spec/features/issues/blocking_issues_spec.rb +++ b/ee/spec/features/issues/blocking_issues_spec.rb @@ -11,6 +11,11 @@ let_it_be(:issue2) { build(:issue, project: project, created_at: 3.days.ago, title: 'blocks two issues') } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + visit project_issues_path(project) end diff --git a/ee/spec/features/issues/filtered_search/filter_issues_by_custom_fields_spec.rb b/ee/spec/features/issues/filtered_search/filter_issues_by_custom_fields_spec.rb index 8487a5a10cab42e37e9e9f40576c963f820b5ab5..fd215e54ffd1c05ad39832cd95846dfc2e33e683 100644 --- a/ee/spec/features/issues/filtered_search/filter_issues_by_custom_fields_spec.rb +++ b/ee/spec/features/issues/filtered_search/filter_issues_by_custom_fields_spec.rb @@ -20,6 +20,11 @@ end before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + sign_in(user) end diff --git a/ee/spec/features/issues/filtered_search/filter_issues_by_health_spec.rb b/ee/spec/features/issues/filtered_search/filter_issues_by_health_spec.rb index 3890239993bff49941ba183223f892a3a733a8ec..5d933181f3607688a391ea6140f930a5f781eb54 100644 --- a/ee/spec/features/issues/filtered_search/filter_issues_by_health_spec.rb +++ b/ee/spec/features/issues/filtered_search/filter_issues_by_health_spec.rb @@ -51,6 +51,11 @@ def expect_issues_list_to_not_contain(issues) end before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + stub_licensed_features(issuable_health_status: true) project.add_maintainer(user) sign_in(user) diff --git a/ee/spec/features/issues/filtered_search/filter_issues_by_iteration_spec.rb b/ee/spec/features/issues/filtered_search/filter_issues_by_iteration_spec.rb index b2bf9238349002ce11985cdd21b4bc0bc8ae14de..84a85b231d23d5379077ff6bab6a5c26f6c11341 100644 --- a/ee/spec/features/issues/filtered_search/filter_issues_by_iteration_spec.rb +++ b/ee/spec/features/issues/filtered_search/filter_issues_by_iteration_spec.rb @@ -20,6 +20,13 @@ let_it_be(:iteration_2_issue) { create(:issue, project: project, iteration: iteration_2) } let_it_be(:no_iteration_issue) { create(:issue, project: project) } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + shared_examples 'filters by iteration' do context 'when iterations are not available' do before do diff --git a/ee/spec/features/issues/filtered_search/filter_issues_by_multiple_assignees_spec.rb b/ee/spec/features/issues/filtered_search/filter_issues_by_multiple_assignees_spec.rb index d2cbd59c34f0d552e3fdfd8bd85266eb1028a417..5e5ed5358fd3c9067aba2aaacf2889d6a334ec28 100644 --- a/ee/spec/features/issues/filtered_search/filter_issues_by_multiple_assignees_spec.rb +++ b/ee/spec/features/issues/filtered_search/filter_issues_by_multiple_assignees_spec.rb @@ -17,6 +17,11 @@ end before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + sign_in(user) visit project_issues_path(project) end diff --git a/ee/spec/features/issues/filtered_search/filter_issues_epic_spec.rb b/ee/spec/features/issues/filtered_search/filter_issues_epic_spec.rb index 3f0d0be9510cb146fb4c96ecbaa6c728e47b312f..73e2f71e405840f351b344967415750097cfeb2d 100644 --- a/ee/spec/features/issues/filtered_search/filter_issues_epic_spec.rb +++ b/ee/spec/features/issues/filtered_search/filter_issues_epic_spec.rb @@ -62,6 +62,11 @@ context 'when project issues list page' do before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + visit project_issues_path(project) end diff --git a/ee/spec/features/issues/filtered_search/filter_issues_weight_spec.rb b/ee/spec/features/issues/filtered_search/filter_issues_weight_spec.rb index 55c8bf6ba865473eeb81fbb0793b467180ed1066..0747a83c13c34cd92d46cb569404d29e615c972b 100644 --- a/ee/spec/features/issues/filtered_search/filter_issues_weight_spec.rb +++ b/ee/spec/features/issues/filtered_search/filter_issues_weight_spec.rb @@ -22,6 +22,11 @@ def expect_issues_list_count(open_count, closed_count = 0) end before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_maintainer(user) sign_in(user) diff --git a/ee/spec/features/issues/user_bulk_edits_issues_spec.rb b/ee/spec/features/issues/user_bulk_edits_issues_spec.rb index f22d253571b94e4f595f5364ca69371f6fd4a0ba..4f33c4b716aa1bc337e130e108d741c28e4b49ed 100644 --- a/ee/spec/features/issues/user_bulk_edits_issues_spec.rb +++ b/ee/spec/features/issues/user_bulk_edits_issues_spec.rb @@ -19,6 +19,13 @@ let!(:issue2) { create(:issue, project: project, title: "Issue 2") } let!(:issue3) { create(:issue, project: project_without_group, title: "Issue 3") } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + shared_examples 'bulk edit option in sidebar' do |context| it 'is present when bulk edit is enabled' do enable_bulk_update(context) diff --git a/ee/spec/features/issues/user_sees_empty_state_spec.rb b/ee/spec/features/issues/user_sees_empty_state_spec.rb index a10a6f4e43d1591681e8199adcc32e19aaaaef6e..bcac9a8f265083a68a219ff94e7f9b87b036e706 100644 --- a/ee/spec/features/issues/user_sees_empty_state_spec.rb +++ b/ee/spec/features/issues/user_sees_empty_state_spec.rb @@ -6,6 +6,13 @@ let_it_be(:project) { create(:project, :public) } let_it_be(:auditor) { create(:user, auditor: true) } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + shared_examples 'empty state' do |expect_button| it "shows empty state #{expect_button ? 'with' : 'without'} \"New issue\" button" do visit project_issues_path(project) diff --git a/ee/spec/features/issues/user_views_issues_spec.rb b/ee/spec/features/issues/user_views_issues_spec.rb index dc3c6eeef98af8937b0d1fbfecbda2f86a42bdf7..49655531053f84fa7f9ba7d19112185f55c43849 100644 --- a/ee/spec/features/issues/user_views_issues_spec.rb +++ b/ee/spec/features/issues/user_views_issues_spec.rb @@ -10,6 +10,11 @@ let_it_be(:issue3) { create(:issue, project: project, health_status: 'at_risk') } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + stub_licensed_features(blocked_issues: true, issuable_health_status: true, issue_weights: true) sign_in(user) visit project_issues_path(project) diff --git a/ee/spec/features/learn_gitlab_spec.rb b/ee/spec/features/learn_gitlab_spec.rb index c2d53a82ec620238fdea7a349d493916e129e023..a7d72ee7131c858d587a00c8384e1ea5a2427c68 100644 --- a/ee/spec/features/learn_gitlab_spec.rb +++ b/ee/spec/features/learn_gitlab_spec.rb @@ -10,6 +10,13 @@ let_it_be(:namespace) { create(:group, owners: user) } let_it_be(:project) { create(:project, namespace: namespace) } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + context 'with completed links' do before do yesterday = Date.yesterday diff --git a/ee/spec/features/work_items/okr_spec.rb b/ee/spec/features/work_items/okr_spec.rb index 2a17c004010f8093666be7df5ef94d04a060e19b..4298d4f7fcb85929aaa75b5eadcc51f2005df765 100644 --- a/ee/spec/features/work_items/okr_spec.rb +++ b/ee/spec/features/work_items/okr_spec.rb @@ -26,6 +26,11 @@ stub_licensed_features(okrs: true, issuable_health_status: true) stub_feature_flags(work_items: true, okrs_mvc: true) + + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) end describe 'creating objective from issues list' do diff --git a/ee/spec/requests/projects/issues_controller_spec.rb b/ee/spec/requests/projects/issues_controller_spec.rb index 58f574b043bf0fb96e8763025edf9bd238765885..3bdc3f7bb4daf8c83da50f5b497667869fc0f93d 100644 --- a/ee/spec/requests/projects/issues_controller_spec.rb +++ b/ee/spec/requests/projects/issues_controller_spec.rb @@ -120,60 +120,67 @@ def get_show end describe 'GET #index' do - context 'when viewing all issues' do - include_examples 'seat count alert' do - subject { get project_issues_path(project, params: {}) } + let_it_be(:current_user) { create(:user) } + let_it_be(:project) { create(:project, group: group, developers: [user]) } + let_it_be(:issues) { create_list(:issue, 5, project: project, due_date: Date.current) } + let(:params) { {} } - let(:namespace) { project } + subject(:get_index) { get project_issues_path(project, params: params) } - before do - project.add_developer(user) - end + context 'when work_item_planning_view is disabled' do + before do + stub_feature_flags(work_item_planning_view: false) end - end - - context 'when filtering by custom field' do - include_context 'with group configured with custom fields' - let_it_be(:current_user) { create(:user) } - let_it_be(:project) { create(:project, group: group, developers: [user]) } - let_it_be(:issues) { create_list(:issue, 5, project: project, due_date: Date.current) } + context 'when viewing all issues' do + include_examples 'seat count alert' do + let(:namespace) { project } - before_all do - create(:work_item_select_field_value, work_item_id: issues[0].id, custom_field: select_field, - custom_field_select_option: select_option_1) - create(:work_item_select_field_value, work_item_id: issues[1].id, custom_field: select_field, - custom_field_select_option: select_option_2) - create(:work_item_select_field_value, work_item_id: issues[2].id, custom_field: select_field, - custom_field_select_option: select_option_2) + before do + project.add_developer(user) + end + end end - before do - stub_licensed_features(custom_fields: true) - end + context 'when filtering by custom field' do + include_context 'with group configured with custom fields' + + before_all do + create(:work_item_select_field_value, work_item_id: issues[0].id, custom_field: select_field, + custom_field_select_option: select_option_1) + create(:work_item_select_field_value, work_item_id: issues[1].id, custom_field: select_field, + custom_field_select_option: select_option_2) + create(:work_item_select_field_value, work_item_id: issues[2].id, custom_field: select_field, + custom_field_select_option: select_option_2) + end - context 'when requesting RSS feed' do - it 'returns issues filtered by the custom field value' do - get project_issues_path(project, format: :atom, custom_field: { select_field.id => select_option_2.id }) + before do + stub_licensed_features(custom_fields: true) + end - expect(response).to have_gitlab_http_status(:ok) + context 'when requesting RSS feed' do + it 'returns issues filtered by the custom field value' do + get project_issues_path(project, format: :atom, custom_field: { select_field.id => select_option_2.id }) - issue_titles = Nokogiri::XML(response.body).css('feed entry title').map(&:text) - expect(issue_titles).to contain_exactly(issues[1].title, issues[2].title) + expect(response).to have_gitlab_http_status(:ok) + + issue_titles = Nokogiri::XML(response.body).css('feed entry title').map(&:text) + expect(issue_titles).to contain_exactly(issues[1].title, issues[2].title) + end end - end - context 'when requesting calendar feed' do - it 'returns issues filtered by the custom field value' do - get project_issues_path(project, format: :ics, custom_field: { select_field.id => select_option_2.id }) + context 'when requesting calendar feed' do + it 'returns issues filtered by the custom field value' do + get project_issues_path(project, format: :ics, custom_field: { select_field.id => select_option_2.id }) - expect(response).to have_gitlab_http_status(:ok) + expect(response).to have_gitlab_http_status(:ok) - event_titles = response.body.split("\r\n").filter { |s| s.start_with?('SUMMARY:') } - expect(event_titles).to contain_exactly( - "SUMMARY:#{issues[1].title} (in #{project.full_path})", - "SUMMARY:#{issues[2].title} (in #{project.full_path})" - ) + event_titles = response.body.split("\r\n").filter { |s| s.start_with?('SUMMARY:') } + expect(event_titles).to contain_exactly( + "SUMMARY:#{issues[1].title} (in #{project.full_path})", + "SUMMARY:#{issues[2].title} (in #{project.full_path})" + ) + end end end end diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index e3cec83ed608281a9456d0ffeabb4a42fdf64f8b..0617a536abd3f9a769c891a887d71220215c1480 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -37,11 +37,23 @@ end context 'when GitLab issues enabled' do - it 'renders the "index" template' do + it 'redirects to work items index page' do get :index, params: { namespace_id: project.namespace, project_id: project } - expect(response).to have_gitlab_http_status(:ok) - expect(response).to render_template(:index) + expect(response).to redirect_to(project_work_items_path(project, 'type[]' => 'issue')) + end + + context 'when work_item_planning_view: false' do + before do + stub_feature_flags(work_item_planning_view: false) + end + + it 'renders the "index" template' do + get :index, params: { namespace_id: project.namespace, project_id: project } + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to render_template(:index) + end end end @@ -77,14 +89,26 @@ project.add_developer(user) end - it_behaves_like 'set sort order from user preference' do - let(:sorting_param) { 'updated_asc' } + it 'redirects to work items index page' do + get :index, params: { namespace_id: project.namespace, project_id: project } + + expect(response).to redirect_to(project_work_items_path(project, 'type[]' => 'issue')) end - it "returns index" do - get :index, params: { namespace_id: project.namespace, project_id: project } + context 'when work_item_planning_view: false' do + before do + stub_feature_flags(work_item_planning_view: false) + end - expect(response).to have_gitlab_http_status(:ok) + it "returns index" do + get :index, params: { namespace_id: project.namespace, project_id: project } + + expect(response).to have_gitlab_http_status(:ok) + end + + it_behaves_like 'set sort order from user preference' do + let(:sorting_param) { 'updated_asc' } + end end it "returns 301 if request path doesn't match project path" do diff --git a/spec/features/abuse_report_spec.rb b/spec/features/abuse_report_spec.rb index 407a0507c95b35ca02dc2ee76d17a608e8ae6f34..40f299b5947c2c64aa17f50b6e3969f9a5bc951c 100644 --- a/spec/features/abuse_report_spec.rb +++ b/spec/features/abuse_report_spec.rb @@ -11,6 +11,11 @@ let_it_be(:issue) { create(:issue, project: project, author: abusive_user) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + sign_in(reporter1) end diff --git a/spec/features/breadcrumbs_schema_markup_spec.rb b/spec/features/breadcrumbs_schema_markup_spec.rb index ca4a8e8ab864b9a3474b3a4827ef17667056ec23..789356b96744c24107717fb3d3d7bb5af4079c97 100644 --- a/spec/features/breadcrumbs_schema_markup_spec.rb +++ b/spec/features/breadcrumbs_schema_markup_spec.rb @@ -12,6 +12,13 @@ let_it_be(:wiki_home_page) { create(:wiki_page, project: project, title: 'home') } let_it_be(:wiki_sub_page) { create(:wiki_page, project: project, title: 'home/subpage') } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + it 'generates the breadcrumb schema for user projects' do visit project_url(project) diff --git a/spec/features/callouts/registration_enabled_spec.rb b/spec/features/callouts/registration_enabled_spec.rb index 89bd91f8018e0ea74fea827a3677f3b17283bc5a..d2dcc231a64663eb3358591c56cb7eed87115538 100644 --- a/spec/features/callouts/registration_enabled_spec.rb +++ b/spec/features/callouts/registration_enabled_spec.rb @@ -34,6 +34,10 @@ end it 'does not display callout on pages other than root, admin, or dashboard' do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) visit project_issues_path(project) expect(page).not_to have_content callout_title diff --git a/spec/features/canonical_link_spec.rb b/spec/features/canonical_link_spec.rb index 988c5f399f5e0c20520b7835ac6b9efff9f34677..c29c937cfbb00a5fbf8a2c41f2ddc98bc014b6ff 100644 --- a/spec/features/canonical_link_spec.rb +++ b/spec/features/canonical_link_spec.rb @@ -13,6 +13,11 @@ let_it_be(:project_request) { project_url(project) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + sign_in(user) end diff --git a/spec/features/dashboard/issues_filter_spec.rb b/spec/features/dashboard/issues_filter_spec.rb index 0ef946322b78261e6d3bd79a6a3b00a6256587d4..3a9a0ea68e366675e179c13ad4f124676ff20d3b 100644 --- a/spec/features/dashboard/issues_filter_spec.rb +++ b/spec/features/dashboard/issues_filter_spec.rb @@ -19,6 +19,11 @@ let_it_be(:label2) { create(:label, title: 'bug') } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.labels << label project2.labels << label2 project.add_maintainer(user) diff --git a/spec/features/groups/empty_states_spec.rb b/spec/features/groups/empty_states_spec.rb index 99f99e1066557f502ffaa86b9c23b6a1749726a9..0d3baeed7b094ab55ee53643b8b10aa41926ec21 100644 --- a/spec/features/groups/empty_states_spec.rb +++ b/spec/features/groups/empty_states_spec.rb @@ -7,6 +7,11 @@ let(:user) { create(:group_member, :developer, user: create(:user), group: group).user } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + sign_in(user) end diff --git a/spec/features/ics/project_issues_spec.rb b/spec/features/ics/project_issues_spec.rb index 418958c01770aaa44e9cf5f7005581440df15f0c..f4db341125bd1bdc5126d7f47c33314a86025b0d 100644 --- a/spec/features/ics/project_issues_spec.rb +++ b/spec/features/ics/project_issues_spec.rb @@ -22,6 +22,11 @@ let!(:issue) { create(:issue, author: user, assignees: [assignee], project: project) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_developer(user) end diff --git a/spec/features/incidents/incident_details_spec.rb b/spec/features/incidents/incident_details_spec.rb index 74c063e74dfbf383bc236a4398f45d98ef0c6ad3..ea7e230568f10871859948453a3a8a0411a0aff4 100644 --- a/spec/features/incidents/incident_details_spec.rb +++ b/spec/features/incidents/incident_details_spec.rb @@ -22,6 +22,11 @@ end before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + sign_in(developer) end diff --git a/spec/features/incidents/user_views_incident_spec.rb b/spec/features/incidents/user_views_incident_spec.rb index 85761c393b030702f9e5fbf6efb49cc3fc744157..36764ef433882611e323edf09b5a3cbd872cc136 100644 --- a/spec/features/incidents/user_views_incident_spec.rb +++ b/spec/features/incidents/user_views_incident_spec.rb @@ -12,6 +12,11 @@ let(:incident) { create(:incident, project: project, description: description, author: author) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + sign_in(user) visit(incident_project_issues_path(project, incident)) diff --git a/spec/features/issuables/issuable_list_spec.rb b/spec/features/issuables/issuable_list_spec.rb index 9cba924d2354829d9081acadd39ee47416aebf7f..91f9f59dc74b63d59165de597a04678e498d3606 100644 --- a/spec/features/issuables/issuable_list_spec.rb +++ b/spec/features/issuables/issuable_list_spec.rb @@ -9,6 +9,11 @@ issuable_types = [:issue, :merge_request] before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_member(user, :developer) sign_in(user) issuable_types.each { |type| create_issuables(type) } diff --git a/spec/features/issuables/sorting_list_spec.rb b/spec/features/issuables/sorting_list_spec.rb index 29c4581bcb214c33f3bff98f4611b4fec005703d..c53094a5abbf6cf031a95032ac87948450cf8f05 100644 --- a/spec/features/issuables/sorting_list_spec.rb +++ b/spec/features/issuables/sorting_list_spec.rb @@ -13,6 +13,13 @@ let(:first_updated_issuable) { issuables.order_updated_asc.first } let(:last_updated_issuable) { issuables.order_updated_desc.first } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + context 'for merge requests' do include MergeRequestHelpers diff --git a/spec/features/issue_rebalancing_spec.rb b/spec/features/issue_rebalancing_spec.rb index 3933f0ffcf8b25547fc2bc7263b922e1906b6908..d39e1cf36971a2461cf4efd54634790cc4fc0556 100644 --- a/spec/features/issue_rebalancing_spec.rb +++ b/spec/features/issue_rebalancing_spec.rb @@ -19,6 +19,11 @@ before do sign_in(user) + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + stub_feature_flags(block_issue_repositioning: true) end diff --git a/spec/features/issues/csv_spec.rb b/spec/features/issues/csv_spec.rb index a8dc90fa807362e4a1cbd75aa336884cde7513e8..e9f75bc3da0a24e886121f30445401f90fd4906e 100644 --- a/spec/features/issues/csv_spec.rb +++ b/spec/features/issues/csv_spec.rb @@ -12,6 +12,11 @@ let!(:issue) { create(:issue, project: project, author: user) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + sign_in(user) visit project_issues_path(project) end diff --git a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb index 852a5d7bd365c77f48cf0fd13663c9e4131175a4..7425886183a3b4b94193cc408b34c7d49f34e253 100644 --- a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb @@ -9,6 +9,13 @@ let_it_be(:user) { create(:user) } let_it_be(:issue) { create(:issue, project: project) } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + describe 'behavior' do before do project.add_maintainer(user) diff --git a/spec/features/issues/filtered_search/dropdown_author_spec.rb b/spec/features/issues/filtered_search/dropdown_author_spec.rb index d1171ea9ec8578efa792eb57da4a5b9b177b1469..227da0f2f1c03c93463a4f318dbfa28fdb0c1ad2 100644 --- a/spec/features/issues/filtered_search/dropdown_author_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_author_spec.rb @@ -10,6 +10,11 @@ let_it_be(:issue) { create(:issue, project: project) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_maintainer(user) sign_in(user) diff --git a/spec/features/issues/filtered_search/dropdown_base_spec.rb b/spec/features/issues/filtered_search/dropdown_base_spec.rb index 9108a966cd38f6a5dbb4b85cc51090e3102e49d4..64bcd38ae50172e8b15023ffb4a2fa348914d44d 100644 --- a/spec/features/issues/filtered_search/dropdown_base_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_base_spec.rb @@ -10,6 +10,11 @@ let_it_be(:issue) { create(:issue, project: project) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_maintainer(user) sign_in(user) diff --git a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb index 0ea4b7224d670a62815cc7dfc5b99408d9cab9ca..b05135c5ae583b89a54734fc96daac312b058da3 100644 --- a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb @@ -11,6 +11,11 @@ let_it_be(:award_emoji_star) { create(:award_emoji, name: 'star', user: user, awardable: issue) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_maintainer(user) create_list(:award_emoji, 2, user: user, name: AwardEmoji::THUMBS_UP) create_list(:award_emoji, 1, user: user, name: AwardEmoji::THUMBS_DOWN) diff --git a/spec/features/issues/filtered_search/dropdown_hint_spec.rb b/spec/features/issues/filtered_search/dropdown_hint_spec.rb index 41794833d26b7200955f7195efca3f3fb59ca64c..5a826cfaee96fc9efe5b730bbfec11393952d36b 100644 --- a/spec/features/issues/filtered_search/dropdown_hint_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_hint_spec.rb @@ -10,6 +10,11 @@ let_it_be(:issue) { create(:issue, project: project) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_maintainer(user) end diff --git a/spec/features/issues/filtered_search/dropdown_label_spec.rb b/spec/features/issues/filtered_search/dropdown_label_spec.rb index 4a4be7efa3da83bc89ae40da1cb53f9a113e5a4b..195b270a922d9a4fce7226a34a526474073509b1 100644 --- a/spec/features/issues/filtered_search/dropdown_label_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_label_spec.rb @@ -11,6 +11,11 @@ let_it_be(:label) { create(:label, project: project, title: 'bug-label') } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_maintainer(user) sign_in(user) diff --git a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb index d7c18171ab69b2180257298a501006791415752e..e7c1833a8532b8b016834296b73e72374914d619 100644 --- a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb @@ -12,6 +12,11 @@ let_it_be(:issue) { create(:issue, project: project) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_maintainer(user) sign_in(user) diff --git a/spec/features/issues/filtered_search/dropdown_release_spec.rb b/spec/features/issues/filtered_search/dropdown_release_spec.rb index ea153d815e5e9b66461dbbaf2c80e6727c587ab6..6f2abedd0e0bfa2b1cbe454f9de13ac03a4b4d48 100644 --- a/spec/features/issues/filtered_search/dropdown_release_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_release_spec.rb @@ -12,6 +12,11 @@ let_it_be(:issue) { create(:issue, project: project) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_maintainer(user) sign_in(user) diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb index dd2d7f87ff5c17432da62c5fdc5b34cdff322c76..81b6b669bb635b718da6d3866cd6f98f6986e511 100644 --- a/spec/features/issues/filtered_search/filter_issues_spec.rb +++ b/spec/features/issues/filtered_search/filter_issues_spec.rb @@ -19,6 +19,11 @@ def expect_no_issues_list end before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_maintainer(user) create(:issue, project: project, author: user2, title: "Bug report 1") diff --git a/spec/features/issues/filtered_search/recent_searches_spec.rb b/spec/features/issues/filtered_search/recent_searches_spec.rb index 4b36e7f295e58e1beacf646caa3677c473ec49b0..18fddcde2ffc14860b45d06688cd50b447baf8b0 100644 --- a/spec/features/issues/filtered_search/recent_searches_spec.rb +++ b/spec/features/issues/filtered_search/recent_searches_spec.rb @@ -13,6 +13,11 @@ let(:project_1_local_storage_key) { "#{project_1.full_path}-issue-recent-searches" } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + # Visit any fast-loading page so we can clear local storage without a DOM exception visit '/404' remove_recent_searches diff --git a/spec/features/issues/filtered_search/search_bar_spec.rb b/spec/features/issues/filtered_search/search_bar_spec.rb index 35c099b29aaa1564e50a2f352627837befa34d1d..c98dffeae3587a1208e940ce1b06a8cd86494e7e 100644 --- a/spec/features/issues/filtered_search/search_bar_spec.rb +++ b/spec/features/issues/filtered_search/search_bar_spec.rb @@ -10,6 +10,11 @@ let_it_be(:issue) { create(:issue, project: project) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_maintainer(user) sign_in(user) diff --git a/spec/features/issues/filtered_search/visual_tokens_spec.rb b/spec/features/issues/filtered_search/visual_tokens_spec.rb index d17bad8a1b05394348882a3b848123413fd62e6f..c47b63b2d6d95247dfb45c480f4ffabc7195c648 100644 --- a/spec/features/issues/filtered_search/visual_tokens_spec.rb +++ b/spec/features/issues/filtered_search/visual_tokens_spec.rb @@ -15,6 +15,11 @@ let_it_be(:issue) { create(:issue, project: project) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_member(user, :maintainer) project.add_member(user_rock, :maintainer) sign_in(user) diff --git a/spec/features/issues/group_label_sidebar_spec.rb b/spec/features/issues/group_label_sidebar_spec.rb index 41450ba33734dd2b02c4864d64bac4fcc82ecc4c..a52ab35f4a67d39e0b87382f6064a678356b728b 100644 --- a/spec/features/issues/group_label_sidebar_spec.rb +++ b/spec/features/issues/group_label_sidebar_spec.rb @@ -4,6 +4,11 @@ RSpec.describe 'Group label on issue', :with_license, feature_category: :team_planning do it 'renders link to the project issues page', :js do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + group = create(:group) project = create(:project, :public, namespace: group) feature = create(:group_label, group: group, title: 'feature') diff --git a/spec/features/issues/incident_issue_spec.rb b/spec/features/issues/incident_issue_spec.rb index 805d6b76742fd7817309937840f8f8763735075c..82e9e69589619a12ca7182af6683c39575ff911c 100644 --- a/spec/features/issues/incident_issue_spec.rb +++ b/spec/features/issues/incident_issue_spec.rb @@ -24,6 +24,13 @@ let_it_be(:alert) { create(:alert_management_alert, project: project, payload: payload, started_at: started_at) } let_it_be(:incident) { create(:incident, project: project, description: 'hello', alert_management_alert: alert) } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + context 'when user displays the incident' do before do project.add_developer(user) diff --git a/spec/features/issues/issue_detail_spec.rb b/spec/features/issues/issue_detail_spec.rb index ec1a0793e77c9181059d0c00fa14325d62a9e2dc..2dfe47cc2f99d3f210873b15b35778173056dd12 100644 --- a/spec/features/issues/issue_detail_spec.rb +++ b/spec/features/issues/issue_detail_spec.rb @@ -9,6 +9,13 @@ let(:issue) { create(:issue, project: project, author: user) } let(:incident) { create(:incident, project: project, author: user) } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + context 'when user displays the issue' do before do visit project_issue_path(project, issue) diff --git a/spec/features/issues/rss_spec.rb b/spec/features/issues/rss_spec.rb index 437fde956a249ae3b081bd4b94f453d4b4767043..8ca4969e43b880d58d78c6d3489382143d2699ef 100644 --- a/spec/features/issues/rss_spec.rb +++ b/spec/features/issues/rss_spec.rb @@ -9,6 +9,13 @@ let_it_be(:path) { project_issues_path(project) } let_it_be(:issue) { create(:issue, project: project, assignees: [user]) } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + context 'when signed in' do let_it_be(:user) { create(:user) } diff --git a/spec/features/issues/service_desk_spec.rb b/spec/features/issues/service_desk_spec.rb index b7b5bf8621ce14b3289845d0ace21bc5afd159d6..4368dce99eab3f8935c1535df35e305b04b0f7a7 100644 --- a/spec/features/issues/service_desk_spec.rb +++ b/spec/features/issues/service_desk_spec.rb @@ -9,6 +9,11 @@ let_it_be(:support_bot) { Users::Internal.support_bot } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + # The following two conditions equate to ServiceDesk.supported == true allow(Gitlab::Email::IncomingEmail).to receive(:enabled?).and_return(true) allow(Gitlab::Email::IncomingEmail).to receive(:supports_wildcard?).and_return(true) 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 97353f940e8dd97f1367592243801a837021bf00..fd7c912ae4afc17181f6d524104d9b6be4ca3f2b 100644 --- a/spec/features/issues/user_bulk_edits_issues_labels_spec.rb +++ b/spec/features/issues/user_bulk_edits_issues_labels_spec.rb @@ -15,6 +15,13 @@ let(:issue_1_selector) { "#issuable_#{issue1.id}" } let(:issue_2_selector) { "#issuable_#{issue2.id}" } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + context 'as an allowed user', :js do before do project.add_maintainer(user) diff --git a/spec/features/issues/user_bulk_edits_issues_spec.rb b/spec/features/issues/user_bulk_edits_issues_spec.rb index 9a5f260e9e4e38ccd07dc3df93e7a290421b7a04..718fce806db953442d8334e350a1d7b630bc9067 100644 --- a/spec/features/issues/user_bulk_edits_issues_spec.rb +++ b/spec/features/issues/user_bulk_edits_issues_spec.rb @@ -10,6 +10,11 @@ let!(:user) { create(:user) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_maintainer(user) sign_in(user) end diff --git a/spec/features/issues/user_creates_issue_by_email_spec.rb b/spec/features/issues/user_creates_issue_by_email_spec.rb index d6d2b2a50f8953865b1e6b9ee8a4015964b2ef1c..8db23d02a9290a9e57428d36fede769d8ca8d784 100644 --- a/spec/features/issues/user_creates_issue_by_email_spec.rb +++ b/spec/features/issues/user_creates_issue_by_email_spec.rb @@ -7,6 +7,11 @@ let_it_be(:project) { create(:project, :public) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + sign_in(user) project.add_developer(user) diff --git a/spec/features/issues/user_creates_issue_spec.rb b/spec/features/issues/user_creates_issue_spec.rb index 5abd02fb580fccefc93796c9d60e180acf2b9a88..55bea0a268154479fd07308b28000316d838c2f5 100644 --- a/spec/features/issues/user_creates_issue_spec.rb +++ b/spec/features/issues/user_creates_issue_spec.rb @@ -8,6 +8,13 @@ let_it_be(:project) { create(:project_empty_repo, :public) } let_it_be(:user) { create(:user) } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + context "when unauthenticated" do before do sign_out(:user) diff --git a/spec/features/issues/user_filters_issues_spec.rb b/spec/features/issues/user_filters_issues_spec.rb index 593b43698a2cfdd90656f85391716803249dcc7c..3554445769fcfa42a5cb8041ae6954f6fb5be2b5 100644 --- a/spec/features/issues/user_filters_issues_spec.rb +++ b/spec/features/issues/user_filters_issues_spec.rb @@ -7,6 +7,11 @@ let_it_be(:project) { create(:project_empty_repo, :public) } before do + # TODO: When removing the feature flag, + # we won't need these tests for issues, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + %w[foobar barbaz].each do |title| create( :issue, diff --git a/spec/features/issues/user_resets_their_incoming_email_token_spec.rb b/spec/features/issues/user_resets_their_incoming_email_token_spec.rb index df6443a32b4a4a49e0e24089dc9d52005699d08a..9e4e60b54ff7eb6a0ac6bd2979fa66fd4fdfaa47 100644 --- a/spec/features/issues/user_resets_their_incoming_email_token_spec.rb +++ b/spec/features/issues/user_resets_their_incoming_email_token_spec.rb @@ -8,6 +8,11 @@ let_it_be(:issue) { create(:issue, project: project) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + stub_incoming_email_setting(enabled: true, address: "p+%{key}@gl.ab") project.add_maintainer(user) sign_in(user) diff --git a/spec/features/issues/user_sees_breadcrumb_links_spec.rb b/spec/features/issues/user_sees_breadcrumb_links_spec.rb index 69be94a392cbae533f558331fdc9f28087b85f36..df77b7464f50eb2a10494b3e096779d2e9dbd626 100644 --- a/spec/features/issues/user_sees_breadcrumb_links_spec.rb +++ b/spec/features/issues/user_sees_breadcrumb_links_spec.rb @@ -8,6 +8,11 @@ let(:user) { project.creator } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + sign_in(user) visit(new_project_issue_path(project)) end diff --git a/spec/features/issues/user_sees_empty_state_spec.rb b/spec/features/issues/user_sees_empty_state_spec.rb index f51bafddf6901cd59e788fc2908d6b0e48ca31c0..3a857e980f237eea428d22512173ada144a08696 100644 --- a/spec/features/issues/user_sees_empty_state_spec.rb +++ b/spec/features/issues/user_sees_empty_state_spec.rb @@ -6,6 +6,13 @@ let_it_be(:project) { create(:project, :public) } let_it_be(:user) { project.creator } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + shared_examples_for 'empty state with filters' do it 'user sees empty state with filters' do create(:issue, author: user, project: project) diff --git a/spec/features/issues/user_sorts_issues_spec.rb b/spec/features/issues/user_sorts_issues_spec.rb index 5c6198785d0a09d26112627b6db0f229b493a32b..ee84e06157b41733cf8b1e39f3d7caf62ee9ec3d 100644 --- a/spec/features/issues/user_sorts_issues_spec.rb +++ b/spec/features/issues/user_sorts_issues_spec.rb @@ -17,6 +17,11 @@ let_it_be(:later_due_milestone) { create(:milestone, project: project, due_date: '2013-12-12') } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + create_list(:award_emoji, 2, :upvote, awardable: issue1) create_list(:award_emoji, 2, :downvote, awardable: issue2) create(:award_emoji, :downvote, awardable: issue1) diff --git a/spec/features/issues/user_views_issues_spec.rb b/spec/features/issues/user_views_issues_spec.rb index 83165c98437b34b3c1f7a81643b813b3500a1552..f8dc5ca1c9b00e95e26284842dab20aa699f6760 100644 --- a/spec/features/issues/user_views_issues_spec.rb +++ b/spec/features/issues/user_views_issues_spec.rb @@ -10,6 +10,13 @@ let_it_be(:user) { create(:user) } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + shared_examples "opens issue from list" do it "opens issue" do click_link(issue.title) diff --git a/spec/features/labels_hierarchy_spec.rb b/spec/features/labels_hierarchy_spec.rb index 6f70c27127adf0800f98018df0fa213b763bb0ca..ef5a4be5914031476fec2b9e4fa9a02a0f981f0c 100644 --- a/spec/features/labels_hierarchy_spec.rb +++ b/spec/features/labels_hierarchy_spec.rb @@ -21,6 +21,11 @@ let!(:project_label_1) { create(:label, project: project_1, title: 'Label_4') } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + grandparent.add_owner(user) sign_in(user) diff --git a/spec/features/merge_requests/user_sorts_merge_requests_spec.rb b/spec/features/merge_requests/user_sorts_merge_requests_spec.rb index 0d230519c85af650aa8bdccd70b5b9c801e3ed9f..e5a1673fe2ad7bac6587dccf5200061a912d2a63 100644 --- a/spec/features/merge_requests/user_sorts_merge_requests_spec.rb +++ b/spec/features/merge_requests/user_sorts_merge_requests_spec.rb @@ -17,6 +17,11 @@ let_it_be(:project) { create(:project, :public, group: group) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + sign_in(user) visit(project_merge_requests_path(project)) diff --git a/spec/features/milestones/user_views_milestone_spec.rb b/spec/features/milestones/user_views_milestone_spec.rb index ddb0eaae4d1ad96ed8187d8d0acc50889d83d0b1..ab8a7c8654ef44a7c4af14a7fbf548c8e0f5ba40 100644 --- a/spec/features/milestones/user_views_milestone_spec.rb +++ b/spec/features/milestones/user_views_milestone_spec.rb @@ -10,6 +10,11 @@ let_it_be(:labels) { create_list(:label, 2, project: project) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + sign_in(user) end diff --git a/spec/features/monitor_sidebar_link_spec.rb b/spec/features/monitor_sidebar_link_spec.rb index 75e373a9dc4efcbb923544db812fbd75d303cf64..2764a38b8a2dd6a3d97a863197cb332c107b6447 100644 --- a/spec/features/monitor_sidebar_link_spec.rb +++ b/spec/features/monitor_sidebar_link_spec.rb @@ -9,6 +9,11 @@ let(:role) { nil } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + project.add_role(user, role) if role sign_in(user) diff --git a/spec/features/projects/labels/issues_sorted_by_priority_spec.rb b/spec/features/projects/labels/issues_sorted_by_priority_spec.rb index 4898bf253be8df221f8c061af7fadd1313417f01..e1c537e1f7884875aeb8c6a9906c55be42961674 100644 --- a/spec/features/projects/labels/issues_sorted_by_priority_spec.rb +++ b/spec/features/projects/labels/issues_sorted_by_priority_spec.rb @@ -13,6 +13,13 @@ let(:label_4) { create(:label, title: 'label_4', project: project, priority: 4) } let(:label_5) { create(:label, title: 'label_5', project: project) } # no priority + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + # According to https://gitlab.com/gitlab-org/gitlab-foss/issues/14189#note_4360653 context 'when issues have one label', :js do it 'are sorted properly' do diff --git a/spec/features/task_lists_spec.rb b/spec/features/task_lists_spec.rb index 6ddc1aabc877b4aa4fc12c0e8c2ed312686d0a23..6d976fa79d80e2947b359c404d882141842cc3a7 100644 --- a/spec/features/task_lists_spec.rb +++ b/spec/features/task_lists_spec.rb @@ -39,6 +39,11 @@ end before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + sign_in(user) end diff --git a/spec/features/work_items/redirect_from_issues_spec.rb b/spec/features/work_items/redirect_from_issues_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..2932c7c7e6497e44472e68fad938bafa159423ab --- /dev/null +++ b/spec/features/work_items/redirect_from_issues_spec.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Redirect from issues', :js, feature_category: :team_planning do + let_it_be(:user) { create(:user) } + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, :public, group: group, developers: [user]) } + + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + + context 'for signed in user' do + before do + sign_in(user) + end + + context 'when work_item_planning_view feature flag if disabled' do + before do + stub_feature_flags(work_item_planning_view: false) + end + + it 'do not redirect to work items', :aggregate_failures do + visit project_issues_path(project) + + expect(page).to have_current_path(project_issues_path(project)) + end + end + + context 'when work_item_planning_view feature flag if enabled' do + before do + stub_feature_flags(work_item_planning_view: true) + end + + it 'redirects to work items', :aggregate_failures do + visit project_issues_path(project) + + expect(page).to have_current_path(project_work_items_path(project, 'type[]': 'issue')) + end + + context 'and the original request has a sorting parameter' do + it 'redirects to work items', :aggregate_failures do + visit project_issues_path(project, sort: 'updated_desc') + + expect(page).to have_current_path(project_work_items_path(project, 'type[]': 'issue', sort: 'updated_desc')) + end + end + end + end +end diff --git a/spec/features/work_items/work_item_detail_spec.rb b/spec/features/work_items/work_item_detail_spec.rb index 62369acced553154c2036a16cd5562423e174c2d..e6cd562dbea188039ef1f1aa4a611be6ab49b912 100644 --- a/spec/features/work_items/work_item_detail_spec.rb +++ b/spec/features/work_items/work_item_detail_spec.rb @@ -23,6 +23,13 @@ let(:list_path) { project_issues_path(project) } let(:work_items_path) { project_work_item_path(project, work_item.iid) } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + shared_examples 'change type action is not displayed' do it 'change type action is not displayed' do click_button _('More actions'), match: :first diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index d22e7b13aafc66ea95e44d17d1f8dfceaaed6ae6..1716242944aa33568bcf33ffb7a459963571779b 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -6,6 +6,13 @@ let(:label) { build_stubbed(:label) } let(:label2) { build_stubbed(:label) } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + describe '#users_dropdown_label' do let(:user) { build_stubbed(:user) } let(:user2) { build_stubbed(:user) } diff --git a/spec/helpers/issues_helper_spec.rb b/spec/helpers/issues_helper_spec.rb index 8ac24a8d80d83bfc42e0d543b264563c3477fdfa..588e33fe30dce60b6c12a122465c7b254aecd4f2 100644 --- a/spec/helpers/issues_helper_spec.rb +++ b/spec/helpers/issues_helper_spec.rb @@ -10,6 +10,13 @@ let_it_be(:project) { create(:project) } let_it_be_with_reload(:issue) { create(:issue, project: project) } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + describe '#award_user_list' do it 'returns a comma-separated list of the first X users' do user = build_stubbed(:user, name: 'Joe') diff --git a/spec/helpers/projects/alert_management_helper_spec.rb b/spec/helpers/projects/alert_management_helper_spec.rb index d42aafbbf28cbb0797e1dcbfccaaf225a495b57d..f48e5d8500efe4d152d74b53d973c45c3a1dbaa8 100644 --- a/spec/helpers/projects/alert_management_helper_spec.rb +++ b/spec/helpers/projects/alert_management_helper_spec.rb @@ -11,6 +11,13 @@ let(:project_path) { project.full_path } let(:project_id) { project.id } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + describe '#alert_management_data' do let(:user_can_enable_alert_management) { true } let(:setting_path) { project_settings_operations_path(project, anchor: 'js-alert-management-settings') } diff --git a/spec/helpers/projects/error_tracking_helper_spec.rb b/spec/helpers/projects/error_tracking_helper_spec.rb index 1ae595a5b10c7b2fc9cd7868af0c730ba457b22e..65475f4b7fa8a8aaa69fd780fc831c2eb6fa64ad 100644 --- a/spec/helpers/projects/error_tracking_helper_spec.rb +++ b/spec/helpers/projects/error_tracking_helper_spec.rb @@ -8,6 +8,13 @@ let(:project) { build_stubbed(:project) } let(:current_user) { build_stubbed(:user) } + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + describe '#error_tracking_data' do let(:can_enable_error_tracking) { true } let(:setting_path) { project_settings_operations_path(project) } diff --git a/spec/helpers/projects/incidents_helper_spec.rb b/spec/helpers/projects/incidents_helper_spec.rb index e69e10f1b4eb7b41e3b653c93f57dd369dce128a..275ac2b80b7f1d8b0df7f2d74c9863c119cc91f7 100644 --- a/spec/helpers/projects/incidents_helper_spec.rb +++ b/spec/helpers/projects/incidents_helper_spec.rb @@ -19,6 +19,11 @@ end before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + allow(helper).to receive(:current_user).and_return(user) allow(helper).to receive(:can?) .with(user, :create_incident, project) diff --git a/spec/helpers/search_helper_spec.rb b/spec/helpers/search_helper_spec.rb index 9104fdd500ba61a09c119752759ecb7db75ecad7..7dc3e4166971fc737a52efb4aede62139345a34d 100644 --- a/spec/helpers/search_helper_spec.rb +++ b/spec/helpers/search_helper_spec.rb @@ -6,6 +6,13 @@ include MarkupHelper include BadgesHelper + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + # Override simple_sanitize for our testing purposes def simple_sanitize(str) str diff --git a/spec/helpers/work_items_helper_spec.rb b/spec/helpers/work_items_helper_spec.rb index d99e42ce23e6488bb82214954491efc379257469..93f2ac7617314bab8d5ee2180a334129a58daad5 100644 --- a/spec/helpers/work_items_helper_spec.rb +++ b/spec/helpers/work_items_helper_spec.rb @@ -5,6 +5,13 @@ RSpec.describe WorkItemsHelper, feature_category: :team_planning do include Devise::Test::ControllerHelpers + before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + end + describe '#work_items_data' do describe 'with project context' do let_it_be(:project) { build(:project) } diff --git a/spec/requests/projects/issues_controller_spec.rb b/spec/requests/projects/issues_controller_spec.rb index 6c9b1966149282748cea391bf7fc88c379516bb0..44e2e6a8f077602d2c34ef31b9d4b8165b72bc8f 100644 --- a/spec/requests/projects/issues_controller_spec.rb +++ b/spec/requests/projects/issues_controller_spec.rb @@ -35,6 +35,77 @@ end end + describe 'GET #index' do + before do + group.add_developer(user) + login_as(user) + end + + let_it_be(:current_user) { create(:user) } + let_it_be(:project) { create(:project, group: group, developers: [user]) } + let_it_be(:issues) { create_list(:issue, 5, project: project, due_date: Date.current) } + let(:params) { {} } + + subject(:get_index) { get project_issues_path(project, params: params) } + + it 'redirects to work item listing page with correct type filter' do + get_index + + expect(response).to redirect_to(project_work_items_path(project, 'type[]' => 'issue')) + + follow_redirect! + + expect(response).to have_gitlab_http_status(:success) + expect(response).to render_template('work_items/index') + end + + context 'when params are set' do + let(:params) { { label_name: 'test', sort: 'updated_at' } } + + it 'persists the params when redirecting' do + get_index + + expect(response).to redirect_to(project_work_items_path(project, 'type[]' => 'issue', + label_name: 'test', sort: 'updated_at' + )) + end + end + + context 'when type param is set' do + let(:params) { { 'type[]' => 'epic' } } + + it 'overrides the existing param to issues' do + get_index + + expect(response).to redirect_to(project_work_items_path(project, 'type[]' => 'issue')) + end + end + + context 'when requesting RSS feed' do + it 'returns issues filtered by the custom field value' do + get project_issues_path(project, format: :atom) + + expect(response).to have_gitlab_http_status(:ok) + + issue_titles = Nokogiri::XML(response.body).css('feed entry title').map(&:text) + expect(issue_titles).to match_array(issues.map(&:title)) + end + end + + context 'when work_item_planning_view: false' do + before do + stub_feature_flags(work_item_planning_view: false) + end + + it 'renders the page' do + get_index + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to render_template('issues/index') + end + end + end + describe 'GET #discussions' do before do login_as(user) diff --git a/spec/views/shared/milestones/_issuable.html.haml_spec.rb b/spec/views/shared/milestones/_issuable.html.haml_spec.rb index a8e2d88ec0da4f762d447e039f4e37498242dd84..9c228833e3258c6eacfa62a4c0c67ba0bc0ec332 100644 --- a/spec/views/shared/milestones/_issuable.html.haml_spec.rb +++ b/spec/views/shared/milestones/_issuable.html.haml_spec.rb @@ -8,6 +8,11 @@ let_it_be(:milestone) { create(:milestone, project: project) } before do + # TODO: When removing the feature flag, + # we won't need the tests for the issues listing page, since we'll be using + # the work items listing page. + stub_feature_flags(work_item_planning_view: false) + assign(:project, project) assign(:milestone, milestone) end