diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-13 15:08:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-13 15:08:02 +0000 |
commit | 4eeb6b0d16021ab4a730eec4610eff2606421147 (patch) | |
tree | 488db828fe58f1e80dc5415970e4c929db7e4c4b /spec/features | |
parent | 8cc5f2790908ba9bb8eecba2b78a3c5a88c77b90 (diff) | |
download | gitlab-ce-4eeb6b0d16021ab4a730eec4610eff2606421147.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/groups/members/filter_members_spec.rb | 59 | ||||
-rw-r--r-- | spec/features/projects/members/group_members_spec.rb | 35 |
2 files changed, 77 insertions, 17 deletions
diff --git a/spec/features/groups/members/filter_members_spec.rb b/spec/features/groups/members/filter_members_spec.rb index fc62c92db4e..cba86f7e651 100644 --- a/spec/features/groups/members/filter_members_spec.rb +++ b/spec/features/groups/members/filter_members_spec.rb @@ -3,42 +3,71 @@ require 'spec_helper' describe 'Groups > Members > Filter members' do - let(:user) { create(:user) } - let(:user_with_2fa) { create(:user, :two_factor_via_otp) } - let(:group) { create(:group) } + let(:user) { create(:user) } + let(:nested_group_user) { create(:user) } + let(:user_with_2fa) { create(:user, :two_factor_via_otp) } + let(:group) { create(:group) } + let(:nested_group) { create(:group, parent: group) } before do group.add_owner(user) group.add_maintainer(user_with_2fa) + nested_group.add_maintainer(nested_group_user) sign_in(user) end it 'shows all members' do - visit_members_list + visit_members_list(group) - expect(first_member).to include(user.name) - expect(second_member).to include(user_with_2fa.name) + expect(member(0)).to include(user.name) + expect(member(1)).to include(user_with_2fa.name) expect(page).to have_css('.member-filter-2fa-dropdown .dropdown-toggle-text', text: 'Everyone') end it 'shows only 2FA members' do - visit_members_list(two_factor: 'enabled') + visit_members_list(group, two_factor: 'enabled') - expect(first_member).to include(user_with_2fa.name) + expect(member(0)).to include(user_with_2fa.name) expect(members_list.size).to eq(1) expect(page).to have_css('.member-filter-2fa-dropdown .dropdown-toggle-text', text: 'Enabled') end it 'shows only non 2FA members' do - visit_members_list(two_factor: 'disabled') + visit_members_list(group, two_factor: 'disabled') - expect(first_member).to include(user.name) + expect(member(0)).to include(user.name) expect(members_list.size).to eq(1) expect(page).to have_css('.member-filter-2fa-dropdown .dropdown-toggle-text', text: 'Disabled') end - def visit_members_list(options = {}) + it 'shows inherited members by default' do + visit_members_list(nested_group) + + expect(member(0)).to include(user.name) + expect(member(1)).to include(user_with_2fa.name) + expect(member(2)).to include(nested_group_user.name) + expect(members_list.size).to eq(3) + + expect(page).to have_css('[data-qa-selector="filter-members-with-inherited-permissions"] a.is-active', text: 'Show all members') + end + + it 'shows only group members' do + visit_members_list(nested_group, with_inherited_permissions: 'exclude') + expect(member(0)).to include(nested_group_user.name) + expect(members_list.size).to eq(1) + expect(page).to have_css('[data-qa-selector="filter-members-with-inherited-permissions"] a.is-active', text: 'Show only direct members') + end + + it 'shows only inherited members' do + visit_members_list(nested_group, with_inherited_permissions: 'only') + expect(member(0)).to include(user.name) + expect(member(1)).to include(user_with_2fa.name) + expect(members_list.size).to eq(2) + expect(page).to have_css('[data-qa-selector="filter-members-with-inherited-permissions"] a.is-active', text: 'Show only inherited members') + end + + def visit_members_list(group, options = {}) visit group_group_members_path(group.to_param, options) end @@ -46,11 +75,7 @@ describe 'Groups > Members > Filter members' do page.all('ul.content-list > li') end - def first_member - members_list.first.text - end - - def second_member - members_list.last.text + def member(number) + members_list[number].text end end diff --git a/spec/features/projects/members/group_members_spec.rb b/spec/features/projects/members/group_members_spec.rb index 4ecc3db78b3..d37f912a2bc 100644 --- a/spec/features/projects/members/group_members_spec.rb +++ b/spec/features/projects/members/group_members_spec.rb @@ -31,6 +31,41 @@ describe 'Projects members' do end end + context 'with a group' do + it 'shows group and project members by default' do + visit project_project_members_path(project) + + page.within first('.content-list') do + expect(page).to have_content(developer.name) + + expect(page).to have_content(user.name) + expect(page).to have_content(group.name) + end + end + + it 'shows project members only if requested' do + visit project_project_members_path(project, with_inherited_permissions: 'exclude') + + page.within first('.content-list') do + expect(page).to have_content(developer.name) + + expect(page).not_to have_content(user.name) + expect(page).not_to have_content(group.name) + end + end + + it 'shows group members only if requested' do + visit project_project_members_path(project, with_inherited_permissions: 'only') + + page.within first('.content-list') do + expect(page).not_to have_content(developer.name) + + expect(page).to have_content(user.name) + expect(page).to have_content(group.name) + end + end + end + context 'with a group and a project invitee' do before do group_invitee |