Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: harden two flaky CI tests with deadline-based waits (#9603)

[._.]/ Adam Eivyff2e1f92ae18
diff --git a/client/src/components/apps/tabs/CustomTasksSection.test.jsx b/client/src/components/apps/tabs/CustomTasksSection.test.jsx
index 785e7316a7..14d26e06dc 100644
--- a/client/src/components/apps/tabs/CustomTasksSection.test.jsx
+++ b/client/src/components/apps/tabs/CustomTasksSection.test.jsx
@@ -331,7 +331,7 @@ describe('CustomTasksSection trigger outcomes', () => {
await screen.findByText('Example Task');
const subject = screen.getByLabelText('Subject *');
- expect(subject).toHaveValue('Saved subject');
+ await waitFor(() => expect(subject).toHaveValue('Saved subject'));
await user.clear(subject);
await user.type(subject, ' ');
await waitFor(() => expect(subject).toHaveValue(' '));
diff --git a/server/services/musicVideo/castAndSetsService.test.js b/server/services/musicVideo/castAndSetsService.test.js
index 21573fee98..a9922e3be2 100644
--- a/server/services/musicVideo/castAndSetsService.test.js
+++ b/server/services/musicVideo/castAndSetsService.test.js
@@ -77,8 +77,12 @@ const board = {
const keyOf = (job) => job.params.musicVideo.castAndSets.key;
const current = async (id) => projects.getProject(id);
+// Deadline-based, not an iteration count: each check reads from disk, so a slow
+// runner (Windows CI) stretches an iteration far past its 5ms sleep and a fixed
+// 200 passes can expire in about a second.
async function until(check, label) {
- for (let i = 0; i < 200; i += 1) {
+ const deadline = Date.now() + 10_000;
+ while (Date.now() < deadline) {
if (await check()) return;
await new Promise((r) => setTimeout(r, 5));
}