From 8133d70bb39c5cca0d915c43c9028003be3af489 Mon Sep 17 00:00:00 2001 From: Meli <5aaa86bce934fc3445fc254aab560a40923f10252f92107e665073dede0e04d3@buzz.block.builderlab.xyz> Date: Sat, 22 Aug 2026 14:47:22 -0400 Subject: [PATCH] test(desktop): wait for relay connect before restart-close check The service-restart backoff test waited for the channel list to paint before firing the 1012 close. The channel list is Tauri-backed and renders before the websocket is up, so with three rejected dials the session was still in its backoff loop when the test looked for a socket to close and found none. Now that preconnect dials immediately instead of waiting for requestIdleCallback, the first rejected attempt happens early enough to expose the gap deterministically. Wait for the connected state instead. The test still fails with the 1012 backoff reset disabled, so it guards the same behavior. Co-authored-by: Meli <5aaa86bce934fc3445fc254aab560a40923f10252f92107e665073dede0e04d3@buzz.block.builderlab.xyz> Signed-off-by: Meli <5aaa86bce934fc3445fc254aab560a40923f10252f92107e665073dede0e04d3@buzz.block.builderlab.xyz> --- desktop/tests/e2e/relay-reconnect.spec.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/desktop/tests/e2e/relay-reconnect.spec.ts b/desktop/tests/e2e/relay-reconnect.spec.ts index af573373d3..7868e577da 100644 --- a/desktop/tests/e2e/relay-reconnect.spec.ts +++ b/desktop/tests/e2e/relay-reconnect.spec.ts @@ -368,9 +368,16 @@ test("service restart close resets accumulated backoff", async ({ page }) => { websocketConnectErrors: ["down 1", "down 2", "down 3"], }); await page.goto("/"); - await expect(page.getByTestId("channel-general")).toBeVisible({ - timeout: 15_000, - }); + // Three rejected dials put the session deep in its backoff loop before it + // connects; wait for that connect rather than for the Tauri-backed channel + // list, which paints long before the websocket is up. + await expect + .poll( + () => + page.evaluate(() => window.__BUZZ_E2E_GET_RELAY_CONNECTION_STATE__?.()), + { timeout: 15_000 }, + ) + .toBe("connected"); const startedAt = Date.now(); await restartMockWebsockets(page);