diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 18:25:58 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 18:25:58 +0000 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/features/groups/members/manage_groups_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) | |
download | gitlab-ce-a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4.tar.gz |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/features/groups/members/manage_groups_spec.rb')
-rw-r--r-- | spec/features/groups/members/manage_groups_spec.rb | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/spec/features/groups/members/manage_groups_spec.rb b/spec/features/groups/members/manage_groups_spec.rb index 40cd54c1e33..2dfcd941b4f 100644 --- a/spec/features/groups/members/manage_groups_spec.rb +++ b/spec/features/groups/members/manage_groups_spec.rb @@ -143,6 +143,82 @@ RSpec.describe 'Groups > Members > Manage groups', :js do end end + describe 'group search results' do + let_it_be(:group, refind: true) { create(:group) } + let_it_be(:group_within_hierarchy) { create(:group, parent: group) } + let_it_be(:group_outside_hierarchy) { create(:group) } + + before_all do + group.add_owner(user) + group_within_hierarchy.add_owner(user) + group_outside_hierarchy.add_owner(user) + end + + context 'when sharing with groups outside the hierarchy is enabled' do + context 'when the invite members group modal is disabled' do + before do + stub_feature_flags(invite_members_group_modal: false) + end + + it 'shows groups within and outside the hierarchy in search results' do + visit group_group_members_path(group) + + click_on 'Invite group' + click_on 'Search for a group' + + expect(page).to have_text group_within_hierarchy.name + expect(page).to have_text group_outside_hierarchy.name + end + end + + context 'when the invite members group modal is enabled' do + it 'shows groups within and outside the hierarchy in search results' do + visit group_group_members_path(group) + + click_on 'Invite a group' + click_on 'Select a group' + + expect(page).to have_text group_within_hierarchy.name + expect(page).to have_text group_outside_hierarchy.name + end + end + end + + context 'when sharing with groups outside the hierarchy is disabled' do + before do + group.namespace_settings.update!(prevent_sharing_groups_outside_hierarchy: true) + end + + context 'when the invite members group modal is disabled' do + before do + stub_feature_flags(invite_members_group_modal: false) + end + + it 'shows only groups within the hierarchy in search results' do + visit group_group_members_path(group) + + click_on 'Invite group' + click_on 'Search for a group' + + expect(page).to have_text group_within_hierarchy.name + expect(page).not_to have_text group_outside_hierarchy.name + end + end + + context 'when the invite members group modal is enabled' do + it 'shows only groups within the hierarchy in search results' do + visit group_group_members_path(group) + + click_on 'Invite a group' + click_on 'Select a group' + + expect(page).to have_text group_within_hierarchy.name + expect(page).not_to have_text group_outside_hierarchy.name + end + end + end + end + def add_group(id, role) page.click_link 'Invite group' page.within ".invite-group-form" do |