Elffuss BraidHub

utopia-ia/elffuss-code public

Tests: wait for the end of the Mind's camera flight for real

e60021f said mind_stars.mjs now awaited the end of the flight, but it did
so with page.waitForFunction and an async predicate. Playwright takes the
predicate's promise as a truthy value and returns at once (a probe with an
async predicate that is always false returns immediately with false; the
same predicate written synchronously waits until its timeout). On a loaded
machine the next check could then read the flight half way, and one run in
25 failed "the flight ends on its own".

The test now asks for the flight state from Node until it ends, with a
bounded number of polls. Three reruns: 25 of 25 each.
Changeset250949a672a80f8914ab12f624fd0ffe1f55b5b1a6cf66e1c26cd7fe18ed3d93
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-11 16:02 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-11 16:02 +02:00
Parents4823c78abba4

Browse the files at this changeset

1 file changed

modified tests/mind_stars.mjs +4 −2
@@ -117,8 +117,10 @@
117117 return m._debug();
118118 });
119119 ok('el clic dispara el vuelo (flying=true a mitad de camino)', midFly.flying);
120-// que termine (dura 1,1 s de reloj de fotogramas)
121-await p.waitForFunction(async () => !(await import('/js/mind.js'))._debug().flying, null, { timeout: 15000 }).catch(() => {});
120+// que termine (dura 1,1 s de reloj de fotogramas): se pregunta desde aquí, sin
121+// waitForFunction, que no espera a un predicado asíncrono
122+const vuela = async () => (await p.evaluate(async () => (await import('/js/mind.js'))._debug())).flying;
123+for (let i = 0; i < 150 && await vuela(); i++) await p.waitForTimeout(100);
122124 const posAfter = (await p.evaluate(async () => (await import('/js/mind.js'))._debug())).cameraPos;
123125 const moved = Math.hypot(posAfter[0] - posBefore[0], posAfter[1] - posBefore[1], posAfter[2] - posBefore[2]);
124126 ok('la cámara realmente se movió al centrarse en el perfil', moved > 5, `desplazamiento ${moved.toFixed(1)}`);