Skip to content

Commit 7bdca5b

Browse files
committed
CCM-11965: fix flakey test
1 parent 1903afe commit 7bdca5b

File tree

1 file changed

+5
-6
lines changed
  • frontend/src/__tests__/app/message-plans/create-message-plan

1 file changed

+5
-6
lines changed

frontend/src/__tests__/app/message-plans/create-message-plan/page.test.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ describe('CreateMessagePlanPage', () => {
6868

6969
await user.click(screen.getByTestId('submit-button'));
7070

71-
expect(container.asFragment()).toMatchSnapshot();
72-
7371
expect(createMessagePlanServerAction).toHaveBeenCalledTimes(1);
7472
expect(createMessagePlanServerAction).toHaveBeenCalledWith(
7573
{},
@@ -86,13 +84,14 @@ describe('CreateMessagePlanPage', () => {
8684
name: 'My Message Plan',
8785
});
8886

89-
const errorSummaryHeading = await screen.getByTestId('error-summary');
90-
91-
// "error-summary" test id targets the nested heading rather than the top level of the error summary
87+
// error-summary" test id targets the nested heading rather than the top level of the error summary
9288
// so we need to assert against the parent element
93-
await waitFor(() => {
89+
await waitFor(async () => {
90+
const errorSummaryHeading = await screen.getByTestId('error-summary');
9491
expect(errorSummaryHeading.parentElement).toHaveFocus();
9592
});
93+
94+
expect(container.asFragment()).toMatchSnapshot();
9695
});
9796

9897
test('redirects when there are no campaignIds', async () => {

0 commit comments

Comments
 (0)