diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/features/groups | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/features/groups')
-rw-r--r-- | spec/features/groups/import_export/export_file_spec.rb | 59 | ||||
-rw-r--r-- | spec/features/groups/issues_spec.rb | 23 | ||||
-rw-r--r-- | spec/features/groups/members/leave_group_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/groups/members/manage_groups_spec.rb | 85 | ||||
-rw-r--r-- | spec/features/groups/members/master_adds_member_with_expiration_date_spec.rb | 68 | ||||
-rw-r--r-- | spec/features/groups/navbar_spec.rb | 52 |
6 files changed, 234 insertions, 55 deletions
diff --git a/spec/features/groups/import_export/export_file_spec.rb b/spec/features/groups/import_export/export_file_spec.rb new file mode 100644 index 00000000000..5829e659722 --- /dev/null +++ b/spec/features/groups/import_export/export_file_spec.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'Group Export', :js do + include ExportFileHelper + + let_it_be(:user) { create(:user) } + let_it_be(:group) { create(:group) } + + context 'when the signed in user has the required permission level' do + before do + group.add_owner(user) + sign_in(user) + end + + it 'allows the user to export the group', :sidekiq_inline do + visit edit_group_path(group) + + expect(page).to have_content('Export group') + + click_link('Export group') + expect(page).to have_content('Group export started') + + expect(page).to have_content('Download export') + end + end + + context 'when the group import/export FF is disabled' do + before do + stub_feature_flags(group_import_export: false) + + group.add_owner(user) + sign_in(user) + end + + it 'does not show the group export options' do + visit edit_group_path(group) + + expect(page).to have_content('Advanced') + expect(page).not_to have_content('Export group') + end + end + + context 'when the signed in user does not have the required permission level' do + before do + group.add_guest(user) + + sign_in(user) + end + + it 'does not let the user export the group' do + visit edit_group_path(group) + + expect(page).to have_content('Page Not Found') + expect(page).not_to have_content('Export group') + end + end +end diff --git a/spec/features/groups/issues_spec.rb b/spec/features/groups/issues_spec.rb index e03d7b6d1f7..1cefcd18989 100644 --- a/spec/features/groups/issues_spec.rb +++ b/spec/features/groups/issues_spec.rb @@ -12,7 +12,7 @@ describe 'Group issues page' do let(:path) { issues_group_path(group) } before do - stub_feature_flags({ vue_issuables_list: { enabled: false, thing: group } }) + stub_feature_flags(vue_issuables_list: false) end context 'with shared examples' do @@ -186,4 +186,25 @@ describe 'Group issues page' do end end end + + context 'issues pagination' do + let(:user_in_group) { create(:group_member, :maintainer, user: create(:user), group: group ).user } + + let!(:issues) do + (1..25).to_a.map { |index| create(:issue, project: project, title: "Issue #{index}") } + end + + before do + sign_in(user_in_group) + visit issues_group_path(group) + end + + it 'shows the pagination' do + expect(page).to have_selector('.gl-pagination') + end + + it 'first pagination item is active' do + expect(page).to have_css(".js-first-button a.page-link.active") + end + end end diff --git a/spec/features/groups/members/leave_group_spec.rb b/spec/features/groups/members/leave_group_spec.rb index df15f995be4..5c7c83aea6d 100644 --- a/spec/features/groups/members/leave_group_spec.rb +++ b/spec/features/groups/members/leave_group_spec.rb @@ -31,8 +31,6 @@ describe 'Groups > Members > Leave group' do page.accept_confirm - expect(find('.flash-notice')).to have_content "You left the \"#{group.full_name}\" group" - expect(page).to have_content left_group_message(group) expect(current_path).to eq(dashboard_groups_path) expect(group.users).not_to include(user) end diff --git a/spec/features/groups/members/manage_groups_spec.rb b/spec/features/groups/members/manage_groups_spec.rb index 55f9418521f..593c450c6d6 100644 --- a/spec/features/groups/members/manage_groups_spec.rb +++ b/spec/features/groups/members/manage_groups_spec.rb @@ -15,75 +15,56 @@ describe 'Groups > Members > Manage groups', :js do sign_in(user) end - context 'with share groups with groups feature flag' do - before do - stub_feature_flags(shared_with_group: true) - end - - it 'add group to group' do - visit group_group_members_path(shared_group) + it 'add group to group' do + visit group_group_members_path(shared_group) - add_group(shared_with_group.id, 'Reporter') + add_group(shared_with_group.id, 'Reporter') - page.within(first_row) do - expect(page).to have_content(shared_with_group.name) - expect(page).to have_content('Reporter') - end + page.within(first_row) do + expect(page).to have_content(shared_with_group.name) + expect(page).to have_content('Reporter') end + end - it 'remove user from group' do - create(:group_group_link, shared_group: shared_group, - shared_with_group: shared_with_group, group_access: ::Gitlab::Access::DEVELOPER) - - visit group_group_members_path(shared_group) - - expect(page).to have_content(shared_with_group.name) + it 'remove user from group' do + create(:group_group_link, shared_group: shared_group, + shared_with_group: shared_with_group, group_access: ::Gitlab::Access::DEVELOPER) - accept_confirm do - find(:css, '#existing_shares li', text: shared_with_group.name).find(:css, 'a.btn-remove').click - end + visit group_group_members_path(shared_group) - wait_for_requests + expect(page).to have_content(shared_with_group.name) - expect(page).not_to have_content(shared_with_group.name) + accept_confirm do + find(:css, '#existing_shares li', text: shared_with_group.name).find(:css, 'a.btn-remove').click end - it 'update group to owner level' do - create(:group_group_link, shared_group: shared_group, - shared_with_group: shared_with_group, group_access: ::Gitlab::Access::DEVELOPER) + wait_for_requests - visit group_group_members_path(shared_group) + expect(page).not_to have_content(shared_with_group.name) + end - page.within(first_row) do - click_button('Developer') - click_link('Maintainer') + it 'update group to owner level' do + create(:group_group_link, shared_group: shared_group, + shared_with_group: shared_with_group, group_access: ::Gitlab::Access::DEVELOPER) - wait_for_requests + visit group_group_members_path(shared_group) - expect(page).to have_button('Maintainer') - end - end + page.within(first_row) do + click_button('Developer') + click_link('Maintainer') - def add_group(id, role) - page.click_link 'Invite group' - page.within ".invite-group-form" do - select2(id, from: "#shared_with_group_id") - select(role, from: "shared_group_access") - click_button "Invite" - end - end - end + wait_for_requests - context 'without share groups with groups feature flag' do - before do - stub_feature_flags(share_group_with_group: false) + expect(page).to have_button('Maintainer') end + end - it 'does not render invitation form and tabs' do - visit group_group_members_path(shared_group) - - expect(page).not_to have_link('Invite member') - expect(page).not_to have_link('Invite group') + def add_group(id, role) + page.click_link 'Invite group' + page.within ".invite-group-form" do + select2(id, from: "#shared_with_group_id") + select(role, from: "shared_group_access") + click_button "Invite" end end end diff --git a/spec/features/groups/members/master_adds_member_with_expiration_date_spec.rb b/spec/features/groups/members/master_adds_member_with_expiration_date_spec.rb new file mode 100644 index 00000000000..491937ce4ab --- /dev/null +++ b/spec/features/groups/members/master_adds_member_with_expiration_date_spec.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'Groups > Members > Owner adds member with expiration date', :js do + include Select2Helper + include ActiveSupport::Testing::TimeHelpers + + let(:user1) { create(:user, name: 'John Doe') } + let!(:new_member) { create(:user, name: 'Mary Jane') } + let(:group) { create(:group) } + + before do + group.add_owner(user1) + sign_in(user1) + end + + it 'expiration date is displayed in the members list' do + travel_to Time.zone.parse('2016-08-06 08:00') do + date = 4.days.from_now + visit group_group_members_path(group) + + page.within '.invite-users-form' do + select2(new_member.id, from: '#user_ids', multiple: true) + fill_in 'expires_at', with: date.to_s(:medium) + "\n" + click_on 'Invite' + end + + page.within "#group_member_#{group_member_id(new_member)}" do + expect(page).to have_content('Expires in 4 days') + end + end + end + + it 'change expiration date' do + travel_to Time.zone.parse('2016-08-06 08:00') do + date = 3.days.from_now + group.add_developer(new_member) + + visit group_group_members_path(group) + + page.within "#group_member_#{group_member_id(new_member)}" do + find('.js-access-expiration-date').set date.to_s(:medium) + "\n" + wait_for_requests + expect(page).to have_content('Expires in 3 days') + end + end + end + + it 'remove expiration date' do + travel_to Time.zone.parse('2016-08-06 08:00') do + date = 3.days.from_now + group_member = create(:group_member, :developer, user: new_member, group: group, expires_at: date.to_s(:medium)) + + visit group_group_members_path(group) + + page.within "#group_member_#{group_member.id}" do + find('.js-clear-input').click + wait_for_requests + expect(page).not_to have_content('Expires in 3 days') + end + end + end + + def group_member_id(user) + group.members.find_by(user_id: new_member).id + end +end diff --git a/spec/features/groups/navbar_spec.rb b/spec/features/groups/navbar_spec.rb index 0cdc2aa88f4..fd5b4ec9345 100644 --- a/spec/features/groups/navbar_spec.rb +++ b/spec/features/groups/navbar_spec.rb @@ -10,7 +10,42 @@ describe 'Group navbar' do let_it_be(:user) { create(:user) } let_it_be(:group) { create(:group) } + let(:structure) do + [ + { + nav_item: _('Group overview'), + nav_sub_items: [ + _('Details'), + _('Activity') + ] + }, + { + nav_item: _('Issues'), + nav_sub_items: [ + _('List'), + _('Board'), + _('Labels'), + _('Milestones') + ] + }, + { + nav_item: _('Merge Requests'), + nav_sub_items: [] + }, + { + nav_item: _('Kubernetes'), + nav_sub_items: [] + }, + (analytics_nav_item if Gitlab.ee?), + { + nav_item: _('Members'), + nav_sub_items: [] + } + ] + end + before do + stub_feature_flags(group_push_rules: false) group.add_maintainer(user) sign_in(user) end @@ -20,4 +55,21 @@ describe 'Group navbar' do visit group_path(group) end end + + context 'when container registry is available' do + before do + stub_config(registry: { enabled: true }) + + insert_after_nav_item( + _('Kubernetes'), + new_nav_item: { + nav_item: _('Packages & Registries'), + nav_sub_items: [_('Container Registry')] + } + ) + visit group_path(group) + end + + it_behaves_like 'verified navigation bar' + end end |