From d4b7a639ce889c23fb4088f79ae869bf1de419e0 Mon Sep 17 00:00:00 2001 From: Coung Ngo Date: Tue, 21 Oct 2025 19:31:44 +0200 Subject: [PATCH] Update issue feature specs to new issue look Now that the new issue look (based on the work items framework) is enabled by default, the feature specs should be updated accordingly --- spec/features/abuse_report_spec.rb | 8 ++- .../incidents/incident_details_spec.rb | 22 ++----- .../internal_references_spec.rb | 18 +++--- .../issues/workitem_participants_spec.rb | 57 +++++++------------ .../profiles/user_edit_profile_spec.rb | 20 ++----- .../projects/user_uses_shortcuts_spec.rb | 3 +- 6 files changed, 50 insertions(+), 78 deletions(-) diff --git a/spec/features/abuse_report_spec.rb b/spec/features/abuse_report_spec.rb index d4b2515fe2b8c7..390d99de83c0f6 100644 --- a/spec/features/abuse_report_spec.rb +++ b/spec/features/abuse_report_spec.rb @@ -16,6 +16,7 @@ # the work items listing page. stub_feature_flags(work_item_planning_view: false) stub_feature_flags(hide_incident_management_features: false) + stub_feature_flags(work_item_view_for_issues: true) sign_in(reporter1) end @@ -35,7 +36,7 @@ before do visit project_issue_path(project, issue) - click_button 'Issue actions' + click_button 'More actions', match: :first end it_behaves_like 'reports the user with an abuse category' @@ -129,7 +130,10 @@ before do visit project_issue_path(project, issue) - find('.more-actions-toggle button').click + + within('.note') do + click_button 'More actions' + end end it_behaves_like 'reports the user with an abuse category' diff --git a/spec/features/incidents/incident_details_spec.rb b/spec/features/incidents/incident_details_spec.rb index 8a000e00383489..5f9b658eaef360 100644 --- a/spec/features/incidents/incident_details_spec.rb +++ b/spec/features/incidents/incident_details_spec.rb @@ -47,6 +47,7 @@ # the work items listing page. stub_feature_flags(work_item_planning_view: false) stub_feature_flags(hide_incident_management_features: false) + stub_feature_flags(work_item_view_for_issues: true) sign_in(developer) end @@ -171,26 +172,15 @@ def current_status end end - it 'routes the user to the incident details page when the `issue_type` is set to incident' do + it 'routes the user to the incident details page when the issue is converted to an incident' do visit project_issue_path(project, issue) - wait_for_requests - - project_path = "/#{project.full_path}" - click_button 'Edit title and description' - wait_for_requests - within_testid('issuable-form') do - click_button 'Issue' - find_by_testid('issue-type-list-item', text: 'Incident').click - - click_button 'Save changes' - end - - wait_for_requests + fill_in 'Add a reply', with: '/promote_to_incident' + click_button 'Comment' expect(issue.reload.issue_type).to eq('incident') - expect(page).to have_current_path("#{project_path}/-/issues/incident/#{issue.iid}") - expect(page).to have_content(issue.title) + expect(page).to have_css('h1', text: issue.title) + expect(page).to have_testid('work-item-type-icon', text: 'Incident') end it 'routes the user to the issue details page when the `issue_type` is set to issue' do diff --git a/spec/features/issuables/markdown_references/internal_references_spec.rb b/spec/features/issuables/markdown_references/internal_references_spec.rb index c14cd7a13dc6e4..9336a6c1f608cf 100644 --- a/spec/features/issuables/markdown_references/internal_references_spec.rb +++ b/spec/features/issuables/markdown_references/internal_references_spec.rb @@ -14,6 +14,10 @@ let(:public_project_issue) { create(:issue, project: public_project) } let(:public_project_merge_request) { create(:merge_request, source_project: public_project) } + before do + stub_feature_flags(work_item_view_for_issues: true) + end + context "when referencing to open issue" do context "from private project" do context "from issue" do @@ -23,7 +27,8 @@ visit(project_issue_path(private_project, private_project_issue)) wait_for_requests - add_note("##{public_project_issue.to_reference(private_project)}") + fill_in('Add a reply', with: "##{public_project_issue.to_reference(private_project)}") + click_button 'Comment' end context "when user doesn't have access to private project" do @@ -68,11 +73,9 @@ end it "shows references", :sidekiq_might_not_need_inline do - expect(page).to have_text 'Related merge requests 1' - - page.within('.related-items-list') do - expect(page).to have_content(private_project_merge_request.title) - expect(page).to have_css(".issue-token-state-icon") + within_testid('work-item-development') do + expect(page).to have_text 'Development 1' + expect(page).to have_link(private_project_merge_request.title) end expect(page).to have_content("mentioned in merge request #{private_project_merge_request.to_reference(public_project)}") @@ -92,7 +95,8 @@ visit(project_issue_path(private_project, private_project_issue)) wait_for_requests - add_note("##{public_project_merge_request.to_reference(private_project)}") + fill_in('Add a reply', with: "##{public_project_merge_request.to_reference(private_project)}") + click_button 'Comment' end context "when user doesn't have access to private project" do diff --git a/spec/features/issues/workitem_participants_spec.rb b/spec/features/issues/workitem_participants_spec.rb index ab83957dfe4e0d..0c2386bcbea46b 100644 --- a/spec/features/issues/workitem_participants_spec.rb +++ b/spec/features/issues/workitem_participants_spec.rb @@ -9,53 +9,36 @@ let_it_be_with_refind(:issue) { create(:issue, project: project) } before do + stub_feature_flags(work_item_view_for_issues: true) sign_in(user) end - shared_examples 'shows participants in the sidebar' do |selector_participants_element:| - it 'shows the correct number of participants in the sidebar' do - visit project_issue_path(project, issue) - - wait_for_requests + it 'shows the correct number of participants in the sidebar' do + visit project_issue_path(project, issue) - within(selector_participants_element) do - expect(page).to have_content('1 Participant') - end - end - - context 'when the issue has more participants than the default max page size of the GraphQL API' do - let_it_be(:note_participants) do - create_list(:user, 2) { |user| create(:note_on_issue, project: project, noteable: issue, author: user) } - end - - before do - # On production, the default max page size is 100, - # but we want to test with a smaller size - # in order to avoid creating too many note participants. - allow(GitlabSchema).to receive(:default_max_page_size).and_return(2) - end - - it 'shows the correct number of participants in the sidebar' do - visit project_issue_path(project, issue) - - wait_for_requests - - within(selector_participants_element) do - expect(page).to have_content('3 Participants') - end - end + within_testid('work-item-participants') do + expect(page).to have_content('1 Participant') end end - it_behaves_like 'shows participants in the sidebar', - selector_participants_element: '.block.participants' + context 'when the issue has more participants than the default max page size of the GraphQL API' do + let_it_be(:note_participants) do + create_list(:user, 2) { |user| create(:note_on_issue, project: project, noteable: issue, author: user) } + end - context 'when work_item_view_for_issues is enabled' do before do - stub_feature_flags(work_item_view_for_issues: true) + # On production, the default max page size is 100, + # but we want to test with a smaller size + # in order to avoid creating too many note participants. + allow(GitlabSchema).to receive(:default_max_page_size).and_return(2) end - it_behaves_like 'shows participants in the sidebar', - selector_participants_element: '[data-testid="work-item-participants"]' + it 'shows the correct number of participants in the sidebar' do + visit project_issue_path(project, issue) + + within_testid('work-item-participants') do + expect(page).to have_content('3 Participants') + end + end end end diff --git a/spec/features/profiles/user_edit_profile_spec.rb b/spec/features/profiles/user_edit_profile_spec.rb index db0a4b79393719..c4a7b485406b40 100644 --- a/spec/features/profiles/user_edit_profile_spec.rb +++ b/spec/features/profiles/user_edit_profile_spec.rb @@ -4,11 +4,13 @@ RSpec.describe 'User edit profile', feature_category: :user_profile do include Features::NotesHelpers + include ListboxHelpers let_it_be_with_reload(:user) { create(:user) } before do stub_feature_flags(edit_user_profile_vue: false) + stub_feature_flags(work_item_view_for_issues: true) sign_in(user) visit(user_settings_profile_path) end @@ -298,25 +300,13 @@ def select_emoji(emoji_name) end it 'shows author as busy in the assignee dropdown' do - page.within('.assignee') do + within_testid('work-item-assignees') do click_button('Edit') - wait_for_requests - end + select_listbox_item("#{user.name} Busy") - page.within '.dropdown-menu-user' do - expect(page).to have_content("#{user.name} Busy") + expect(page).to have_link(user.name) end end - - it 'displays the assignee busy status' do - click_button 'assign yourself' - wait_for_requests - - visit project_issue_path(project, issue) - wait_for_requests - - expect(page.find('.issuable-assignees')).to have_content("#{user.name} Busy") - end end end diff --git a/spec/features/projects/user_uses_shortcuts_spec.rb b/spec/features/projects/user_uses_shortcuts_spec.rb index 021bc453acb206..7c076c01590f26 100644 --- a/spec/features/projects/user_uses_shortcuts_spec.rb +++ b/spec/features/projects/user_uses_shortcuts_spec.rb @@ -7,6 +7,7 @@ let_it_be(:project) { create(:project, :repository, namespace: user.namespace) } before do + stub_feature_flags(work_item_view_for_issues: true) sign_in(user) visit(project_path(project)) @@ -100,7 +101,7 @@ find('body').native.send_key('i') expect(page).to have_content(project.title) - expect(page).to have_content('New Issue') + expect(page).to have_css('h1', text: 'New issue') end end -- GitLab