From 8ee9c4311402db81b51f4a3a9a5019c17608f339 Mon Sep 17 00:00:00 2001 From: Nicolas Dular Date: Mon, 31 Mar 2025 16:04:25 +0200 Subject: [PATCH 1/8] Redirect to work items index for project issues This redirects requests to /:project/issues to /:project/work_items?type[]=issue when work_item_planning_view is enabled. --- app/controllers/projects/issues_controller.rb | 9 ++ .../projects/issues_controller_spec.rb | 87 ++++++++++--------- .../projects/issues_controller_spec.rb | 40 +++++++-- .../projects/issues_controller_spec.rb | 71 +++++++++++++++ 4 files changed, 159 insertions(+), 48 deletions(-) diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 2760096e440983..23a30bc9d765ce 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -31,6 +31,8 @@ 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_to_work_item_index, only: :index + # Allow write(create) issue before_action :authorize_create_issue!, only: [:new, :create] @@ -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_to_work_item_index + 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/requests/projects/issues_controller_spec.rb b/ee/spec/requests/projects/issues_controller_spec.rb index 58f574b043bf0f..3bdc3f7bb4daf8 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 e3cec83ed60828..0617a536abd3f9 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/requests/projects/issues_controller_spec.rb b/spec/requests/projects/issues_controller_spec.rb index 6c9b1966149282..44e2e6a8f07760 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) -- GitLab From a33f8022dbcf14501ee9466dcee246d87e8fd35f Mon Sep 17 00:00:00 2001 From: Kassio Borges Date: Thu, 3 Apr 2025 20:38:38 +0200 Subject: [PATCH 2/8] Add basic tests --- app/controllers/projects/issues_controller.rb | 10 ++--- .../work_items/redirect_from_issues_spec.rb | 39 +++++++++++++++++++ 2 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 spec/features/work_items/redirect_from_issues_spec.rb diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 23a30bc9d765ce..66c2149d447b38 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,7 +28,8 @@ 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_to_work_item_index, only: :index + 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] @@ -74,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 @@ -476,7 +476,7 @@ def redirect_if_work_item redirect_to project_work_item_path(project, issue.iid, params: request.query_parameters) end - def redirect_to_work_item_index + 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') 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 00000000000000..a87733bc9058c9 --- /dev/null +++ b/spec/features/work_items/redirect_from_issues_spec.rb @@ -0,0 +1,39 @@ +# 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]) } + + 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 'do not redirect to work items', :aggregate_failures do + visit project_issues_path(project) + + expect(page).to have_current_path(project_work_items_path(project), ignore_query: true) + end + end + end +end -- GitLab From 16837dcb204701430d64491083986309cd351763 Mon Sep 17 00:00:00 2001 From: Kassio Borges Date: Thu, 3 Apr 2025 20:42:19 +0200 Subject: [PATCH 3/8] Add test for sort parameter --- .../features/work_items/redirect_from_issues_spec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/features/work_items/redirect_from_issues_spec.rb b/spec/features/work_items/redirect_from_issues_spec.rb index a87733bc9058c9..bd77577fd9288a 100644 --- a/spec/features/work_items/redirect_from_issues_spec.rb +++ b/spec/features/work_items/redirect_from_issues_spec.rb @@ -29,10 +29,18 @@ stub_feature_flags(work_item_planning_view: true) end - it 'do not redirect to work items', :aggregate_failures do + it 'redirects to work items', :aggregate_failures do visit project_issues_path(project) - expect(page).to have_current_path(project_work_items_path(project), ignore_query: true) + 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 -- GitLab From 68a2a8ba3266e5ebe0d124f1f1e945583e4affff Mon Sep 17 00:00:00 2001 From: Kassio Borges Date: Tue, 8 Apr 2025 11:11:32 +0200 Subject: [PATCH 4/8] disable feature in some feature tests to avoid errors --- spec/features/breadcrumbs_schema_markup_spec.rb | 7 +++++++ spec/features/canonical_link_spec.rb | 5 +++++ spec/features/groups/empty_states_spec.rb | 5 +++++ spec/features/issuables/issuable_list_spec.rb | 5 +++++ spec/features/issue_rebalancing_spec.rb | 5 +++++ spec/features/issues/csv_spec.rb | 5 +++++ spec/features/issues/filtered_search/dropdown_hint_spec.rb | 5 +++++ .../issues/filtered_search/dropdown_release_spec.rb | 5 +++++ spec/features/issues/filtered_search/filter_issues_spec.rb | 5 +++++ spec/features/issues/filtered_search/search_bar_spec.rb | 5 +++++ spec/features/issues/rss_spec.rb | 7 +++++++ spec/features/issues/user_bulk_edits_issues_labels_spec.rb | 7 +++++++ spec/features/issues/user_bulk_edits_issues_spec.rb | 5 +++++ spec/features/issues/user_creates_issue_by_email_spec.rb | 5 +++++ spec/features/issues/user_creates_issue_spec.rb | 7 +++++++ spec/features/issues/user_filters_issues_spec.rb | 5 +++++ spec/features/issues/user_sorts_issues_spec.rb | 5 +++++ spec/features/labels_hierarchy_spec.rb | 5 +++++ .../projects/labels/issues_sorted_by_priority_spec.rb | 7 +++++++ spec/features/task_lists_spec.rb | 5 +++++ 20 files changed, 110 insertions(+) diff --git a/spec/features/breadcrumbs_schema_markup_spec.rb b/spec/features/breadcrumbs_schema_markup_spec.rb index ca4a8e8ab864b9..789356b96744c2 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/canonical_link_spec.rb b/spec/features/canonical_link_spec.rb index 988c5f399f5e0c..c29c937cfbb00a 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/groups/empty_states_spec.rb b/spec/features/groups/empty_states_spec.rb index 99f99e1066557f..0d3baeed7b094a 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/issuables/issuable_list_spec.rb b/spec/features/issuables/issuable_list_spec.rb index 9cba924d235482..91f9f59dc74b63 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/issue_rebalancing_spec.rb b/spec/features/issue_rebalancing_spec.rb index 3933f0ffcf8b25..1e101d35f61744 100644 --- a/spec/features/issue_rebalancing_spec.rb +++ b/spec/features/issue_rebalancing_spec.rb @@ -10,6 +10,11 @@ let(:alert_message_regex) { /Issues are being rebalanced at the moment/ } before_all 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(:issue, project: project) group.add_developer(user) diff --git a/spec/features/issues/csv_spec.rb b/spec/features/issues/csv_spec.rb index a8dc90fa807362..e9f75bc3da0a24 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_hint_spec.rb b/spec/features/issues/filtered_search/dropdown_hint_spec.rb index 41794833d26b72..5a826cfaee96fc 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_release_spec.rb b/spec/features/issues/filtered_search/dropdown_release_spec.rb index ea153d815e5e9b..6f2abedd0e0bfa 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 dd2d7f87ff5c17..81b6b669bb635b 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/search_bar_spec.rb b/spec/features/issues/filtered_search/search_bar_spec.rb index 35c099b29aaa15..c98dffeae3587a 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/rss_spec.rb b/spec/features/issues/rss_spec.rb index 437fde956a249a..8ca4969e43b880 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/user_bulk_edits_issues_labels_spec.rb b/spec/features/issues/user_bulk_edits_issues_labels_spec.rb index 97353f940e8dd9..fd7c912ae4afc1 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 9a5f260e9e4e38..718fce806db953 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 d6d2b2a50f8953..8db23d02a9290a 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 5abd02fb580fcc..55bea0a2681544 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 593b43698a2cfd..3554445769fcfa 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_sorts_issues_spec.rb b/spec/features/issues/user_sorts_issues_spec.rb index 5c6198785d0a09..ee84e06157b417 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/labels_hierarchy_spec.rb b/spec/features/labels_hierarchy_spec.rb index 6f70c27127adf0..ef5a4be5914031 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/projects/labels/issues_sorted_by_priority_spec.rb b/spec/features/projects/labels/issues_sorted_by_priority_spec.rb index 4898bf253be8df..e1c537e1f78848 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 6ddc1aabc877b4..6d976fa79d80e2 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 -- GitLab From 7d5b6fd24a23e930ac1e0bfec0359156f2635397 Mon Sep 17 00:00:00 2001 From: Kassio Borges Date: Tue, 8 Apr 2025 14:56:28 +0200 Subject: [PATCH 5/8] Try to fix more tests --- .../issues/filtered_search/filter_issues_epic_spec.rb | 5 +++++ spec/features/abuse_report_spec.rb | 5 +++++ spec/features/callouts/registration_enabled_spec.rb | 4 ++++ spec/features/dashboard/issues_filter_spec.rb | 5 +++++ spec/features/ics/project_issues_spec.rb | 5 +++++ spec/features/incidents/incident_details_spec.rb | 5 +++++ spec/features/incidents/user_views_incident_spec.rb | 5 +++++ .../issues/filtered_search/dropdown_assignee_spec.rb | 7 +++++++ .../issues/filtered_search/dropdown_author_spec.rb | 5 +++++ spec/features/issues/filtered_search/dropdown_base_spec.rb | 5 +++++ .../features/issues/filtered_search/dropdown_emoji_spec.rb | 5 +++++ .../features/issues/filtered_search/dropdown_label_spec.rb | 5 +++++ .../issues/filtered_search/dropdown_milestone_spec.rb | 5 +++++ .../issues/filtered_search/recent_searches_spec.rb | 5 +++++ spec/features/issues/filtered_search/visual_tokens_spec.rb | 5 +++++ spec/features/issues/group_label_sidebar_spec.rb | 5 +++++ spec/features/issues/incident_issue_spec.rb | 7 +++++++ spec/features/issues/issue_detail_spec.rb | 7 +++++++ spec/features/issues/service_desk_spec.rb | 5 +++++ .../issues/user_resets_their_incoming_email_token_spec.rb | 5 +++++ spec/features/issues/user_sees_breadcrumb_links_spec.rb | 5 +++++ spec/features/issues/user_sees_empty_state_spec.rb | 7 +++++++ spec/features/issues/user_views_issues_spec.rb | 7 +++++++ .../merge_requests/user_sorts_merge_requests_spec.rb | 5 +++++ spec/features/milestones/user_views_milestone_spec.rb | 5 +++++ spec/features/monitor_sidebar_link_spec.rb | 5 +++++ spec/features/work_items/redirect_from_issues_spec.rb | 7 +++++++ spec/features/work_items/work_item_detail_spec.rb | 7 +++++++ spec/helpers/issuables_helper_spec.rb | 7 +++++++ spec/helpers/issues_helper_spec.rb | 7 +++++++ spec/helpers/projects/alert_management_helper_spec.rb | 7 +++++++ spec/helpers/projects/error_tracking_helper_spec.rb | 7 +++++++ spec/helpers/projects/incidents_helper_spec.rb | 5 +++++ spec/helpers/search_helper_spec.rb | 7 +++++++ spec/helpers/work_items_helper_spec.rb | 7 +++++++ spec/views/shared/milestones/_issuable.html.haml_spec.rb | 5 +++++ 36 files changed, 205 insertions(+) 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 3f0d0be9510cb1..73e2f71e405840 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/spec/features/abuse_report_spec.rb b/spec/features/abuse_report_spec.rb index 407a0507c95b35..40f299b5947c2c 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/callouts/registration_enabled_spec.rb b/spec/features/callouts/registration_enabled_spec.rb index 89bd91f8018e0e..d2dcc231a64663 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/dashboard/issues_filter_spec.rb b/spec/features/dashboard/issues_filter_spec.rb index 0ef946322b7826..3a9a0ea68e3666 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/ics/project_issues_spec.rb b/spec/features/ics/project_issues_spec.rb index 418958c01770aa..f4db341125bd1b 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 74c063e74dfbf3..ea7e230568f108 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 85761c393b0307..36764ef4338826 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/issues/filtered_search/dropdown_assignee_spec.rb b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb index 852a5d7bd365c7..7425886183a3b4 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 d1171ea9ec8578..227da0f2f1c03c 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 9108a966cd38f6..64bcd38ae50172 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 0ea4b7224d670a..b05135c5ae583b 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_label_spec.rb b/spec/features/issues/filtered_search/dropdown_label_spec.rb index 4a4be7efa3da83..195b270a922d9a 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 d7c18171ab69b2..e7c1833a8532b8 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/recent_searches_spec.rb b/spec/features/issues/filtered_search/recent_searches_spec.rb index 4b36e7f295e58e..18fddcde2ffc14 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/visual_tokens_spec.rb b/spec/features/issues/filtered_search/visual_tokens_spec.rb index d17bad8a1b0539..c47b63b2d6d952 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 41450ba33734dd..a52ab35f4a67d3 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 805d6b76742fd7..82e9e69589619a 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 ec1a0793e77c91..2dfe47cc2f99d3 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/service_desk_spec.rb b/spec/features/issues/service_desk_spec.rb index b7b5bf8621ce14..4368dce99eab3f 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_resets_their_incoming_email_token_spec.rb b/spec/features/issues/user_resets_their_incoming_email_token_spec.rb index df6443a32b4a4a..9e4e60b54ff7eb 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 69be94a392cbae..df77b7464f50eb 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 f51bafddf6901c..3a857e980f237e 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_views_issues_spec.rb b/spec/features/issues/user_views_issues_spec.rb index 83165c98437b34..f8dc5ca1c9b00e 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/merge_requests/user_sorts_merge_requests_spec.rb b/spec/features/merge_requests/user_sorts_merge_requests_spec.rb index 0d230519c85af6..e5a1673fe2ad7b 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 ddb0eaae4d1ad9..ab8a7c8654ef44 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 75e373a9dc4efc..2764a38b8a2dd6 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/work_items/redirect_from_issues_spec.rb b/spec/features/work_items/redirect_from_issues_spec.rb index bd77577fd9288a..2932c7c7e6497e 100644 --- a/spec/features/work_items/redirect_from_issues_spec.rb +++ b/spec/features/work_items/redirect_from_issues_spec.rb @@ -7,6 +7,13 @@ 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) diff --git a/spec/features/work_items/work_item_detail_spec.rb b/spec/features/work_items/work_item_detail_spec.rb index 62369acced5531..e6cd562dbea188 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 d22e7b13aafc66..1716242944aa33 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 8ac24a8d80d83b..588e33fe30dce6 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 d42aafbbf28cbb..f48e5d8500efe4 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 1ae595a5b10c7b..65475f4b7fa8a8 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 e69e10f1b4eb7b..275ac2b80b7f1d 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 9104fdd500ba61..7dc3e4166971fc 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 d99e42ce23e648..93f2ac7617314b 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/views/shared/milestones/_issuable.html.haml_spec.rb b/spec/views/shared/milestones/_issuable.html.haml_spec.rb index a8e2d88ec0da4f..9c228833e3258c 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 -- GitLab From 8235a4aba17dcdba5e55d91246455c9aa4d0dd35 Mon Sep 17 00:00:00 2001 From: Kassio Borges Date: Wed, 16 Apr 2025 17:27:13 +0200 Subject: [PATCH 6/8] Fix more tests --- ee/spec/features/work_items/okr_spec.rb | 5 +++++ spec/features/issuables/sorting_list_spec.rb | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/ee/spec/features/work_items/okr_spec.rb b/ee/spec/features/work_items/okr_spec.rb index 2a17c004010f80..4298d4f7fcb859 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/spec/features/issuables/sorting_list_spec.rb b/spec/features/issuables/sorting_list_spec.rb index 29c4581bcb214c..c53094a5abbf6c 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 -- GitLab From 5f5279ed726d457b311df95e1854be1734fa774c Mon Sep 17 00:00:00 2001 From: Kassio Borges Date: Wed, 23 Apr 2025 12:55:51 +0200 Subject: [PATCH 7/8] More test fixes --- ee/spec/features/issues/blocking_issues_spec.rb | 5 +++++ .../filter_issues_by_custom_fields_spec.rb | 5 +++++ .../filtered_search/filter_issues_by_health_spec.rb | 5 +++++ .../filtered_search/filter_issues_by_iteration_spec.rb | 7 +++++++ .../filter_issues_by_multiple_assignees_spec.rb | 5 +++++ .../filtered_search/filter_issues_weight_spec.rb | 5 +++++ ee/spec/features/issues/user_bulk_edits_issues_spec.rb | 7 +++++++ ee/spec/features/issues/user_sees_empty_state_spec.rb | 7 +++++++ ee/spec/features/learn_gitlab_spec.rb | 7 +++++++ spec/features/issue_rebalancing_spec.rb | 10 +++++----- 10 files changed, 58 insertions(+), 5 deletions(-) diff --git a/ee/spec/features/issues/blocking_issues_spec.rb b/ee/spec/features/issues/blocking_issues_spec.rb index 0dbd94ef156a08..0041500036cc34 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 8487a5a10cab42..fd215e54ffd1c0 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 3890239993bff4..5d933181f36076 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 b2bf9238349002..84a85b231d23d5 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 d2cbd59c34f0d5..5e5ed5358fd3c9 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_weight_spec.rb b/ee/spec/features/issues/filtered_search/filter_issues_weight_spec.rb index 55c8bf6ba86547..0747a83c13c34c 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 f22d253571b94e..4f33c4b716aa1b 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 a10a6f4e43d159..bcac9a8f265083 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/learn_gitlab_spec.rb b/ee/spec/features/learn_gitlab_spec.rb index c2d53a82ec6202..a7d72ee7131c85 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/spec/features/issue_rebalancing_spec.rb b/spec/features/issue_rebalancing_spec.rb index 1e101d35f61744..d39e1cf36971a2 100644 --- a/spec/features/issue_rebalancing_spec.rb +++ b/spec/features/issue_rebalancing_spec.rb @@ -10,11 +10,6 @@ let(:alert_message_regex) { /Issues are being rebalanced at the moment/ } before_all 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(:issue, project: project) group.add_developer(user) @@ -24,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 -- GitLab From fecfec4dcdbe8326e4ef0d7447f1a6cdbe96e9c6 Mon Sep 17 00:00:00 2001 From: Kassio Borges Date: Wed, 23 Apr 2025 16:17:36 +0200 Subject: [PATCH 8/8] More test fixes --- ee/spec/features/issues/user_views_issues_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ee/spec/features/issues/user_views_issues_spec.rb b/ee/spec/features/issues/user_views_issues_spec.rb index dc3c6eeef98af8..49655531053f84 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) -- GitLab