From 1aff2c646223b7c75107e8bfad262133a260fa3b Mon Sep 17 00:00:00 2001 From: Troy Sankey Date: Tue, 3 Dec 2024 10:45:10 -0800 Subject: [PATCH] test: extend timeout on slow test --- .../members-tab/tests/MembersTab.test.jsx | 206 +++++++++--------- 1 file changed, 107 insertions(+), 99 deletions(-) diff --git a/src/components/learner-credit-management/members-tab/tests/MembersTab.test.jsx b/src/components/learner-credit-management/members-tab/tests/MembersTab.test.jsx index d7ce81e193..750d43f461 100644 --- a/src/components/learner-credit-management/members-tab/tests/MembersTab.test.jsx +++ b/src/components/learner-credit-management/members-tab/tests/MembersTab.test.jsx @@ -769,107 +769,115 @@ describe('', () => { ['foobar@test.com'], ); }); - 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: 'dukesilver@test.com', 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: 'dukesilver@test.com', userName: 'duke silver' }, + }, }, - }, - }); - useEnterpriseGroupMembersTableData.mockReturnValue({ - isLoading: false, - enterpriseGroupMembersTableData: { - itemCount: 5, - pageCount: 1, - results: [{ - memberDetails: { userEmail: 'dukesilver@test.com', userName: 'duke silver' }, - status: 'pending', - recentAction: 'Pending: April 02, 2024', - enrollmentCount: 0, - }, { - memberDetails: { userEmail: 'bobbynewport@test.com', userName: 'bobby newport' }, - status: 'removed', - recentAction: 'Removed: April 02, 2024', - enrollmentCount: 0, - }, { - memberDetails: { userEmail: 'annperkins@test.com', userName: 'ann perkins' }, - status: 'accepted', - recentAction: 'Accepted: April 02, 2024', - enrollmentCount: 0, - }, { - memberDetails: { userEmail: 'andydwyer@test.com', userName: 'andy dwyer' }, - status: 'internal_api_error', - recentAction: 'Errored: April 01, 2024', - enrollmentCount: 0, - }, { - memberDetails: { userEmail: 'donnameagle@test.com', userName: 'donna meagle' }, - status: 'email_error', - recentAction: 'Errored: April 01, 2024', - enrollmentCount: 0, - }], - }, - fetchEnterpriseGroupMembersTableData: jest.fn(), - }); - renderWithRouter(); - await waitFor(() => expect(screen.queryByText('dukesilver@test.com')).toBeInTheDocument()); - userEvent.click(screen.getByText('Waiting for member')); - await waitFor(() => expect(screen.queryByText('Waiting for dukesilver@test.com')).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 donnameagle@test.com ' - + 'could not be sent.')).toBeInTheDocument()); - }); + }); + useEnterpriseGroupMembersTableData.mockReturnValue({ + isLoading: false, + enterpriseGroupMembersTableData: { + itemCount: 5, + pageCount: 1, + results: [{ + memberDetails: { userEmail: 'dukesilver@test.com', userName: 'duke silver' }, + status: 'pending', + recentAction: 'Pending: April 02, 2024', + enrollmentCount: 0, + }, { + memberDetails: { userEmail: 'bobbynewport@test.com', userName: 'bobby newport' }, + status: 'removed', + recentAction: 'Removed: April 02, 2024', + enrollmentCount: 0, + }, { + memberDetails: { userEmail: 'annperkins@test.com', userName: 'ann perkins' }, + status: 'accepted', + recentAction: 'Accepted: April 02, 2024', + enrollmentCount: 0, + }, { + memberDetails: { userEmail: 'andydwyer@test.com', userName: 'andy dwyer' }, + status: 'internal_api_error', + recentAction: 'Errored: April 01, 2024', + enrollmentCount: 0, + }, { + memberDetails: { userEmail: 'donnameagle@test.com', userName: 'donna meagle' }, + status: 'email_error', + recentAction: 'Errored: April 01, 2024', + enrollmentCount: 0, + }], + }, + fetchEnterpriseGroupMembersTableData: jest.fn(), + }); + renderWithRouter(); + await waitFor(() => expect(screen.queryByText('dukesilver@test.com')).toBeInTheDocument()); + userEvent.click(screen.getByText('Waiting for member')); + await waitFor(() => expect(screen.queryByText('Waiting for dukesilver@test.com')).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 donnameagle@test.com ' + + '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 = {