fix(webui): name the gateway sandbox launcher in setup guidance

This commit is contained in:
Xubin Ren committed 2026-11-08 14:29:46 +08:00
1 parent f5e5bd6ea0
commit 44d567e37c
31 files changed
+230 -86

No files matched your search

+3 -1
View File
@@ -25,6 +25,8 @@ export function ChatFailureFixture({ parameters }: { parameters: URLSearchParams
const variant = parameters.get("variant") === "hero" ? "hero" : "thread";
const dismiss = () => { setVisible(false); setAction("dismissed"); };
const settings = () => setAction("settings");
const gateway = parameters.get("gateway") ?? "bwrap";
const backend = gateway === "bwrap" || gateway === "seatbelt" ? gateway : null;
return <main className="min-h-screen bg-background p-4 text-foreground">
<section className="mx-auto max-w-3xl py-8">
<ThreadMessages messages={messages} isStreaming={false} />
@@ -35,7 +37,7 @@ export function ChatFailureFixture({ parameters }: { parameters: URLSearchParams
: parameters.get("notice") === "fallback"
? <ModelFallbackNotice model="Fallback model" onDismiss={dismiss} onOpenSettings={settings} />
: parameters.get("notice") === "sandbox"
? <SandboxNotice issue="missing" onDismiss={dismiss} onOpenSettings={settings} />
? <SandboxNotice issue="missing" backend={backend} onDismiss={dismiss} onOpenSettings={settings} />
: <RecoveryNotice
state={{ recovery_id: "fixture-recovery", status: "awaiting_user", reason: "model_request_failed", failure_error_kind: "authentication" }}
onContinue={async () => { setVisible(false); setAction("continued"); }}
+35
View File
@@ -1,4 +1,39 @@
import { expect, test } from "@playwright/test";
import { readFileSync } from "node:fs";
for (const locale of ["en", "zh-CN", "zh-TW", "fr", "ja", "ko", "es", "pt-BR", "vi", "id"]) {
for (const gateway of ["bwrap", "seatbelt"]) {
test(`sandbox path action fits a narrow view: ${gateway}, ${locale}`, async ({ page }) => {
const copy = JSON.parse(readFileSync(new URL(`../src/i18n/locales/${locale}/common.json`, import.meta.url), "utf8")).settings.sandbox;
const executable = gateway === "bwrap" ? "bwrap" : "sandbox-exec";
await page.setViewportSize({ width: 390, height: 1000 });
await page.addInitScript((locale) => localStorage.setItem("nanobot.locale", locale), locale);
await page.emulateMedia({ reducedMotion: "reduce" });
await page.goto(`/browser/fixture.html?case=chat-failure&notice=sandbox&gateway=${gateway}`);
const notice = page.locator(".thread-composer-notice");
await expect(notice).toContainText(gateway === "bwrap" ? "Bubblewrap (bwrap)" : "macOS Seatbelt (sandbox-exec)");
await expect(notice).not.toContainText(/{{|settings\.sandbox/);
const action = notice.getByRole("button", { name: copy.notice.configurePath.replace("{{launcher}}", executable), exact: true });
await expect(action).toBeInViewport({ ratio: 1 });
const bounds = (await notice.boundingBox())!;
const button = (await action.boundingBox())!;
expect(button.x).toBeGreaterThanOrEqual(bounds.x);
expect(button.x + button.width).toBeLessThanOrEqual(bounds.x + bounds.width);
expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(390);
await action.click();
await expect(page.getByLabel("Fixture action")).toHaveText("settings");
});
}
}
test("sandbox guidance stays generic without gateway backend details", async ({ page }) => {
await page.goto("/browser/fixture.html?case=chat-failure&notice=sandbox&gateway=unknown");
const notice = page.locator(".thread-composer-notice");
await expect(notice).toContainText("sandbox launcher");
await expect(notice).not.toContainText(/bwrap|sandbox-exec/);
await notice.getByRole("button", { name: "Open sandbox settings" }).click();
await expect(page.getByLabel("Fixture action")).toHaveText("settings");
});
for (const width of [1440, 390]) {
for (const variant of ["thread", "hero"]) {