diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-21 15:09:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-21 15:09:17 +0300 |
commit | 0c4570435d417b69efd433057f95f01810618837 (patch) | |
tree | 4e402832206b83da2d73671977c1e5f7cae9074a /spec/features | |
parent | 49abdb108a4d3c3f2ef9b27c7c4dcde43da1016a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
20 files changed, 218 insertions, 142 deletions
diff --git a/spec/features/groups/milestones/gfm_autocomplete_spec.rb b/spec/features/groups/milestones/gfm_autocomplete_spec.rb index 8df097dde88..9245323d1f7 100644 --- a/spec/features/groups/milestones/gfm_autocomplete_spec.rb +++ b/spec/features/groups/milestones/gfm_autocomplete_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'GFM autocomplete', :js, feature_category: :team_planning do + include Features::AutocompleteHelpers + let_it_be(:user) { create(:user, name: '💃speciąl someone💃', username: 'someone.special') } let_it_be(:group) { create(:group, name: 'Ancestor') } let_it_be(:project) { create(:project, :repository, group: group) } @@ -69,10 +71,6 @@ RSpec.describe 'GFM autocomplete', :js, feature_category: :team_planning do private - def find_autocomplete_menu - find('.atwho-view ul', visible: true) - end - def expect_autocomplete_entry(entry) page.within('.atwho-container') do expect(page).to have_content(entry) diff --git a/spec/features/groups/participants_autocomplete_spec.rb b/spec/features/groups/participants_autocomplete_spec.rb new file mode 100644 index 00000000000..a94f95c3ced --- /dev/null +++ b/spec/features/groups/participants_autocomplete_spec.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Group member autocomplete', :js, feature_category: :groups_and_projects do + include Features::AutocompleteHelpers + + let_it_be(:group) { create(:group) } + let_it_be(:user) { create(:user) } + + before_all do + group.add_developer user + end + + before do + sign_in(user) + end + + context 'when editing description of a group milestone' do + let_it_be(:noteable) { create(:milestone, group: group) } + + it 'suggests group members' do + visit edit_group_milestone_path(group, noteable) + + fill_in 'Description', with: '@' + + expect(find_autocomplete_menu).to have_text(user.username) + end + + context 'for a member of a private group invited to the group' do + let_it_be(:private_group) { create(:group, :private) } + let_it_be(:private_group_member) { create(:user, username: 'private-a') } + + before_all do + private_group.add_developer private_group_member + + create(:group_group_link, shared_group: group, shared_with_group: private_group) + end + + it 'suggests member of private group as well' do + visit edit_group_milestone_path(group, noteable) + + fill_in 'Description', with: '@' + + expect(find_autocomplete_menu).to have_text(private_group_member.username) + expect(find_autocomplete_menu).to have_text(user.username) + end + end + end +end diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index 665c7307231..a1f2275df6e 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe 'GFM autocomplete', :js, feature_category: :team_planning do include CookieHelper + include Features::AutocompleteHelpers let_it_be(:user) { create(:user, name: '💃speciąl someone💃', username: 'someone.special') } let_it_be(:user2) { create(:user, name: 'Marge Simpson', username: 'msimpson') } @@ -453,12 +454,4 @@ RSpec.describe 'GFM autocomplete', :js, feature_category: :team_planning do wait_for_requests end - - def find_autocomplete_menu - find('.atwho-view ul', visible: true) - end - - def find_highlighted_autocomplete_item - find('.atwho-view li.cur', visible: true) - end end diff --git a/spec/features/issues/user_comments_on_issue_spec.rb b/spec/features/issues/user_comments_on_issue_spec.rb index 3ace560fb40..d954a1d15ff 100644 --- a/spec/features/issues/user_comments_on_issue_spec.rb +++ b/spec/features/issues/user_comments_on_issue_spec.rb @@ -3,6 +3,7 @@ require "spec_helper" RSpec.describe "User comments on issue", :js, feature_category: :team_planning do + include Features::AutocompleteHelpers include Features::NotesHelpers let_it_be(:project) { create(:project, :public) } @@ -92,10 +93,4 @@ RSpec.describe "User comments on issue", :js, feature_category: :team_planning d end end end - - private - - def find_highlighted_autocomplete_item - find('.atwho-view li.cur', visible: true) - end end diff --git a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb index 5da9f4a1f19..4bdef20304a 100644 --- a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb +++ b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb @@ -10,9 +10,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js, feat let!(:note) { create(:diff_note_on_merge_request, project: project, noteable: merge_request, note: "| Markdown | Table |\n|-------|---------|\n| first | second |") } let(:path) { "files/ruby/popen.rb" } let(:position) do - build(:text_diff_position, - file: path, old_line: nil, new_line: 9, - diff_refs: merge_request.diff_refs) + build(:text_diff_position, file: path, old_line: nil, new_line: 9, diff_refs: merge_request.diff_refs) end before do diff --git a/spec/features/merge_request/user_resolves_outdated_diff_discussions_spec.rb b/spec/features/merge_request/user_resolves_outdated_diff_discussions_spec.rb index 5c41ac79552..cb57f1fd549 100644 --- a/spec/features/merge_request/user_resolves_outdated_diff_discussions_spec.rb +++ b/spec/features/merge_request/user_resolves_outdated_diff_discussions_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Merge request > User resolves outdated diff discussions', - :js, feature_category: :code_review_workflow do + :js, feature_category: :code_review_workflow do let(:project) { create(:project, :repository, :public) } let(:merge_request) do @@ -30,17 +30,21 @@ RSpec.describe 'Merge request > User resolves outdated diff discussions', end let!(:outdated_discussion) do - create(:diff_note_on_merge_request, - project: project, - noteable: merge_request, - position: outdated_position).to_discussion + create( + :diff_note_on_merge_request, + project: project, + noteable: merge_request, + position: outdated_position + ).to_discussion end let!(:current_discussion) do - create(:diff_note_on_merge_request, - noteable: merge_request, - project: project, - position: current_position).to_discussion + create( + :diff_note_on_merge_request, + noteable: merge_request, + project: project, + position: current_position + ).to_discussion end before do diff --git a/spec/features/merge_request/user_resolves_wip_mr_spec.rb b/spec/features/merge_request/user_resolves_wip_mr_spec.rb index 01cc6bd5167..15a7755429b 100644 --- a/spec/features/merge_request/user_resolves_wip_mr_spec.rb +++ b/spec/features/merge_request/user_resolves_wip_mr_spec.rb @@ -6,17 +6,23 @@ RSpec.describe 'Merge request > User resolves Draft', :js, feature_category: :co let(:project) { create(:project, :public, :repository) } let(:user) { project.creator } let(:merge_request) do - create(:merge_request_with_diffs, source_project: project, - author: user, - title: 'Draft: Bug NS-04', - merge_params: { force_remove_source_branch: '1' }) + create( + :merge_request_with_diffs, + source_project: project, + author: user, + title: 'Draft: Bug NS-04', + merge_params: { force_remove_source_branch: '1' } + ) end let(:pipeline) do - create(:ci_pipeline, project: project, - sha: merge_request.diff_head_sha, - ref: merge_request.source_branch, - head_pipeline_of: merge_request) + create( + :ci_pipeline, + project: project, + sha: merge_request.diff_head_sha, + ref: merge_request.source_branch, + head_pipeline_of: merge_request + ) end before do diff --git a/spec/features/merge_request/user_sees_deployment_widget_spec.rb b/spec/features/merge_request/user_sees_deployment_widget_spec.rb index 6dcebad300c..44660b247a1 100644 --- a/spec/features/merge_request/user_sees_deployment_widget_spec.rb +++ b/spec/features/merge_request/user_sees_deployment_widget_spec.rb @@ -115,8 +115,7 @@ RSpec.describe 'Merge request > User sees deployment widget', :js, feature_categ context 'with stop action' do let(:manual) do - create(:ci_build, :manual, pipeline: pipeline, - name: 'close_app', environment: environment.name) + create(:ci_build, :manual, pipeline: pipeline, name: 'close_app', environment: environment.name) end before do @@ -146,8 +145,7 @@ RSpec.describe 'Merge request > User sees deployment widget', :js, feature_categ context 'with stop action with the review_apps_redeploy_mr_widget feature flag turned on' do let(:manual) do - create(:ci_build, :manual, pipeline: pipeline, - name: 'close_app', environment: environment.name) + create(:ci_build, :manual, pipeline: pipeline, name: 'close_app', environment: environment.name) end before do diff --git a/spec/features/merge_request/user_sees_discussions_navigation_spec.rb b/spec/features/merge_request/user_sees_discussions_navigation_spec.rb index 338e4329190..4cce40972e9 100644 --- a/spec/features/merge_request/user_sees_discussions_navigation_spec.rb +++ b/spec/features/merge_request/user_sees_discussions_navigation_spec.rb @@ -13,27 +13,30 @@ RSpec.describe 'Merge request > User sees discussions navigation', :js, feature_ describe 'Code discussions' do let!(:position) do - build(:text_diff_position, :added, - file: "files/images/wm.svg", - new_line: 1, - diff_refs: merge_request.diff_refs + build( + :text_diff_position, :added, + file: "files/images/wm.svg", + new_line: 1, + diff_refs: merge_request.diff_refs ) end let!(:first_discussion) do - create(:diff_note_on_merge_request, - noteable: merge_request, - project: project, - position: position - ).to_discussion + create( + :diff_note_on_merge_request, + noteable: merge_request, + project: project, + position: position + ).to_discussion end let!(:second_discussion) do - create(:diff_note_on_merge_request, - noteable: merge_request, - project: project, - position: position - ).to_discussion + create( + :diff_note_on_merge_request, + noteable: merge_request, + project: project, + position: position + ).to_discussion end let(:first_discussion_selector) { ".discussion[data-discussion-id='#{first_discussion.id}']" } @@ -74,11 +77,12 @@ RSpec.describe 'Merge request > User sees discussions navigation', :js, feature_ context 'with resolved threads' do let!(:resolved_discussion) do - create(:diff_note_on_merge_request, - noteable: merge_request, - project: project, - position: position - ).to_discussion + create( + :diff_note_on_merge_request, + noteable: merge_request, + project: project, + position: position + ).to_discussion end let(:resolved_discussion_selector) { ".discussion[data-discussion-id='#{resolved_discussion.id}']" } @@ -92,7 +96,7 @@ RSpec.describe 'Merge request > User sees discussions navigation', :js, feature_ end it 'excludes resolved threads during navigation', - quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/383687' do + quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/383687' do goto_next_thread goto_next_thread goto_next_thread diff --git a/spec/features/merge_request/user_sees_merge_button_depending_on_unresolved_discussions_spec.rb b/spec/features/merge_request/user_sees_merge_button_depending_on_unresolved_discussions_spec.rb index 476be5ab599..9955c13b769 100644 --- a/spec/features/merge_request/user_sees_merge_button_depending_on_unresolved_discussions_spec.rb +++ b/spec/features/merge_request/user_sees_merge_button_depending_on_unresolved_discussions_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Merge request > User sees merge button depending on unresolved threads', :js, -feature_category: :code_review_workflow do + feature_category: :code_review_workflow do let(:project) { create(:project, :repository) } let(:user) { project.creator } let!(:merge_request) { create(:merge_request_with_diff_notes, source_project: project, author: user) } diff --git a/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb b/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb index ca12e0e2b65..fba25b41b83 100644 --- a/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb +++ b/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb @@ -36,11 +36,13 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request', context 'when a user created a merge request in the parent project' do let!(:merge_request) do - create(:merge_request, - source_project: project, - target_project: project, - source_branch: 'feature', - target_branch: 'master') + create( + :merge_request, + source_project: project, + target_project: project, + source_branch: 'feature', + target_branch: 'master' + ) end let!(:push_pipeline) do @@ -263,11 +265,13 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request', context 'when a user created a merge request from a forked project to the parent project', :sidekiq_might_not_need_inline do let(:merge_request) do - create(:merge_request, - source_project: forked_project, - target_project: project, - source_branch: 'feature', - target_branch: 'master') + create( + :merge_request, + source_project: forked_project, + target_project: project, + source_branch: 'feature', + target_branch: 'master' + ) end let!(:push_pipeline) do diff --git a/spec/features/merge_request/user_sees_merge_widget_spec.rb b/spec/features/merge_request/user_sees_merge_widget_spec.rb index cb56e79fcc0..33694c056a0 100644 --- a/spec/features/merge_request/user_sees_merge_widget_spec.rb +++ b/spec/features/merge_request/user_sees_merge_widget_spec.rb @@ -118,12 +118,15 @@ RSpec.describe 'Merge request > User sees merge widget', :js, feature_category: context 'view merge request with failed GitLab CI pipelines' do before do commit_status = create(:commit_status, project: project, status: 'failed') - pipeline = create(:ci_pipeline, project: project, - sha: merge_request.diff_head_sha, - ref: merge_request.source_branch, - status: 'failed', - statuses: [commit_status], - head_pipeline_of: merge_request) + pipeline = create( + :ci_pipeline, + project: project, + sha: merge_request.diff_head_sha, + ref: merge_request.source_branch, + status: 'failed', + statuses: [commit_status], + head_pipeline_of: merge_request + ) create(:ci_build, :pending, pipeline: pipeline) visit project_merge_request_path(project, merge_request) @@ -278,12 +281,15 @@ RSpec.describe 'Merge request > User sees merge widget', :js, feature_category: context 'view merge request with MWBS button' do before do commit_status = create(:commit_status, project: project, status: 'pending') - pipeline = create(:ci_pipeline, project: project, - sha: merge_request.diff_head_sha, - ref: merge_request.source_branch, - status: 'pending', - statuses: [commit_status], - head_pipeline_of: merge_request) + pipeline = create( + :ci_pipeline, + project: project, + sha: merge_request.diff_head_sha, + ref: merge_request.source_branch, + status: 'pending', + statuses: [commit_status], + head_pipeline_of: merge_request + ) create(:ci_build, :pending, pipeline: pipeline) visit project_merge_request_path(project, merge_request) @@ -298,9 +304,12 @@ RSpec.describe 'Merge request > User sees merge widget', :js, feature_category: context 'view merge request where there is no pipeline yet' do before do - pipeline = create(:ci_pipeline, project: project, - sha: merge_request.diff_head_sha, - ref: merge_request.source_branch) + pipeline = create( + :ci_pipeline, + project: project, + sha: merge_request.diff_head_sha, + ref: merge_request.source_branch + ) create(:ci_build, pipeline: pipeline) visit project_merge_request_path(project, merge_request) @@ -510,11 +519,13 @@ RSpec.describe 'Merge request > User sees merge widget', :js, feature_category: context 'when merge request has test reports' do let!(:head_pipeline) do - create(:ci_pipeline, - :success, - project: project, - ref: merge_request.source_branch, - sha: merge_request.diff_head_sha) + create( + :ci_pipeline, + :success, + project: project, + ref: merge_request.source_branch, + sha: merge_request.diff_head_sha + ) end let!(:build) { create(:ci_build, :success, pipeline: head_pipeline, project: project) } diff --git a/spec/features/merge_request/user_sees_mr_from_deleted_forked_project_spec.rb b/spec/features/merge_request/user_sees_mr_from_deleted_forked_project_spec.rb index fac0a84f155..7b8ac50f1ae 100644 --- a/spec/features/merge_request/user_sees_mr_from_deleted_forked_project_spec.rb +++ b/spec/features/merge_request/user_sees_mr_from_deleted_forked_project_spec.rb @@ -3,16 +3,19 @@ require 'spec_helper' RSpec.describe 'Merge request > User sees MR from deleted forked project', - :js, feature_category: :code_review_workflow do + :js, feature_category: :code_review_workflow do include ProjectForksHelper let(:project) { create(:project, :public, :repository) } let(:user) { project.creator } let(:forked_project) { fork_project(project, nil, repository: true) } let!(:merge_request) do - create(:merge_request_with_diffs, source_project: forked_project, - target_project: project, - description: 'Test merge request') + create( + :merge_request_with_diffs, + source_project: forked_project, + target_project: project, + description: 'Test merge request' + ) end before do diff --git a/spec/features/merge_request/user_sees_mr_with_deleted_source_branch_spec.rb b/spec/features/merge_request/user_sees_mr_with_deleted_source_branch_spec.rb index 9b46cf37648..29a76768774 100644 --- a/spec/features/merge_request/user_sees_mr_with_deleted_source_branch_spec.rb +++ b/spec/features/merge_request/user_sees_mr_with_deleted_source_branch_spec.rb @@ -6,7 +6,7 @@ require 'spec_helper' # message to be shown by JavaScript when the source branch was deleted. # Please do not remove ":js". RSpec.describe 'Merge request > User sees MR with deleted source branch', - :js, feature_category: :code_review_workflow do + :js, feature_category: :code_review_workflow do let(:project) { create(:project, :public, :repository) } let(:merge_request) { create(:merge_request, source_project: project) } let(:user) { project.creator } diff --git a/spec/features/merge_request/user_sees_notes_from_forked_project_spec.rb b/spec/features/merge_request/user_sees_notes_from_forked_project_spec.rb index ac195dd9873..92bedc47718 100644 --- a/spec/features/merge_request/user_sees_notes_from_forked_project_spec.rb +++ b/spec/features/merge_request/user_sees_notes_from_forked_project_spec.rb @@ -9,15 +9,21 @@ RSpec.describe 'Merge request > User sees notes from forked project', :js, featu let(:user) { project.creator } let(:forked_project) { fork_project(project, nil, repository: true) } let!(:merge_request) do - create(:merge_request_with_diffs, source_project: forked_project, - target_project: project, - description: 'Test merge request') + create( + :merge_request_with_diffs, + source_project: forked_project, + target_project: project, + description: 'Test merge request' + ) end before do - create(:note_on_commit, note: 'A commit comment', - project: forked_project, - commit_id: merge_request.commit_shas.first) + create( + :note_on_commit, + note: 'A commit comment', + project: forked_project, + commit_id: merge_request.commit_shas.first + ) sign_in(user) end diff --git a/spec/features/merge_request/user_sees_pipelines_from_forked_project_spec.rb b/spec/features/merge_request/user_sees_pipelines_from_forked_project_spec.rb index 0816b14f9a5..5801e8a1a11 100644 --- a/spec/features/merge_request/user_sees_pipelines_from_forked_project_spec.rb +++ b/spec/features/merge_request/user_sees_pipelines_from_forked_project_spec.rb @@ -3,23 +3,28 @@ require 'spec_helper' RSpec.describe 'Merge request > User sees pipelines from forked project', :js, -feature_category: :continuous_integration do + feature_category: :continuous_integration do include ProjectForksHelper let(:target_project) { create(:project, :public, :repository) } let(:user) { target_project.creator } let(:forked_project) { fork_project(target_project, nil, repository: true) } let!(:merge_request) do - create(:merge_request_with_diffs, source_project: forked_project, - target_project: target_project, - description: 'Test merge request') + create( + :merge_request_with_diffs, + source_project: forked_project, + target_project: target_project, + description: 'Test merge request' + ) end let(:pipeline) do - create(:ci_pipeline, - project: forked_project, - sha: merge_request.diff_head_sha, - ref: merge_request.source_branch) + create( + :ci_pipeline, + project: forked_project, + sha: merge_request.diff_head_sha, + ref: merge_request.source_branch + ) end before do diff --git a/spec/features/merge_request/user_sees_pipelines_spec.rb b/spec/features/merge_request/user_sees_pipelines_spec.rb index faa46ff4df1..88c718fac13 100644 --- a/spec/features/merge_request/user_sees_pipelines_spec.rb +++ b/spec/features/merge_request/user_sees_pipelines_spec.rb @@ -15,11 +15,13 @@ RSpec.describe 'Merge request > User sees pipelines', :js, feature_category: :co context 'with pipelines' do let!(:pipeline) do - create(:ci_pipeline, - :success, - project: merge_request.source_project, - ref: merge_request.source_branch, - sha: merge_request.diff_head_sha) + create( + :ci_pipeline, + :success, + project: merge_request.source_project, + ref: merge_request.source_branch, + sha: merge_request.diff_head_sha + ) end let!(:manual_job) { create(:ci_build, :manual, name: 'job1', stage: 'deploy', pipeline: pipeline) } @@ -116,9 +118,14 @@ RSpec.describe 'Merge request > User sees pipelines', :js, feature_category: :co let_it_be(:reporter_in_parent_and_developer_in_fork) { create(:user) } let(:merge_request) do - create(:merge_request, :with_detached_merge_request_pipeline, - source_project: forked_project, source_branch: 'feature', - target_project: parent_project, target_branch: 'master') + create( + :merge_request, + :with_detached_merge_request_pipeline, + source_project: forked_project, + source_branch: 'feature', + target_project: parent_project, + target_branch: 'master' + ) end let(:config) do diff --git a/spec/features/merge_request/user_sees_versions_spec.rb b/spec/features/merge_request/user_sees_versions_spec.rb index 91f8fd13681..715cc2f73be 100644 --- a/spec/features/merge_request/user_sees_versions_spec.rb +++ b/spec/features/merge_request/user_sees_versions_spec.rb @@ -57,9 +57,9 @@ RSpec.describe 'Merge request > User sees versions', :js, feature_category: :cod end it_behaves_like 'allows commenting', - file_name: '.gitmodules', - line_text: '[submodule "six"]', - comment: 'Typo, please fix.' + file_name: '.gitmodules', + line_text: '[submodule "six"]', + comment: 'Typo, please fix.' end describe 'switch between versions' do @@ -105,9 +105,9 @@ RSpec.describe 'Merge request > User sees versions', :js, feature_category: :cod end it_behaves_like 'allows commenting', - file_name: '.gitmodules', - line_text: 'path = six', - comment: 'Typo, please fix.' + file_name: '.gitmodules', + line_text: 'path = six', + comment: 'Typo, please fix.' end describe 'compare with older version' do @@ -172,9 +172,9 @@ RSpec.describe 'Merge request > User sees versions', :js, feature_category: :cod end it_behaves_like 'allows commenting', - file_name: '.gitmodules', - line_text: '[submodule "gitlab-shell"]', - comment: 'Typo, please fix.' + file_name: '.gitmodules', + line_text: '[submodule "gitlab-shell"]', + comment: 'Typo, please fix.' end describe 'compare with same version' do @@ -239,8 +239,8 @@ RSpec.describe 'Merge request > User sees versions', :js, feature_category: :cod end it_behaves_like 'allows commenting', - file_name: 'files/ruby/popen.rb', - line_text: 'RuntimeError', - comment: 'Typo, please fix.' + file_name: 'files/ruby/popen.rb', + line_text: 'RuntimeError', + comment: 'Typo, please fix.' end end diff --git a/spec/features/participants_autocomplete_spec.rb b/spec/features/participants_autocomplete_spec.rb index 084bf609a0d..d8501116134 100644 --- a/spec/features/participants_autocomplete_spec.rb +++ b/spec/features/participants_autocomplete_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'Member autocomplete', :js, feature_category: :groups_and_projects do + include Features::AutocompleteHelpers + let_it_be(:project) { create(:project, :public, :repository) } let_it_be(:user) { create(:user) } let_it_be(:author) { create(:user) } @@ -85,10 +87,4 @@ RSpec.describe 'Member autocomplete', :js, feature_category: :groups_and_project include_examples "open suggestions when typing @", 'commit' end - - private - - def find_autocomplete_menu - find('.atwho-view ul', visible: true) - end end diff --git a/spec/features/projects/milestones/gfm_autocomplete_spec.rb b/spec/features/projects/milestones/gfm_autocomplete_spec.rb index d4ce10b5cb5..0705cdd0d9e 100644 --- a/spec/features/projects/milestones/gfm_autocomplete_spec.rb +++ b/spec/features/projects/milestones/gfm_autocomplete_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'GFM autocomplete', :js, feature_category: :team_planning do + include Features::AutocompleteHelpers + let_it_be(:user) { create(:user, name: '💃speciąl someone💃', username: 'someone.special') } let_it_be(:group) { create(:group, name: 'Ancestor') } let_it_be(:project) { create(:project, :repository, group: group) } @@ -68,10 +70,6 @@ RSpec.describe 'GFM autocomplete', :js, feature_category: :team_planning do private - def find_autocomplete_menu - find('.atwho-view ul', visible: true) - end - def expect_autocomplete_entry(entry) page.within('.atwho-container') do expect(page).to have_content(entry) |