diff --git a/internal/gui/tests/routing-failed-open.test.cjs b/internal/gui/tests/routing-failed-open.test.cjs index 98c562cb..2649c8ba 100644 --- a/internal/gui/tests/routing-failed-open.test.cjs +++ b/internal/gui/tests/routing-failed-open.test.cjs @@ -79,7 +79,17 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", const row = page.locator(".rt-req").nth(1); assert.match(await row.textContent(), /400/); - const was = await row.evaluate((e) => e.getBoundingClientRect().top); + // Live, the page follows the newest request and draws its story above + // the list once the trace is in; measure after that, not mid-load. + if (live) await page.locator(".rt-req").nth(0).and(page.locator('[aria-pressed="true"]')).waitFor(); + await page.locator(".rt-steps li").first().waitFor(); + let was = await row.evaluate((e) => e.getBoundingClientRect().top); + for (let i = 0, same = 0; i < 40 && same < 3; i++) { + await page.waitForTimeout(50); + const now = await row.evaluate((e) => e.getBoundingClientRect().top); + same = Math.abs(now - was) <= 1 ? same + 1 : 0; + was = now; + } await row.click(); await page.waitForTimeout(400); assert(Math.abs((await row.evaluate((e) => e.getBoundingClientRect().top)) - was) <= 1, "picking the request moved the page");