Commit eafbbab3 authored by Peter Hegman's avatar Peter Hegman Committed by Kerri Miller

Update EE specs related to group members view

Part of a larger initiative to convert the group members view from
HAML to Vue
parent 1a043e6f
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
i18n: { i18n: {
editPermissions: s__('Members|Edit permissions'), editPermissions: s__('Members|Edit permissions'),
modalBody: s__( modalBody: s__(
'Members|%{userName} is currently a LDAP user. Editing their permissions will override the settings from the LDAP group sync.', 'Members|%{userName} is currently an LDAP user. Editing their permissions will override the settings from the LDAP group sync.',
), ),
toastMessage: s__('Members|LDAP override enabled.'), toastMessage: s__('Members|LDAP override enabled.'),
}, },
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Groups > Audit Events', :js do RSpec.describe 'Groups > Audit Events', :js do
include Spec::Support::Helpers::Features::MembersHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:alex) { create(:user, name: 'Alex') } let(:alex) { create(:user, name: 'Alex') }
let(:group) { create(:group) } let(:group) { create(:group) }
before do before do
stub_feature_flags(vue_group_members_list: false)
group.add_owner(user) group.add_owner(user)
group.add_developer(alex) group.add_developer(alex)
sign_in(user) sign_in(user)
...@@ -47,11 +47,9 @@ RSpec.describe 'Groups > Audit Events', :js do ...@@ -47,11 +47,9 @@ RSpec.describe 'Groups > Audit Events', :js do
wait_for_requests wait_for_requests
group_member = group.members.find_by(user_id: alex) page.within first_row do
page.within "#group_member_#{group_member.id}" do
click_button 'Developer' click_button 'Developer'
click_link 'Maintainer' click_button 'Maintainer'
end end
find(:link, text: 'Settings').click find(:link, text: 'Settings').click
......
...@@ -2,14 +2,12 @@ ...@@ -2,14 +2,12 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Groups > Members > List members' do RSpec.describe 'Groups > Members > List members' do
include Spec::Support::Helpers::Features::MembersHelpers
let(:user1) { create(:user, name: 'John Doe') } let(:user1) { create(:user, name: 'John Doe') }
let(:user2) { create(:user, name: 'Mary Jane') } let(:user2) { create(:user, name: 'Mary Jane') }
let(:group) { create(:group) } let(:group) { create(:group) }
before do
stub_feature_flags(vue_group_members_list: false)
end
context 'with Group SAML identity linked for a user' do context 'with Group SAML identity linked for a user' do
let(:saml_provider) { create(:saml_provider) } let(:saml_provider) { create(:saml_provider) }
let(:group) { saml_provider.group } let(:group) { saml_provider.group }
...@@ -23,12 +21,10 @@ RSpec.describe 'Groups > Members > List members' do ...@@ -23,12 +21,10 @@ RSpec.describe 'Groups > Members > List members' do
extern_uid: 'user2@example.com') extern_uid: 'user2@example.com')
end end
it 'shows user with SSO status badge' do it 'shows user with SSO status badge', :js do
visit group_group_members_path(group) visit group_group_members_path(group)
member = GroupMember.find_by(user: user2, group: group) expect(second_row).to have_content('SAML')
expect(find("#group_member_#{member.id}").find('.badge-info')).to have_content('SAML')
end end
end end
...@@ -40,12 +36,10 @@ RSpec.describe 'Groups > Members > List members' do ...@@ -40,12 +36,10 @@ RSpec.describe 'Groups > Members > List members' do
managed_group.add_guest(managed_user) managed_group.add_guest(managed_user)
end end
it 'shows user with "Managed Account" badge' do it 'shows user with "Managed Account" badge', :js do
visit group_group_members_path(managed_group) visit group_group_members_path(managed_group)
member = GroupMember.find_by(user: managed_user, group: managed_group) expect(first_row).to have_content('Managed Account')
expect(page).to have_selector("#group_member_#{member.id} .badge-info", text: 'Managed Account')
end end
end end
......
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe 'Groups > Members > Maintainer/Owner can override LDAP access levels' do RSpec.describe 'Groups > Members > Maintainer/Owner can override LDAP access levels' do
include WaitForRequests include WaitForRequests
include Spec::Support::Helpers::Features::MembersHelpers
let(:johndoe) { create(:user, name: 'John Doe') } let(:johndoe) { create(:user, name: 'John Doe') }
let(:maryjane) { create(:user, name: 'Mary Jane') } let(:maryjane) { create(:user, name: 'Mary Jane') }
...@@ -16,8 +17,6 @@ RSpec.describe 'Groups > Members > Maintainer/Owner can override LDAP access lev ...@@ -16,8 +17,6 @@ RSpec.describe 'Groups > Members > Maintainer/Owner can override LDAP access lev
let!(:regular_member) { create(:group_member, :guest, group: group, user: maryjane, ldap: false) } let!(:regular_member) { create(:group_member, :guest, group: group, user: maryjane, ldap: false) }
before do before do
stub_feature_flags(vue_group_members_list: false)
# We need to actually activate the LDAP config otherwise `Group#ldap_synced?` will always be false! # We need to actually activate the LDAP config otherwise `Group#ldap_synced?` will always be false!
allow(Gitlab.config.ldap).to receive_messages(enabled: true) allow(Gitlab.config.ldap).to receive_messages(enabled: true)
...@@ -35,7 +34,7 @@ RSpec.describe 'Groups > Members > Maintainer/Owner can override LDAP access lev ...@@ -35,7 +34,7 @@ RSpec.describe 'Groups > Members > Maintainer/Owner can override LDAP access lev
visit group_group_members_path(group) visit group_group_members_path(group)
within "#group_member_#{ldap_member.id}" do within first_row do
expect(page).not_to have_content 'LDAP' expect(page).not_to have_content 'LDAP'
expect(page).not_to have_button 'Guest' expect(page).not_to have_button 'Guest'
expect(page).not_to have_button 'Edit permissions' expect(page).not_to have_button 'Edit permissions'
...@@ -47,7 +46,7 @@ RSpec.describe 'Groups > Members > Maintainer/Owner can override LDAP access lev ...@@ -47,7 +46,7 @@ RSpec.describe 'Groups > Members > Maintainer/Owner can override LDAP access lev
visit group_group_members_path(group) visit group_group_members_path(group)
within "#group_member_#{ldap_member.id}" do within first_row do
expect(page).to have_content 'LDAP' expect(page).to have_content 'LDAP'
expect(page).to have_button 'Guest', disabled: true expect(page).to have_button 'Guest', disabled: true
expect(page).to have_button 'Edit permissions' expect(page).to have_button 'Edit permissions'
...@@ -55,29 +54,26 @@ RSpec.describe 'Groups > Members > Maintainer/Owner can override LDAP access lev ...@@ -55,29 +54,26 @@ RSpec.describe 'Groups > Members > Maintainer/Owner can override LDAP access lev
click_button 'Edit permissions' click_button 'Edit permissions'
end end
page.within('[role="dialog"]') do
expect(page).to have_content ldap_override_message expect(page).to have_content ldap_override_message
click_button 'Edit permissions'
click_button 'Change permissions' end
expect(page).not_to have_content ldap_override_message expect(page).not_to have_content ldap_override_message
expect(page).not_to have_button 'Change permissions'
within "#group_member_#{ldap_member.id}" do within first_row do
expect(page).not_to have_button 'Edit permissions' expect(page).not_to have_button 'Edit permissions'
expect(page).to have_button 'Guest', disabled: false expect(page).to have_button 'Guest', disabled: false
end end
refresh # controls should still be enabled after a refresh refresh # controls should still be enabled after a refresh
within "#group_member_#{ldap_member.id}" do within first_row do
expect(page).not_to have_button 'Edit permissions' expect(page).not_to have_button 'Edit permissions'
expect(page).to have_button 'Guest', disabled: false expect(page).to have_button 'Guest', disabled: false
click_button 'Guest' click_button 'Guest'
click_button 'Revert to LDAP group sync settings'
within '.dropdown-menu' do
click_link 'Revert to LDAP group sync settings'
end
wait_for_requests wait_for_requests
...@@ -85,16 +81,14 @@ RSpec.describe 'Groups > Members > Maintainer/Owner can override LDAP access lev ...@@ -85,16 +81,14 @@ RSpec.describe 'Groups > Members > Maintainer/Owner can override LDAP access lev
expect(page).to have_button 'Edit permissions' expect(page).to have_button 'Edit permissions'
end end
within "#group_member_#{regular_member.id}" do within third_row do
expect(page).not_to have_content 'LDAP' expect(page).not_to have_content 'LDAP'
expect(page).not_to have_button 'Edit permissions' expect(page).not_to have_button 'Edit permissions'
expect(page).to have_button 'Guest', disabled: false expect(page).to have_button 'Guest', disabled: false
click_button 'Guest' click_button 'Guest'
within '.dropdown-menu' do
expect(page).not_to have_content 'Revert to LDAP group sync settings' expect(page).not_to have_content 'Revert to LDAP group sync settings'
end end
end end
end
end end
...@@ -81,7 +81,7 @@ describe('LdapOverrideConfirmationModal', () => { ...@@ -81,7 +81,7 @@ describe('LdapOverrideConfirmationModal', () => {
it('displays modal body', () => { it('displays modal body', () => {
expect( expect(
getByText( getByText(
`${member.user.name} is currently a LDAP user. Editing their permissions will override the settings from the LDAP group sync.`, `${member.user.name} is currently an LDAP user. Editing their permissions will override the settings from the LDAP group sync.`,
).exists(), ).exists(),
).toBe(true); ).toBe(true);
}); });
......
...@@ -16488,7 +16488,7 @@ msgstr "" ...@@ -16488,7 +16488,7 @@ msgstr ""
msgid "Members|%{time} by %{user}" msgid "Members|%{time} by %{user}"
msgstr "" msgstr ""
msgid "Members|%{userName} is currently a LDAP user. Editing their permissions will override the settings from the LDAP group sync." msgid "Members|%{userName} is currently an LDAP user. Editing their permissions will override the settings from the LDAP group sync."
msgstr "" msgstr ""
msgid "Members|An error occurred while trying to enable LDAP override, please try again." msgid "Members|An error occurred while trying to enable LDAP override, please try again."
......
...@@ -23,6 +23,10 @@ module Spec ...@@ -23,6 +23,10 @@ module Spec
all_rows[1] all_rows[1]
end end
def third_row
all_rows[2]
end
def invite_users_form def invite_users_form
page.find('[data-testid="invite-users-form"]') page.find('[data-testid="invite-users-form"]')
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment