From a230aefb40e33eb572437719bd6977cc3791a4dc Mon Sep 17 00:00:00 2001 From: Shakker Date: Tue, 12 May 2026 17:00:17 +0100 Subject: [PATCH] test: itemize login failure panel --- ui/src/ui/views/login-gate.test.ts | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/ui/src/ui/views/login-gate.test.ts b/ui/src/ui/views/login-gate.test.ts index 13212c78f6c..95d7719d5c6 100644 --- a/ui/src/ui/views/login-gate.test.ts +++ b/ui/src/ui/views/login-gate.test.ts @@ -223,9 +223,30 @@ describe("renderLoginGate", () => { const alert = container.querySelector('[role="alert"]'); expect(alert?.dataset.kind).toBe("protocol-mismatch"); - expect(alert?.textContent).toContain("Protocol mismatch"); - expect(alert?.textContent).toContain("openclaw dashboard"); - expect(alert?.querySelector("details")?.textContent).toContain("protocol mismatch"); - expect(alert?.querySelector("a")?.getAttribute("href")).toContain("docs.openclaw.ai"); + expect(alert?.querySelector(".login-gate__failure-title")?.textContent?.trim()).toBe( + "Protocol mismatch", + ); + expect(alert?.querySelector(".login-gate__failure-summary")?.textContent?.trim()).toBe( + "The served Control UI and the running Gateway do not agree on the supported connection protocol.", + ); + expect( + Array.from(alert?.querySelectorAll(".login-gate__failure-steps li") ?? []).map((step) => + step.textContent?.trim(), + ), + ).toEqual([ + "Reopen the served dashboard with openclaw dashboard so the UI and Gateway come from the same install.", + "If using pnpm ui:dev, rebuild or restart the dev UI against the current checkout.", + "Restart the Gateway after updating OpenClaw so it serves the current protocol.", + ]); + expect(alert?.querySelector("details summary")?.textContent?.trim()).toBe("Raw error"); + expect(alert?.querySelector(".login-gate__failure-raw")?.textContent?.trim()).toBe( + "protocol mismatch", + ); + + const docsLink = alert?.querySelector(".login-gate__failure-docs"); + expect(docsLink?.textContent?.trim()).toBe("Control UI auth docs"); + expect(docsLink?.getAttribute("href")).toBe( + "https://docs.openclaw.ai/web/control-ui#debuggingtesting-dev-server--remote-gateway", + ); }); });