From 675acd681c29c57071ae2fee478c96016087d675 Mon Sep 17 00:00:00 2001 From: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 Date: Thu, 2 Jul 2026 13:07:02 -0400 Subject: [PATCH] fix(relay-reconnect): update relay-connectivity spec 01 for connected-state gate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test 01 previously booted with channelsReadError and expected the card to show while the relay was still connected — relying on the old behavior where a stale query error alone could pin the card open. After the connected-state authority change, the card is suppressed when state === 'connected', even if channelsReadError is present. Drive the relay to 'reconnecting' (which IS in isRelayConnectionStateDegraded) so the card appears via the state path, independent of query-error timing. Drop the connection-banner count 0 assertion: the banner correctly shows for any degraded state, including reconnecting. Co-authored-by: Will Pfleger Signed-off-by: Will Pfleger --- desktop/tests/e2e/relay-connectivity.spec.ts | 25 ++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/desktop/tests/e2e/relay-connectivity.spec.ts b/desktop/tests/e2e/relay-connectivity.spec.ts index 947890459..4ab3577ae 100644 --- a/desktop/tests/e2e/relay-connectivity.spec.ts +++ b/desktop/tests/e2e/relay-connectivity.spec.ts @@ -52,12 +52,33 @@ test.describe("relay connectivity", () => { await installMockBridge(page, { channelsReadError: RELAY_UNREACHABLE }); await page.goto("/"); + // Wait for the E2E seam to be installed (bridge init is complete), then force + // the relay into a degraded state. The card is gated on !isRelayConnectionConnected: + // a stale channelsReadError alone (with state still "connected") no longer pins + // the card — connected state is now authoritative so stale query errors don't + // hold the UI open after an auto-reconnect. + // + // Use "reconnecting" (rather than "disconnected"): the card shows via + // isRelayConnectionStateDegraded for reconnecting/stalled states, so the test + // doesn't race the channels-query retry window. useRelayConnection debounces + // non-healthy states by 2 s, so await with timeout 5 s. + await page.waitForFunction( + () => + typeof ( + window as Window & { + __BUZZ_E2E_SET_RELAY_CONNECTION_STATE__?: unknown; + } + ).__BUZZ_E2E_SET_RELAY_CONNECTION_STATE__ === "function", + ); + await driveConnectionDegraded(page, "reconnecting"); + const relayCard = page.getByTestId("sidebar-relay-unreachable"); - await expect(relayCard).toBeVisible(); + await expect(relayCard).toBeVisible({ + timeout: 5_000, + }); await expect(relayCard).toContainText("Can't reach the relay"); await expect(relayCard).toContainText("Click to connect"); await expect(page.getByTestId("sidebar-reconnect")).toBeVisible(); - await expect(page.getByTestId("connection-banner")).toHaveCount(0); await settle(page); // Clip to sidebar width (256px) so the card and channel list are both visible.