fix(relay-reconnect): update relay-connectivity spec 01 for connected-state gate

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 <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7
2026-07-02 13:07:02 -04:00
co-authored by Will Pfleger
parent 529965ebd8
commit 675acd681c
+23 -2
View File
@@ -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.