diff options
Diffstat (limited to 'spec/features/groups/show_spec.rb')
-rw-r--r-- | spec/features/groups/show_spec.rb | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/spec/features/groups/show_spec.rb b/spec/features/groups/show_spec.rb index 9a1e216c6d2..d814906a274 100644 --- a/spec/features/groups/show_spec.rb +++ b/spec/features/groups/show_spec.rb @@ -84,7 +84,7 @@ RSpec.describe 'Group show page' do it 'shows `Create new subgroup` link' do expect(page).to have_link( s_('GroupsEmptyState|Create new subgroup'), - href: new_group_path(parent_id: group.id) + href: new_group_path(parent_id: group.id, anchor: 'create-group-pane') ) end @@ -97,28 +97,43 @@ RSpec.describe 'Group show page' do end end - context 'when a public project is shared with a private group' do - let_it_be(:private_group) { create(:group, :private) } + context 'visibility warning popover' do let_it_be(:public_project) { create(:project, :public) } - let_it_be(:project_group_link) { create(:project_group_link, group: private_group, project: public_project) } - before do - private_group.add_owner(user) - sign_in(user) - end + shared_examples 'it shows warning popover' do + it 'shows warning popover', :js do + group_to_share_with.add_owner(user) + sign_in(user) + visit group_path(group_to_share_with) + + click_link _('Shared projects') + + wait_for_requests - it 'shows warning popover', :js do - visit group_path(private_group) + page.within("[data-testid=\"group-overview-item-#{public_project.id}\"]") do + click_button _('Less restrictive visibility') + end + + expect(page).to have_content _('Project visibility level is less restrictive than the group settings.') + end + end - click_link _('Shared projects') + context 'when a public project is shared with a private group' do + let_it_be(:group_to_share_with) { create(:group, :private) } + let_it_be(:project_group_link) do + create(:project_group_link, group: group_to_share_with, project: public_project) + end - wait_for_requests + include_examples 'it shows warning popover' + end - page.within("[data-testid=\"group-overview-item-#{public_project.id}\"]") do - click_button _('Less restrictive visibility') + context 'when a public project is shared with an internal group' do + let_it_be(:group_to_share_with) { create(:group, :internal) } + let_it_be(:project_group_link) do + create(:project_group_link, group: group_to_share_with, project: public_project) end - expect(page).to have_content _('Project visibility level is less restrictive than the group settings.') + include_examples 'it shows warning popover' end end |