|
@@ -30,287 +30,649 @@ function mountDropDownComponent(user: User, subscriptionId: string) {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-describe('ManagedUserDropdownButton', function () {
|
|
|
|
|
- const subscriptionId = '123abc'
|
|
|
|
|
-
|
|
|
|
|
- describe('with managed user', function () {
|
|
|
|
|
- const user = {
|
|
|
|
|
- _id: 'some-user',
|
|
|
|
|
- email: 'some.user@example.com',
|
|
|
|
|
- first_name: 'Some',
|
|
|
|
|
- last_name: 'User',
|
|
|
|
|
- invite: false,
|
|
|
|
|
- last_active_at: new Date(),
|
|
|
|
|
- enrollment: {
|
|
|
|
|
- managedBy: 'some-group',
|
|
|
|
|
- enrolledAt: new Date(),
|
|
|
|
|
- },
|
|
|
|
|
- isEntityAdmin: undefined,
|
|
|
|
|
- }
|
|
|
|
|
|
|
+describe('DropdownButton', function () {
|
|
|
|
|
+ const subscriptionId = '123abc123abc'
|
|
|
|
|
+
|
|
|
|
|
+ describe('with a standard group', function () {
|
|
|
|
|
+ describe('for a pending user (have 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)
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
- beforeEach(function () {
|
|
|
|
|
- cy.window().then(win => {
|
|
|
|
|
- win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
|
|
|
+ it('should render dropdown button', function () {
|
|
|
|
|
+ cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
|
+ 'exist'
|
|
|
|
|
+ )
|
|
|
|
|
+ cy.get(`.action-btn`).should('exist')
|
|
|
})
|
|
})
|
|
|
- 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('no-actions-available').should('not.exist')
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- it('should show the correct menu when dropdown button is clicked', function () {
|
|
|
|
|
- cy.get('.action-btn').click()
|
|
|
|
|
- cy.findByTestId('delete-user-action').should('exist')
|
|
|
|
|
- cy.findByTestId('delete-user-action').then($el => {
|
|
|
|
|
- Cypress.dom.isVisible($el)
|
|
|
|
|
|
|
+ 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')
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- describe('with non-managed user (have joined group)', function () {
|
|
|
|
|
- const 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,
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ describe('with Managed Users enabled', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
cy.window().then(win => {
|
|
cy.window().then(win => {
|
|
|
- win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
|
|
|
+ win.metaAttributesCache.set('ol-managedUsersActive', true)
|
|
|
|
|
+ win.metaAttributesCache.set('ol-groupSSOActive', false)
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- 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')
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ 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)
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
- 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('exist')
|
|
|
|
|
- cy.findByTestId('resend-managed-user-invite-action').then($el => {
|
|
|
|
|
- Cypress.dom.isVisible($el)
|
|
|
|
|
|
|
+ it('should render the dropdown button', function () {
|
|
|
|
|
+ cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
|
+ 'exist'
|
|
|
|
|
+ )
|
|
|
|
|
+ cy.get(`.action-btn`).should('exist')
|
|
|
})
|
|
})
|
|
|
- cy.findByTestId('remove-user-action').should('exist')
|
|
|
|
|
- cy.findByTestId('remove-user-action').then($el => {
|
|
|
|
|
- Cypress.dom.isVisible($el)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ 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')
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
- })
|
|
|
|
|
|
|
|
|
|
- describe('with pending user (have not joined group)', function () {
|
|
|
|
|
- const 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,
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ 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)
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
- beforeEach(function () {
|
|
|
|
|
- cy.window().then(win => {
|
|
|
|
|
- win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
|
|
|
+ it('should render dropdown button', function () {
|
|
|
|
|
+ cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
|
+ 'exist'
|
|
|
|
|
+ )
|
|
|
|
|
+ cy.get(`.action-btn`).should('exist')
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- mountDropDownComponent(user, subscriptionId)
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ 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')
|
|
|
|
|
|
|
|
- it('should render dropdown button', function () {
|
|
|
|
|
- cy.get('#managed-user-dropdown-some\\.user\\@example\\.com').should(
|
|
|
|
|
- 'exist'
|
|
|
|
|
- )
|
|
|
|
|
- cy.get(`.action-btn`).should('exist')
|
|
|
|
|
|
|
+ cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
|
|
|
|
+ cy.findByTestId('no-actions-available').should('not.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('exist')
|
|
|
|
|
- cy.findByTestId('resend-group-invite-action').then($el => {
|
|
|
|
|
- Cypress.dom.isVisible($el)
|
|
|
|
|
|
|
+ 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')
|
|
|
})
|
|
})
|
|
|
- cy.findByTestId('remove-user-action').should('exist')
|
|
|
|
|
- cy.findByTestId('remove-user-action').then($el => {
|
|
|
|
|
- Cypress.dom.isVisible($el)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ it('should show the (empty) menu when the button is clicked', function () {
|
|
|
|
|
+ cy.get('.action-btn').click()
|
|
|
|
|
+ cy.findByTestId('no-actions-available').should('exist')
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- describe('with group admin user', function () {
|
|
|
|
|
- const 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,
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ describe('with Group SSO enabled', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
cy.window().then(win => {
|
|
cy.window().then(win => {
|
|
|
- win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
|
|
|
+ win.metaAttributesCache.set('ol-managedUsersActive', false)
|
|
|
|
|
+ win.metaAttributesCache.set('ol-groupSSOActive', true)
|
|
|
})
|
|
})
|
|
|
- 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')
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ 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')
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
- it('should show the (empty) menu when dropdown button is clicked', function () {
|
|
|
|
|
- cy.get('.action-btn').click()
|
|
|
|
|
- cy.findByTestId('no-actions-available').should('exist')
|
|
|
|
|
|
|
+ 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')
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- describe('with managed group admin user', function () {
|
|
|
|
|
- const user = {
|
|
|
|
|
- _id: 'some-user',
|
|
|
|
|
- email: 'some.user@example.com',
|
|
|
|
|
- first_name: 'Some',
|
|
|
|
|
- last_name: 'User',
|
|
|
|
|
- invite: false,
|
|
|
|
|
- last_active_at: new Date(),
|
|
|
|
|
- enrollment: {
|
|
|
|
|
- managedBy: 'some-group',
|
|
|
|
|
- enrolledAt: new Date(),
|
|
|
|
|
- },
|
|
|
|
|
- isEntityAdmin: true,
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ describe('with Managed Users and Group SSO enabled', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
cy.window().then(win => {
|
|
cy.window().then(win => {
|
|
|
- win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
|
|
|
+ win.metaAttributesCache.set('ol-managedUsersActive', true)
|
|
|
|
|
+ win.metaAttributesCache.set('ol-groupSSOActive', true)
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- 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')
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ 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,
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- it('should show the (empty) menu when the button is clicked', function () {
|
|
|
|
|
- cy.get('.action-btn').click()
|
|
|
|
|
- cy.findByTestId('no-actions-available').should('exist')
|
|
|
|
|
|
|
+ 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('resend-sso-link-invite-action').should('not.exist')
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
- })
|
|
|
|
|
|
|
|
|
|
- describe('sending SSO invite reminder', function () {
|
|
|
|
|
- const user = {
|
|
|
|
|
- _id: 'some-user',
|
|
|
|
|
- email: 'some.user@example.com',
|
|
|
|
|
- first_name: 'Some',
|
|
|
|
|
- last_name: 'User',
|
|
|
|
|
- invite: false,
|
|
|
|
|
- last_active_at: new Date(),
|
|
|
|
|
- enrollment: {
|
|
|
|
|
- managedBy: 'some-group',
|
|
|
|
|
- enrolledAt: new Date(),
|
|
|
|
|
- },
|
|
|
|
|
- isEntityAdmin: undefined,
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ 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,
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- beforeEach(function () {
|
|
|
|
|
- cy.window().then(win => {
|
|
|
|
|
- win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
|
|
|
+ beforeEach(function () {
|
|
|
|
|
+ cy.window().then(win => {
|
|
|
|
|
+ win.metaAttributesCache.set('ol-users', [user])
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ mountDropDownComponent(user, subscriptionId)
|
|
|
})
|
|
})
|
|
|
- cy.window().then(win => {
|
|
|
|
|
- win.metaAttributesCache.set('ol-groupSSOActive', true)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ 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')
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- 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')
|
|
|
|
|
|
|
+ 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')
|
|
|
|
|
+
|
|
|
|
|
+ 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')
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- it('should not show resend invite when SSO is disabled', function () {
|
|
|
|
|
- cy.window().then(win => {
|
|
|
|
|
- win.metaAttributesCache.set('ol-groupSSOActive', false)
|
|
|
|
|
|
|
+ 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')
|
|
|
})
|
|
})
|
|
|
- mountDropDownComponent(user, '123abc')
|
|
|
|
|
- cy.get('.action-btn').click()
|
|
|
|
|
- cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
|
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- it('should not show resend invite when user has accepted SSO already', function () {
|
|
|
|
|
- cy.window().then(win => {
|
|
|
|
|
- win.metaAttributesCache.set('ol-groupSSOActive', false)
|
|
|
|
|
|
|
+ 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')
|
|
|
})
|
|
})
|
|
|
- mountDropDownComponent(
|
|
|
|
|
- {
|
|
|
|
|
- ...user,
|
|
|
|
|
- enrollment: {
|
|
|
|
|
- managedBy: 'some-group',
|
|
|
|
|
- enrolledAt: new Date(),
|
|
|
|
|
- sso: [
|
|
|
|
|
- {
|
|
|
|
|
- groupId: 'abc123abc123',
|
|
|
|
|
- linkedAt: new Date(),
|
|
|
|
|
- primary: true,
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ 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,
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
},
|
|
},
|
|
|
- '123abc'
|
|
|
|
|
- )
|
|
|
|
|
- cy.get('.action-btn').click()
|
|
|
|
|
- cy.findByTestId('resend-sso-link-invite-action').should('not.exist')
|
|
|
|
|
|
|
+ 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')
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- it('should show the resend SSO invite option when dropdown button is clicked', function () {
|
|
|
|
|
- cy.window().then(win => {
|
|
|
|
|
- win.metaAttributesCache.set('ol-groupSSOActive', true)
|
|
|
|
|
|
|
+ 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)
|
|
|
})
|
|
})
|
|
|
- mountDropDownComponent(user, '123abc')
|
|
|
|
|
- cy.get('.action-btn').click()
|
|
|
|
|
- cy.findByTestId('resend-sso-link-invite-action').should('exist')
|
|
|
|
|
- cy.findByTestId('resend-sso-link-invite-action').then($el => {
|
|
|
|
|
- Cypress.dom.isVisible($el)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ 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')
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- it('should make the correct post request when resend SSO invite is clicked ', function () {
|
|
|
|
|
- cy.window().then(win => {
|
|
|
|
|
- win.metaAttributesCache.set('ol-groupSSOActive', true)
|
|
|
|
|
|
|
+ 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')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should show no actions when dropdown button is clicked', function () {
|
|
|
|
|
+ cy.get('.action-btn').click()
|
|
|
|
|
+
|
|
|
|
|
+ cy.findByTestId('no-actions-available').should('exist')
|
|
|
|
|
+
|
|
|
|
|
+ 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')
|
|
|
})
|
|
})
|
|
|
- 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')
|
|
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|