Skip to content

Commit 3f2133e

Browse files
committed
fix(tests): fix flaky getSnapshotsSince test
1 parent 68e3f8c commit 3f2133e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

internal-packages/run-engine/src/engine/tests/getSnapshotsSince.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,17 @@ describe("RunEngine getSnapshotsSince", () => {
191191
organizationId: authenticatedEnvironment.organization.id,
192192
});
193193

194-
// Wait for waitpoint completion
194+
// Poll until the waitpoint is completed by the background worker
195+
for (let i = 0; i < 50; i++) {
196+
await setTimeout(100);
197+
const wp = await prisma.waitpoint.findFirst({
198+
where: { id: waitpoint.id },
199+
select: { status: true },
200+
});
201+
if (wp?.status === "COMPLETED") break;
202+
}
203+
204+
// Allow time for the snapshot to be created after waitpoint completion
195205
await setTimeout(200);
196206

197207
// Get all snapshots

0 commit comments

Comments
 (0)