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: stop two music-video tests flaking on a loaded runner (#11839)

[._.]/ Adam Eivy70cb6ad95f55
diff --git a/client/src/components/musicVideo/CompositionPreviewPlayer.test.jsx b/client/src/components/musicVideo/CompositionPreviewPlayer.test.jsx
index d3f6bc2525..5437a44aa0 100644
--- a/client/src/components/musicVideo/CompositionPreviewPlayer.test.jsx
+++ b/client/src/components/musicVideo/CompositionPreviewPlayer.test.jsx
@@ -998,6 +998,8 @@ describe('native composition playback', () => {
await screen.findByText(/Native playback clock could not be synchronized/);
expect(playbackMessages('prepare')).toHaveLength(0);
expect(playbackMessages('play')).toHaveLength(0);
+ // The fallback message renders before the player schedules its first tick.
+ await waitFor(() => expect(raf).toHaveBeenCalled());
const audio = container.querySelector('audio');
const image = container.querySelector('img');
const initial = image.src;
diff --git a/server/services/musicVideoSceneHooks.test.js b/server/services/musicVideoSceneHooks.test.js
index befb201ff2..0e4f9cf937 100644
--- a/server/services/musicVideoSceneHooks.test.js
+++ b/server/services/musicVideoSceneHooks.test.js
@@ -23,7 +23,9 @@ const projects = await import('./musicVideo/projects.js');
const imageHook = await import('./musicVideoSceneImageHook.js');
const videoHook = await import('./musicVideoSceneVideoHook.js');
-async function waitFor(predicate, { timeoutMs = 2000, intervalMs = 5 } = {}) {
+// A ceiling, not a delay: it returns the moment the predicate holds. Kept well under
+// the 30s test timeout so a slow file-backed write on a loaded runner still lands.
+async function waitFor(predicate, { timeoutMs = 20000, intervalMs = 5 } = {}) {
const deadline = Date.now() + timeoutMs;
while (Date.now() < deadline) {
if (await predicate()) return;