diff --git a/services/web/frontend/js/features/group-management/components/members-table/dropdown-button.tsx b/services/web/frontend/js/features/group-management/components/members-table/dropdown-button.tsx index 826ce1a77c..9f5ea259a0 100644 --- a/services/web/frontend/js/features/group-management/components/members-table/dropdown-button.tsx +++ b/services/web/frontend/js/features/group-management/components/members-table/dropdown-button.tsx @@ -194,7 +194,7 @@ export default function DropdownButton({ ) } - if (managedUsersActive && !isUserManaged) { + if (managedUsersActive && !isUserManaged && !userPending) { buttons.push( ) } - if (groupSSOActive && !isGroupSSOLinked) { + if (groupSSOActive && !isGroupSSOLinked && !userPending) { buttons.push( { + 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') + }) + }) + describe('for a managed group member', function () { const user: User = { _id: 'some-user', @@ -240,6 +280,44 @@ describe('DropdownButton', function () { }) }) + 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') + }) + }) + describe('for a group member not linked with SSO yet', function () { const user: User = { _id: 'some-user', @@ -310,6 +388,44 @@ describe('DropdownButton', function () { }) }) + 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') + }) + }) + describe('for a non-managed group member with SSO linked', function () { const user: User = { _id: 'some-user',