diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/features/groups/show_spec.rb | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/features/groups/show_spec.rb')
-rw-r--r-- | spec/features/groups/show_spec.rb | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/spec/features/groups/show_spec.rb b/spec/features/groups/show_spec.rb index eb62b6fa8ee..fa8db1befb5 100644 --- a/spec/features/groups/show_spec.rb +++ b/spec/features/groups/show_spec.rb @@ -72,6 +72,58 @@ RSpec.describe 'Group show page' do end end end + + context 'subgroups and projects empty state', :js do + context 'when user has permissions to create new subgroups or projects' do + before do + group.add_owner(user) + sign_in(user) + visit path + end + + 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) + ) + end + + it 'shows `Create new project` link' do + expect(page).to have_link( + s_('GroupsEmptyState|Create new project'), + href: new_project_path(namespace_id: group.id) + ) + end + end + end + + context 'when user does not have permissions to create new subgroups or projects', :js do + before do + group.add_reporter(user) + sign_in(user) + visit path + end + + it 'does not show `Create new subgroup` link' do + expect(page).not_to have_link( + s_('GroupsEmptyState|Create new subgroup'), + href: new_group_path(parent_id: group.id) + ) + end + + it 'does not show `Create new project` link' do + expect(page).not_to have_link( + s_('GroupsEmptyState|Create new project'), + href: new_project_path(namespace_id: group.id) + ) + end + + it 'shows empty state' do + expect(page).to have_content(s_('GroupsEmptyState|No subgroups or projects.')) + expect(page).to have_content(s_('GroupsEmptyState|You do not have necessary permissions to create a subgroup' \ + ' or project in this group. Please contact an owner of this group to create a new subgroup or project.')) + end + end end context 'when signed out' do |