-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
107 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -769,107 +769,115 @@ describe('<BudgetDetailPage />', () => { | |
['[email protected]'], | ||
); | ||
}); | ||
it('test member status popovers', async () => { | ||
const initialState = { | ||
portalConfiguration: { | ||
...initialStoreState.portalConfiguration, | ||
enterpriseFeatures: { | ||
enterpriseGroupsV1: true, | ||
it( | ||
'test member status popovers', | ||
async () => { | ||
const initialState = { | ||
portalConfiguration: { | ||
...initialStoreState.portalConfiguration, | ||
enterpriseFeatures: { | ||
enterpriseGroupsV1: true, | ||
}, | ||
}, | ||
}, | ||
}; | ||
useParams.mockReturnValue({ | ||
enterpriseSlug: 'test-enterprise-slug', | ||
enterpriseAppPage: 'test-enterprise-page', | ||
activeTabKey: 'members', | ||
}); | ||
useSubsidyAccessPolicy.mockReturnValue({ | ||
isInitialLoading: false, | ||
data: mockAssignableSubsidyAccessPolicy, | ||
}); | ||
useBudgetDetailActivityOverview.mockReturnValue({ | ||
isLoading: false, | ||
data: mockEmptyStateBudgetDetailActivityOverview, | ||
}); | ||
useBudgetRedemptions.mockReturnValue({ | ||
isLoading: false, | ||
budgetRedemptions: mockEmptyBudgetRedemptions, | ||
fetchBudgetRedemptions: jest.fn(), | ||
}); | ||
useEnterpriseGroupLearners.mockReturnValue({ | ||
data: { | ||
count: 1, | ||
currentPage: 1, | ||
next: null, | ||
numPages: 1, | ||
results: { | ||
enterpriseGroupMembershipUuid: 'cde2e374-032f-4c08-8c0d-bf3205fa7c7e', | ||
learnerId: 4382, | ||
memberDetails: { userEmail: '[email protected]', userName: 'duke silver' }, | ||
}; | ||
useParams.mockReturnValue({ | ||
enterpriseSlug: 'test-enterprise-slug', | ||
enterpriseAppPage: 'test-enterprise-page', | ||
activeTabKey: 'members', | ||
}); | ||
useSubsidyAccessPolicy.mockReturnValue({ | ||
isInitialLoading: false, | ||
data: mockAssignableSubsidyAccessPolicy, | ||
}); | ||
useBudgetDetailActivityOverview.mockReturnValue({ | ||
isLoading: false, | ||
data: mockEmptyStateBudgetDetailActivityOverview, | ||
}); | ||
useBudgetRedemptions.mockReturnValue({ | ||
isLoading: false, | ||
budgetRedemptions: mockEmptyBudgetRedemptions, | ||
fetchBudgetRedemptions: jest.fn(), | ||
}); | ||
useEnterpriseGroupLearners.mockReturnValue({ | ||
data: { | ||
count: 1, | ||
currentPage: 1, | ||
next: null, | ||
numPages: 1, | ||
results: { | ||
enterpriseGroupMembershipUuid: 'cde2e374-032f-4c08-8c0d-bf3205fa7c7e', | ||
learnerId: 4382, | ||
memberDetails: { userEmail: '[email protected]', userName: 'duke silver' }, | ||
}, | ||
}, | ||
}, | ||
}); | ||
useEnterpriseGroupMembersTableData.mockReturnValue({ | ||
isLoading: false, | ||
enterpriseGroupMembersTableData: { | ||
itemCount: 5, | ||
pageCount: 1, | ||
results: [{ | ||
memberDetails: { userEmail: '[email protected]', userName: 'duke silver' }, | ||
status: 'pending', | ||
recentAction: 'Pending: April 02, 2024', | ||
enrollmentCount: 0, | ||
}, { | ||
memberDetails: { userEmail: '[email protected]', userName: 'bobby newport' }, | ||
status: 'removed', | ||
recentAction: 'Removed: April 02, 2024', | ||
enrollmentCount: 0, | ||
}, { | ||
memberDetails: { userEmail: '[email protected]', userName: 'ann perkins' }, | ||
status: 'accepted', | ||
recentAction: 'Accepted: April 02, 2024', | ||
enrollmentCount: 0, | ||
}, { | ||
memberDetails: { userEmail: '[email protected]', userName: 'andy dwyer' }, | ||
status: 'internal_api_error', | ||
recentAction: 'Errored: April 01, 2024', | ||
enrollmentCount: 0, | ||
}, { | ||
memberDetails: { userEmail: '[email protected]', userName: 'donna meagle' }, | ||
status: 'email_error', | ||
recentAction: 'Errored: April 01, 2024', | ||
enrollmentCount: 0, | ||
}], | ||
}, | ||
fetchEnterpriseGroupMembersTableData: jest.fn(), | ||
}); | ||
renderWithRouter(<BudgetDetailPageWrapper initialState={initialState} />); | ||
await waitFor(() => expect(screen.queryByText('[email protected]')).toBeInTheDocument()); | ||
userEvent.click(screen.getByText('Waiting for member')); | ||
await waitFor(() => expect(screen.queryByText('Waiting for [email protected]')).toBeInTheDocument()); | ||
screen.getByText('This member must accept their invitation to browse this budget\'s catalog and enroll using their ' | ||
+ 'member permissions by logging in or creating an account within 90 days.'); | ||
// click again to close it out | ||
userEvent.click(screen.getByText('Waiting for member')); | ||
|
||
userEvent.click(screen.getByText('Accepted')); | ||
await waitFor(() => expect(screen.queryByText('Invitation accepted')).toBeInTheDocument()); | ||
screen.getByText('This member has successfully accepted the member invitation and can ' | ||
+ 'now browse this budget\'s catalog and enroll using their member permissions.'); | ||
userEvent.click(screen.getByText('Accepted')); | ||
|
||
userEvent.click(screen.getByText('Removed')); | ||
await waitFor(() => expect(screen.queryByText('Member removed')).toBeInTheDocument()); | ||
screen.getByText('This member has been successfully removed and can not browse this budget\'s ' | ||
+ 'catalog and enroll using their member permissions.'); | ||
|
||
userEvent.click(screen.getByText('Failed: System')); | ||
await waitFor(() => expect(screen.queryByText('Something went wrong behind the scenes.')).toBeInTheDocument()); | ||
|
||
userEvent.click(screen.getByText('Failed: Bad email')); | ||
await waitFor(() => expect(screen.queryByText('This member invitation failed because a notification to [email protected] ' | ||
+ 'could not be sent.')).toBeInTheDocument()); | ||
}); | ||
}); | ||
useEnterpriseGroupMembersTableData.mockReturnValue({ | ||
isLoading: false, | ||
enterpriseGroupMembersTableData: { | ||
itemCount: 5, | ||
pageCount: 1, | ||
results: [{ | ||
memberDetails: { userEmail: '[email protected]', userName: 'duke silver' }, | ||
status: 'pending', | ||
recentAction: 'Pending: April 02, 2024', | ||
enrollmentCount: 0, | ||
}, { | ||
memberDetails: { userEmail: '[email protected]', userName: 'bobby newport' }, | ||
status: 'removed', | ||
recentAction: 'Removed: April 02, 2024', | ||
enrollmentCount: 0, | ||
}, { | ||
memberDetails: { userEmail: '[email protected]', userName: 'ann perkins' }, | ||
status: 'accepted', | ||
recentAction: 'Accepted: April 02, 2024', | ||
enrollmentCount: 0, | ||
}, { | ||
memberDetails: { userEmail: '[email protected]', userName: 'andy dwyer' }, | ||
status: 'internal_api_error', | ||
recentAction: 'Errored: April 01, 2024', | ||
enrollmentCount: 0, | ||
}, { | ||
memberDetails: { userEmail: '[email protected]', userName: 'donna meagle' }, | ||
status: 'email_error', | ||
recentAction: 'Errored: April 01, 2024', | ||
enrollmentCount: 0, | ||
}], | ||
}, | ||
fetchEnterpriseGroupMembersTableData: jest.fn(), | ||
}); | ||
renderWithRouter(<BudgetDetailPageWrapper initialState={initialState} />); | ||
await waitFor(() => expect(screen.queryByText('[email protected]')).toBeInTheDocument()); | ||
userEvent.click(screen.getByText('Waiting for member')); | ||
await waitFor(() => expect(screen.queryByText('Waiting for [email protected]')).toBeInTheDocument()); | ||
screen.getByText('This member must accept their invitation to browse this budget\'s catalog and enroll using their ' | ||
+ 'member permissions by logging in or creating an account within 90 days.'); | ||
// click again to close it out | ||
userEvent.click(screen.getByText('Waiting for member')); | ||
|
||
userEvent.click(screen.getByText('Accepted')); | ||
await waitFor(() => expect(screen.queryByText('Invitation accepted')).toBeInTheDocument()); | ||
screen.getByText('This member has successfully accepted the member invitation and can ' | ||
+ 'now browse this budget\'s catalog and enroll using their member permissions.'); | ||
userEvent.click(screen.getByText('Accepted')); | ||
|
||
userEvent.click(screen.getByText('Removed')); | ||
await waitFor(() => expect(screen.queryByText('Member removed')).toBeInTheDocument()); | ||
screen.getByText('This member has been successfully removed and can not browse this budget\'s ' | ||
+ 'catalog and enroll using their member permissions.'); | ||
|
||
userEvent.click(screen.getByText('Failed: System')); | ||
await waitFor(() => expect(screen.queryByText('Something went wrong behind the scenes.')).toBeInTheDocument()); | ||
|
||
userEvent.click(screen.getByText('Failed: Bad email')); | ||
await waitFor(() => expect(screen.queryByText('This member invitation failed because a notification to [email protected] ' | ||
+ 'could not be sent.')).toBeInTheDocument()); | ||
}, | ||
// Increase the timeout from the default (5000 ms) to 9000 ms to give | ||
// github actions a little more time to run this heavy/flaky test. | ||
// FIXME: Longer term, we should break up this test so that there are not | ||
// so many sequential click + waitFor. | ||
9000, | ||
); | ||
it('download learner flow for multiple selected pages of users', async () => { | ||
// Setup | ||
const initialState = { | ||
|