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/groups/members | |
parent | 8cc5f2790908ba9bb8eecba2b78a3c5a88c77b90 (diff) | |
download | gitlab-ce-4eeb6b0d16021ab4a730eec4610eff2606421147.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/groups/members')
-rw-r--r-- | spec/features/groups/members/filter_members_spec.rb | 59 |
1 files changed, 42 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 |