2023-08-25 12:44:47 -04:00
|
|
|
import type { PropsWithChildren } from 'react'
|
2023-07-13 04:50:43 -04:00
|
|
|
import sinon from 'sinon'
|
2023-10-27 09:11:34 -04:00
|
|
|
import DropdownButton from '@/features/group-management/components/members-table/dropdown-button'
|
|
|
|
import { GroupMembersProvider } from '@/features/group-management/context/group-members-context'
|
2023-10-25 07:09:54 -04:00
|
|
|
import { User } from '../../../../../../types/group-management/user'
|
2023-06-30 04:30:20 -04:00
|
|
|
|
2023-08-25 12:44:47 -04:00
|
|
|
function Wrapper({ children }: PropsWithChildren<Record<string, unknown>>) {
|
|
|
|
return (
|
|
|
|
<ul className="managed-users-list">
|
|
|
|
<span
|
|
|
|
className="managed-users-actions"
|
|
|
|
style={{ display: 'flex', width: '100%', justifyContent: 'flex-end' }}
|
|
|
|
>
|
|
|
|
<GroupMembersProvider>{children}</GroupMembersProvider>
|
|
|
|
</span>
|
|
|
|
</ul>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2023-10-25 07:09:54 -04:00
|
|
|
function mountDropDownComponent(user: User, subscriptionId: string) {
|
|
|
|
cy.mount(
|
|
|
|
<Wrapper>
|
2023-10-27 09:11:34 -04:00
|
|
|
<DropdownButton
|
2023-10-25 07:09:54 -04:00
|
|
|
user={user}
|
|
|
|
openOffboardingModalForUser={sinon.stub()}
|
2024-04-03 10:12:09 -04:00
|
|
|
openUnlinkUserModal={sinon.stub()}
|
2023-10-25 07:09:54 -04:00
|
|
|
groupId={subscriptionId}
|
2024-03-27 11:45:09 -04:00
|
|
|
setGroupUserAlert={sinon.stub()}
|
2023-10-25 07:09:54 -04:00
|
|
|
/>
|
|
|
|
</Wrapper>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('DropdownButton', function () {
|
|
|
|
const subscriptionId = '123abc123abc'
|
|
|
|
|
|
|
|
describe('with a standard group', function () {
|
2023-11-24 09:16:53 -05:00
|
|
|
describe('for a pending user (has not joined group)', function () {
|
2023-11-23 08:53:38 -05:00
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: true,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {},
|
|
|
|
isEntityAdmin: undefined,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
2023-06-30 04:30:20 -04:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
it('should render dropdown button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
2023-08-22 09:30:34 -04:00
|
|
|
})
|
2023-06-30 04:30:20 -04:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
cy.findByTestId('resend-group-invite-action').should('be.visible')
|
|
|
|
cy.findByTestId('remove-user-action').should('be.visible')
|
|
|
|
|
2023-11-24 09:16:53 -05:00
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
2023-11-23 08:53:38 -05:00
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
|
|
|
})
|
2023-06-30 04:30:20 -04:00
|
|
|
})
|
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('for the group admin', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: false,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {},
|
|
|
|
isEntityAdmin: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should render dropdown button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
|
|
|
|
cy.findByTestId('remove-user-action').should('be.visible')
|
|
|
|
|
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
2023-06-30 04:30:20 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('with Managed Users enabled', function () {
|
2023-08-25 12:44:47 -04:00
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
2023-11-23 08:53:38 -05:00
|
|
|
win.metaAttributesCache.set('ol-managedUsersActive', true)
|
|
|
|
win.metaAttributesCache.set('ol-groupSSOActive', false)
|
2023-08-25 12:44:47 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2023-11-24 09:16:53 -05:00
|
|
|
describe('for a pending user (has not joined group)', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: true,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {},
|
|
|
|
isEntityAdmin: undefined,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should render dropdown button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
cy.findByTestId('resend-group-invite-action').should('be.visible')
|
|
|
|
cy.findByTestId('remove-user-action').should('be.visible')
|
|
|
|
|
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('for a managed group member', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: false,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {
|
|
|
|
managedBy: subscriptionId,
|
|
|
|
enrolledAt: new Date(),
|
|
|
|
},
|
|
|
|
isEntityAdmin: undefined,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
2023-08-25 12:44:47 -04:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
it('should render the dropdown button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
2023-08-25 12:44:47 -04:00
|
|
|
})
|
2023-11-23 08:53:38 -05:00
|
|
|
|
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
|
|
|
|
cy.findByTestId('delete-user-action').should('be.visible')
|
|
|
|
|
|
|
|
cy.findByTestId('remove-user-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
2023-08-25 12:44:47 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('for a non-managed group member', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: false,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {},
|
|
|
|
isEntityAdmin: undefined,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
2023-06-30 04:30:20 -04:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
it('should render dropdown button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
2023-08-22 09:30:34 -04:00
|
|
|
})
|
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
|
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should(
|
|
|
|
'be.visible'
|
|
|
|
)
|
|
|
|
cy.findByTestId('remove-user-action').should('be.visible')
|
2023-08-22 09:30:34 -04:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
|
|
|
})
|
2023-08-22 09:30:34 -04:00
|
|
|
})
|
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('for a managed group admin user', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: false,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {
|
|
|
|
managedBy: subscriptionId,
|
|
|
|
enrolledAt: new Date(),
|
|
|
|
},
|
|
|
|
isEntityAdmin: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should render the button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
2023-08-25 12:44:47 -04:00
|
|
|
})
|
2023-11-23 08:53:38 -05:00
|
|
|
|
|
|
|
it('should show the (empty) menu when the button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
cy.findByTestId('no-actions-available').should('exist')
|
2023-08-22 09:30:34 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('with Group SSO enabled', function () {
|
2023-08-22 09:30:34 -04:00
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
2023-11-23 08:53:38 -05:00
|
|
|
win.metaAttributesCache.set('ol-managedUsersActive', false)
|
|
|
|
win.metaAttributesCache.set('ol-groupSSOActive', true)
|
2023-08-22 09:30:34 -04:00
|
|
|
})
|
2023-06-30 04:30:20 -04:00
|
|
|
})
|
|
|
|
|
2023-11-24 09:16:53 -05:00
|
|
|
describe('for a pending user (has not joined group)', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: true,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {},
|
|
|
|
isEntityAdmin: undefined,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should render dropdown button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
cy.findByTestId('resend-group-invite-action').should('be.visible')
|
|
|
|
cy.findByTestId('remove-user-action').should('be.visible')
|
|
|
|
|
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
2024-04-03 10:12:09 -04:00
|
|
|
cy.findByTestId('unlink-user-action').should('not.exist')
|
2023-11-24 09:16:53 -05:00
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('for a group member not linked with SSO yet', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: false,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {},
|
|
|
|
isEntityAdmin: undefined,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should show resend invite when user is admin', function () {
|
|
|
|
mountDropDownComponent({ ...user, isEntityAdmin: true }, '123abc')
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should not show resend invite when SSO is disabled', function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-groupSSOActive', false)
|
|
|
|
})
|
|
|
|
mountDropDownComponent(user, '123abc')
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
|
|
|
})
|
2023-06-30 04:30:20 -04:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
it('should show the resend SSO invite option when dropdown button is clicked', function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-groupSSOActive', true)
|
|
|
|
})
|
|
|
|
mountDropDownComponent(user, '123abc')
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('be.visible')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should make the correct post request when resend SSO invite is clicked ', function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-groupSSOActive', true)
|
|
|
|
})
|
|
|
|
cy.intercept(
|
|
|
|
'POST',
|
|
|
|
'/manage/groups/123abc/resendSSOLinkInvite/some-user',
|
|
|
|
{ success: true }
|
|
|
|
).as('resendInviteRequest')
|
|
|
|
mountDropDownComponent(user, '123abc')
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action')
|
|
|
|
.should('exist')
|
|
|
|
.as('resendInvite')
|
|
|
|
cy.get('@resendInvite').click()
|
|
|
|
cy.wait('@resendInviteRequest')
|
|
|
|
})
|
2023-06-30 04:30:20 -04:00
|
|
|
})
|
|
|
|
})
|
2023-08-25 05:24:58 -04:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('with Managed Users and Group SSO enabled', function () {
|
2023-08-25 05:24:58 -04:00
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
2023-11-23 08:53:38 -05:00
|
|
|
win.metaAttributesCache.set('ol-managedUsersActive', true)
|
|
|
|
win.metaAttributesCache.set('ol-groupSSOActive', true)
|
2023-08-25 05:24:58 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2023-11-24 09:16:53 -05:00
|
|
|
describe('for a pending user (has not joined group)', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: true,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {},
|
|
|
|
isEntityAdmin: undefined,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should render dropdown button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
cy.findByTestId('resend-group-invite-action').should('be.visible')
|
|
|
|
cy.findByTestId('remove-user-action').should('be.visible')
|
|
|
|
|
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
2024-04-03 10:12:09 -04:00
|
|
|
cy.findByTestId('unlink-user-action').should('not.exist')
|
2023-11-24 09:16:53 -05:00
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('for a non-managed group member with SSO linked', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: false,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {
|
|
|
|
sso: [
|
|
|
|
{
|
|
|
|
groupId: subscriptionId,
|
|
|
|
linkedAt: new Date(),
|
|
|
|
primary: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
isEntityAdmin: undefined,
|
|
|
|
}
|
2023-08-25 05:24:58 -04:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should render dropdown button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
|
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should(
|
|
|
|
'be.visible'
|
|
|
|
)
|
|
|
|
cy.findByTestId('remove-user-action').should('be.visible')
|
2024-04-03 10:12:09 -04:00
|
|
|
cy.findByTestId('unlink-user-action').should('be.visible')
|
2023-11-23 08:53:38 -05:00
|
|
|
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
|
|
|
})
|
2023-08-25 05:24:58 -04:00
|
|
|
})
|
2023-10-27 09:11:34 -04:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('for a non-managed group member with SSO not linked', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: false,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {
|
|
|
|
sso: [],
|
|
|
|
},
|
|
|
|
isEntityAdmin: undefined,
|
|
|
|
}
|
2023-11-09 11:26:46 -05:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
2023-10-25 07:09:54 -04:00
|
|
|
})
|
2023-11-23 08:53:38 -05:00
|
|
|
|
|
|
|
it('should render dropdown button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
|
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should(
|
|
|
|
'be.visible'
|
|
|
|
)
|
|
|
|
cy.findByTestId('remove-user-action').should('be.visible')
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('be.visible')
|
|
|
|
|
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
2024-04-03 10:12:09 -04:00
|
|
|
cy.findByTestId('unlink-user-action').should('not.exist')
|
2023-10-25 07:09:54 -04:00
|
|
|
})
|
|
|
|
})
|
2023-11-09 11:26:46 -05:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('for a non-managed group admin with SSO linked', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: false,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {
|
|
|
|
sso: [
|
|
|
|
{
|
|
|
|
groupId: subscriptionId,
|
|
|
|
linkedAt: new Date(),
|
|
|
|
primary: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
isEntityAdmin: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should render dropdown button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
|
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should(
|
|
|
|
'be.visible'
|
|
|
|
)
|
|
|
|
cy.findByTestId('remove-user-action').should('be.visible')
|
2024-04-03 10:12:09 -04:00
|
|
|
cy.findByTestId('unlink-user-action').should('be.visible')
|
2023-11-23 08:53:38 -05:00
|
|
|
|
|
|
|
cy.findByTestId('delete-user-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
|
|
|
})
|
2023-10-25 07:09:54 -04:00
|
|
|
})
|
2023-11-09 11:26:46 -05:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('for a non-managed group admin with SSO not linked', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: false,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {
|
|
|
|
sso: [],
|
|
|
|
},
|
|
|
|
isEntityAdmin: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should render dropdown button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
|
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should(
|
|
|
|
'be.visible'
|
|
|
|
)
|
|
|
|
cy.findByTestId('remove-user-action').should('be.visible')
|
|
|
|
cy.findByTestId('delete-user-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('exist')
|
|
|
|
|
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
2023-10-25 07:09:54 -04:00
|
|
|
})
|
|
|
|
})
|
2023-11-09 11:26:46 -05:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('for a managed group member with SSO not linked', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: false,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {
|
|
|
|
managedBy: subscriptionId,
|
|
|
|
enrolledAt: new Date(),
|
|
|
|
sso: [],
|
|
|
|
},
|
|
|
|
isEntityAdmin: undefined,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should render the dropdown button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
|
|
|
|
cy.findByTestId('delete-user-action').should('be.visible')
|
|
|
|
|
|
|
|
cy.findByTestId('remove-user-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('exist')
|
|
|
|
|
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
2023-10-25 07:09:54 -04:00
|
|
|
})
|
2023-11-23 08:53:38 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
describe('for a managed group member with SSO linked', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: false,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {
|
|
|
|
managedBy: subscriptionId,
|
|
|
|
enrolledAt: new Date(),
|
|
|
|
sso: [
|
|
|
|
{
|
|
|
|
groupId: subscriptionId,
|
|
|
|
linkedAt: new Date(),
|
|
|
|
primary: true,
|
|
|
|
},
|
|
|
|
],
|
2023-10-25 07:09:54 -04:00
|
|
|
},
|
2023-11-23 08:53:38 -05:00
|
|
|
isEntityAdmin: undefined,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should render the dropdown button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
|
|
|
|
cy.findByTestId('delete-user-action').should('be.visible')
|
|
|
|
|
|
|
|
cy.findByTestId('remove-user-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
|
|
|
|
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
|
|
|
})
|
2023-10-25 07:09:54 -04:00
|
|
|
})
|
2023-11-09 11:26:46 -05:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('for a managed group admin with SSO not linked', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: false,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {
|
|
|
|
managedBy: subscriptionId,
|
|
|
|
enrolledAt: new Date(),
|
|
|
|
sso: [],
|
|
|
|
},
|
|
|
|
isEntityAdmin: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
2023-10-25 07:09:54 -04:00
|
|
|
})
|
2023-11-23 08:53:38 -05:00
|
|
|
|
|
|
|
it('should render the button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
cy.get('.action-btn').click()
|
|
|
|
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('exist')
|
|
|
|
|
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should('not.exist')
|
|
|
|
cy.findByTestId('remove-user-action').should('not.exist')
|
|
|
|
cy.findByTestId('delete-user-action').should('not.exist')
|
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
2023-10-25 07:09:54 -04:00
|
|
|
})
|
|
|
|
})
|
2023-11-09 11:26:46 -05:00
|
|
|
|
2023-11-23 08:53:38 -05:00
|
|
|
describe('for a managed group admin with SSO linked', function () {
|
|
|
|
const user: User = {
|
|
|
|
_id: 'some-user',
|
|
|
|
email: 'some.user@example.com',
|
|
|
|
first_name: 'Some',
|
|
|
|
last_name: 'User',
|
|
|
|
invite: false,
|
|
|
|
last_active_at: new Date(),
|
|
|
|
enrollment: {
|
|
|
|
managedBy: subscriptionId,
|
|
|
|
enrolledAt: new Date(),
|
|
|
|
sso: [
|
|
|
|
{
|
|
|
|
groupId: subscriptionId,
|
|
|
|
linkedAt: new Date(),
|
|
|
|
primary: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
isEntityAdmin: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
})
|
|
|
|
|
|
|
|
mountDropDownComponent(user, subscriptionId)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should render the button', function () {
|
|
|
|
cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
'exist'
|
|
|
|
)
|
|
|
|
cy.get(`.action-btn`).should('exist')
|
|
|
|
})
|
|
|
|
|
2024-04-03 10:12:09 -04:00
|
|
|
it('should show no actions except to unlink when dropdown button is clicked', function () {
|
2023-11-23 08:53:38 -05:00
|
|
|
cy.get('.action-btn').click()
|
|
|
|
|
2024-04-03 10:12:09 -04:00
|
|
|
cy.findByTestId('unlink-user-action').should('exist')
|
2023-11-23 08:53:38 -05:00
|
|
|
|
2024-04-03 10:12:09 -04:00
|
|
|
cy.findByTestId('no-actions-available').should('not.exist')
|
2023-11-23 08:53:38 -05:00
|
|
|
cy.findByTestId('delete-user-action').should('not.exist')
|
|
|
|
cy.findByTestId('remove-user-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-managed-user-invite-action').should('not.exist')
|
|
|
|
cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
2023-10-25 07:09:54 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
2023-06-30 04:30:20 -04:00
|
|
|
})
|