diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/features/groups/members | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/features/groups/members')
-rw-r--r-- | spec/features/groups/members/manage_groups_spec.rb | 138 |
1 files changed, 4 insertions, 134 deletions
diff --git a/spec/features/groups/members/manage_groups_spec.rb b/spec/features/groups/members/manage_groups_spec.rb index 5a9223d9ee8..e4252e2f3aa 100644 --- a/spec/features/groups/members/manage_groups_spec.rb +++ b/spec/features/groups/members/manage_groups_spec.rb @@ -119,141 +119,11 @@ RSpec.describe 'Groups > Members > Manage groups', :js do describe 'group search results' do let_it_be(:group, refind: true) { create(:group) } - context 'with instance admin considerations' do - let_it_be(:group_to_share) { create(:group) } - - context 'when user is an admin' do - let_it_be(:admin) { create(:admin) } - - before do - sign_in(admin) - gitlab_enable_admin_mode_sign_in(admin) - end - - it 'shows groups where the admin has no direct membership' do - visit group_group_members_path(group) - - click_on 'Invite a group' - click_on 'Select a group' - wait_for_requests - - page.within(group_dropdown_selector) do - expect_to_have_group(group_to_share) - expect_not_to_have_group(group) - end - end - - it 'shows groups where the admin has at least guest level membership' do - group_to_share.add_guest(admin) - - visit group_group_members_path(group) - - click_on 'Invite a group' - click_on 'Select a group' - wait_for_requests - - page.within(group_dropdown_selector) do - expect_to_have_group(group_to_share) - expect_not_to_have_group(group) - end - end - end - - context 'when user is not an admin' do - before do - group.add_owner(user) - end - - it 'shows groups where the user has no direct membership' do - visit group_group_members_path(group) - - click_on 'Invite a group' - click_on 'Select a group' - wait_for_requests - - page.within(group_dropdown_selector) do - expect_not_to_have_group(group_to_share) - expect_not_to_have_group(group) - end - end - - it 'shows groups where the user has at least guest level membership' do - group_to_share.add_guest(user) - - visit group_group_members_path(group) - - click_on 'Invite a group' - click_on 'Select a group' - wait_for_requests - - page.within(group_dropdown_selector) do - expect_to_have_group(group_to_share) - expect_not_to_have_group(group) - end - end - end - end - - context 'when user is not an admin and there are hierarchy considerations' do + it_behaves_like 'inviting groups search results' do + let_it_be(:entity) { 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 - - it 'does not show self or ancestors', :aggregate_failures do - group_sibbling = create(:group, parent: group) - group_sibbling.add_owner(user) - - visit group_group_members_path(group_within_hierarchy) - - click_on 'Invite a group' - click_on 'Select a group' - wait_for_requests - - page.within(group_dropdown_selector) do - expect_to_have_group(group_outside_hierarchy) - expect_to_have_group(group_sibbling) - expect_not_to_have_group(group) - expect_not_to_have_group(group_within_hierarchy) - end - end - - context 'when sharing with groups outside the hierarchy 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' - wait_for_requests - - page.within(group_dropdown_selector) do - expect_to_have_group(group_within_hierarchy) - expect_to_have_group(group_outside_hierarchy) - 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 - - 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' - - page.within(group_dropdown_selector) do - expect_to_have_group(group_within_hierarchy) - expect_not_to_have_group(group_outside_hierarchy) - end - end - end + let_it_be(:members_page_path) { group_group_members_path(entity) } + let_it_be(:members_page_path_within_hierarchy) { group_group_members_path(group_within_hierarchy) } end end end |