Skip to content

Commit c29af96

Browse files
adhityamamallanAssem-Uber
authored andcommitted
Return Promise in workflow history test (#808)
Return Promise in workflow history test to fix flakiness with rendering Use waitFor instead of waitForElementToBeRemoved
1 parent 6f059a7 commit c29af96

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/views/workflow-history/__tests__/workflow-history.test.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
render,
99
screen,
1010
userEvent,
11+
waitFor,
1112
waitForElementToBeRemoved,
1213
} from '@/test-utils/rtl';
1314

@@ -168,7 +169,9 @@ describe('WorkflowHistory', () => {
168169
});
169170
});
170171

171-
await waitForElementToBeRemoved(loadingIndicator);
172+
await waitFor(() => {
173+
expect(loadingIndicator).not.toBeInTheDocument();
174+
});
172175
});
173176
});
174177

@@ -223,7 +226,7 @@ async function setup({
223226
httpResolver: async () => {
224227
requestIndex = requestIndex + 1;
225228
if (requestIndex > 0 && resolveLoadMoreManually) {
226-
await new Promise((resolve, reject) => {
229+
return await new Promise((resolve, reject) => {
227230
requestResolver = (result: GetWorkflowHistoryResponse) =>
228231
resolve(HttpResponse.json(result, { status: 200 }));
229232
requestRejector = () =>

0 commit comments

Comments
 (0)