diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-05-11 13:54:04 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-05-11 13:54:04 +0300 |
commit | 8c2b73dc8c5adf41b94033fe1d0a265524e304c4 (patch) | |
tree | 5a4f191b49b93cbcc85012fa9299c8ff21ca7b87 /spec/features/groups | |
parent | 908aeebe917548aa6583f5837e1d9a73406dae0a (diff) | |
parent | 61e9a3dcc4d8d33ab2a5c2773acfce03db08a039 (diff) |
Merge branch 'dz-add-2fa-filter' into 'master'
Add 2FA filter to group members page
See merge request gitlab-org/gitlab-ce!18483
Diffstat (limited to 'spec/features/groups')
-rw-r--r-- | spec/features/groups/members/filter_members_spec.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/features/groups/members/filter_members_spec.rb b/spec/features/groups/members/filter_members_spec.rb new file mode 100644 index 00000000000..5ddb5894624 --- /dev/null +++ b/spec/features/groups/members/filter_members_spec.rb @@ -0,0 +1,54 @@ +require 'spec_helper' + +feature 'Groups > Members > Filter members' do + let(:user) { create(:user) } + let(:user_with_2fa) { create(:user, :two_factor_via_otp) } + let(:group) { create(:group) } + + background do + group.add_owner(user) + group.add_master(user_with_2fa) + + sign_in(user) + end + + scenario 'shows all members' do + visit_members_list + + expect(first_member).to include(user.name) + expect(second_member).to include(user_with_2fa.name) + expect(page).to have_css('.member-filter-2fa-dropdown .dropdown-toggle-text', text: '2FA: Everyone') + end + + scenario 'shows only 2FA members' do + visit_members_list(two_factor: 'enabled') + + expect(first_member).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: '2FA: Enabled') + end + + scenario 'shows only non 2FA members' do + visit_members_list(two_factor: 'disabled') + + expect(first_member).to include(user.name) + expect(members_list.size).to eq(1) + expect(page).to have_css('.member-filter-2fa-dropdown .dropdown-toggle-text', text: '2FA: Disabled') + end + + def visit_members_list(options = {}) + visit group_group_members_path(group.to_param, options) + end + + def members_list + page.all('ul.content-list > li') + end + + def first_member + members_list.first.text + end + + def second_member + members_list.last.text + end +end |