Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(ui): align provider tests and society selectors with current UI

rubenluetke10-beep85e0fc39367c
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/chatAttachments.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/chatAttachments.test.tsx
index c34c6d8132..f67d858417 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/chatAttachments.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/chatAttachments.test.tsx
@@ -127,7 +127,7 @@ describe("chat composer attachments", () => {
it("takes a pasted image and shows what was read from it", async () => {
composer();
- const box = document.querySelector("textarea[data-jarvis-chat-input]") as HTMLTextAreaElement;
+ const box = screen.getByTestId("composer-chip-field");
const png = new File([new Uint8Array([1, 2, 3])], "image.png", { type: "image/png" });
await act(async () => {
@@ -148,7 +148,7 @@ describe("chat composer attachments", () => {
it("leaves a pasted TEXT alone so ordinary copy-paste keeps working", async () => {
composer();
- const box = document.querySelector("textarea[data-jarvis-chat-input]") as HTMLTextAreaElement;
+ const box = screen.getByTestId("composer-chip-field");
const event = new Event("paste", { bubbles: true, cancelable: true });
Object.defineProperty(event, "clipboardData", { value: transfer([]) });
@@ -181,7 +181,7 @@ describe("chat composer attachments", () => {
const send = vi.fn(async () => {});
seed({ send });
composer();
- const box = document.querySelector("textarea[data-jarvis-chat-input]") as HTMLTextAreaElement;
+ const box = screen.getByTestId("composer-chip-field");
const png = new File([new Uint8Array([1])], "image.png", { type: "image/png" });
await act(async () => {
@@ -189,7 +189,8 @@ describe("chat composer attachments", () => {
});
await waitFor(() => expect(screen.getByTestId("chat-attachment-shot.png")).toBeDefined());
- fireEvent.change(box, { target: { value: "what is wrong here" } });
+ box.textContent = "what is wrong here";
+ fireEvent.input(box);
await act(async () => {
fireEvent.click(screen.getByTestId("composer-send"));
});
@@ -203,7 +204,7 @@ describe("chat composer attachments", () => {
const send = vi.fn(async () => {});
seed({ send });
composer();
- const box = document.querySelector("textarea[data-jarvis-chat-input]") as HTMLTextAreaElement;
+ const box = screen.getByTestId("composer-chip-field");
const png = new File([new Uint8Array([1])], "image.png", { type: "image/png" });
await act(async () => {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/NewPaneChat.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/NewPaneChat.test.tsx
index 127d94539c..cfa581d93c 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/NewPaneChat.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/NewPaneChat.test.tsx
@@ -9,7 +9,7 @@
* choosable while nothing is running, because they go on the CLI's command
* line when it starts.
*/
-import { cleanup, fireEvent, render, screen, within } from "@testing-library/react";
+import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
import { NewPaneChat } from "@/components/agentic/NewPaneChat";
@@ -110,11 +110,14 @@ describe("the Agentic IDE's new chat", () => {
it("starts the pane on the picks when the first message is sent", async () => {
const { onOpen } = draw();
- fireEvent.change(screen.getByRole("textbox"), {
- target: { value: "read the router and tell me what it does" },
- });
+ const composer = screen.getByRole("textbox");
+ composer.textContent = "read the router and tell me what it does";
+ fireEvent.input(composer);
+ await waitFor(() =>
+ expect((screen.getByTestId("composer-send") as HTMLButtonElement).disabled).toBe(false),
+ );
fireEvent.click(screen.getByTestId("composer-send"));
- expect(onOpen).toHaveBeenCalledTimes(1);
+ await waitFor(() => expect(onOpen).toHaveBeenCalledTimes(1));
expect(onOpen.mock.calls[0][0]).toMatchObject({
agent: "claude",
effort: "high",
diff --git a/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx b/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
index 11baaa05b2..8cfeacbc08 100644
--- a/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
@@ -650,6 +650,10 @@ describe("ChatStage (agent chat)", () => {
]);
useAgentChatStore.setState({ activeSessionId: "s5", timeline });
render(<ChatStage />);
+ const fold = screen.queryByTestId("conversation-work-fold");
+ if (fold) fireEvent.click(within(fold).getByRole("button"));
+ const activity = document.querySelector<HTMLElement>("[data-trace-summary]");
+ if (activity) fireEvent.click(within(activity).getByRole("button"));
const [shell, grep] = Array.from(document.querySelectorAll<HTMLElement>("[data-trace-tool]"));
fireEvent.click(within(shell).getByRole("button"));
@@ -676,6 +680,10 @@ describe("ChatStage (agent chat)", () => {
]);
useAgentChatStore.setState({ activeSessionId: "s9", timeline });
render(<ChatStage />);
+ const fold = screen.queryByTestId("conversation-work-fold");
+ if (fold) fireEvent.click(within(fold).getByRole("button"));
+ const activity = document.querySelector<HTMLElement>("[data-trace-summary]");
+ if (activity) fireEvent.click(within(activity).getByRole("button"));
const tools = Array.from(document.querySelectorAll<HTMLElement>("[data-trace-tool]"));
expect(tools[0].textContent).toContain("Run command");
diff --git a/jarvis/ui/web/frontend/src/components/layout/MainView.lazy.test.tsx b/jarvis/ui/web/frontend/src/components/layout/MainView.lazy.test.tsx
index f3a5c74b0a..d1ed23c762 100644
--- a/jarvis/ui/web/frontend/src/components/layout/MainView.lazy.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/MainView.lazy.test.tsx
@@ -94,6 +94,6 @@ describe("MainView lazy sections", () => {
// right at the 5 s default on a loaded machine, which made the case fail for
// being slow rather than for a missing export. What is under test is the
// export, not the load time, so the budget is generous on purpose.
- 20_000,
+ 60_000,
);
});
diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentBrowserPreview.test.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentBrowserPreview.test.tsx
index 95bcddf349..45d287b127 100644
--- a/jarvis/ui/web/frontend/src/components/society/card/AgentBrowserPreview.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/card/AgentBrowserPreview.test.tsx
@@ -3,6 +3,16 @@ import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, test, vi } from "vitest";
import { AgentBrowserPreview } from "./AgentBrowserPreview";
import type { SocietyAgent } from "../data";
+vi.mock("@/i18n", () => ({
+ useLocaleChunk: () => true,
+ useT: () => (key: string) => ({
+ "society.browser_live.take_control": "Take control",
+ "society.browser_live.address": "Website address",
+ "society.browser_live.back": "Back",
+ "society.browser_live.screen": "Live browser of {0}",
+ "society.browser_live.live": "Live",
+ } as Record<string, string>)[key] ?? key,
+}));
const { control, state } = vi.hoisted(() => ({
control: vi.fn(),
state: { connected: true, ready: true, fullWindow: false, manual: false, running: false,
diff --git a/jarvis/ui/web/frontend/src/components/society/card/AgentRoutineDetailSeat.test.tsx b/jarvis/ui/web/frontend/src/components/society/card/AgentRoutineDetailSeat.test.tsx
index 1734206eb1..c6fd7c63ea 100644
--- a/jarvis/ui/web/frontend/src/components/society/card/AgentRoutineDetailSeat.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/card/AgentRoutineDetailSeat.test.tsx
@@ -60,12 +60,9 @@ test("the pinned seat is shown and can follow the agent again", async () => {
// The pin is visible without any catalog fetch.
expect(screen.getByText("claude-api · opus")).toBeTruthy();
expect(fetcher.mock.calls.some(([url]) => String(url).includes("agent-chat"))).toBe(false);
- // Opening the picker loads the catalog; clearing the pin saves empty seat fields.
+ // The explicit control clears the pin without depending on catalog readiness.
fireEvent.click(screen.getByText("Change"));
- const provider = (await screen.findByLabelText("Provider")) as HTMLSelectElement;
- expect(provider.value).toBe("claude-api");
- fireEvent.change(provider, { target: { value: "" } });
- expect(provider.value).toBe("");
+ fireEvent.click(screen.getByRole("button", { name: "Follow agent" }));
expect(screen.getByText("Follow agent", { selector: "p" })).toBeTruthy();
fireEvent.click(screen.getAllByText("Save")[0]);
await waitFor(() =>
diff --git a/jarvis/ui/web/frontend/src/components/society/card/RoutineSeatPicker.tsx b/jarvis/ui/web/frontend/src/components/society/card/RoutineSeatPicker.tsx
index c695ad231d..321b2ffaf1 100644
--- a/jarvis/ui/web/frontend/src/components/society/card/RoutineSeatPicker.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/card/RoutineSeatPicker.tsx
@@ -1,6 +1,7 @@
/** The model seat one routine runs on — pinned at creation, changeable here. */
import { useT } from "@/i18n";
import { useAgentChat } from "@/components/agentchat/AgentChatStoreContext";
+import { BrandedSelect } from "@/components/ui/select";
import { effortsFor } from "../create/brainPicker";
import { modelSeats, providerTitle } from "../chat/modelChoices";
import { useModelMenuData } from "../chat/useModelMenuData";
@@ -62,32 +63,29 @@ export function RoutineSeatPicker({ seat, onChange, disabled }: {
{!seat.provider ? (
<p className="text-[12px] text-muted-foreground">{label("model_follows_agent")}</p>
) : null}
- <label className={miniLabel}>
- {label("provider")}
- <select
+ <div className={miniLabel}>
+ <span>{label("provider")}</span>
+ <BrandedSelect
className={field}
- aria-label={label("provider")}
+ ariaLabel={label("provider")}
disabled={disabled || loading}
value={seat.provider}
- onChange={(e) => {
- const next = seats.find((s) => s.provider.id === e.target.value) ?? null;
+ onValueChange={(value) => {
+ const next = seats.find((s) => s.provider.id === value) ?? null;
onChange({
- provider: e.target.value,
+ provider: value,
model: "",
effort: next?.provider.default_effort ?? "",
account_id: "",
});
}}
- >
- <option value="">{label("follow_agent")}</option>
- {seats.map((s) => (
- <option key={s.provider.id} value={s.provider.id}>
- {`${providerTitle(s, t)} · ${kindSuffix(s.kind, t)}`}
- </option>
- ))}
- {seat.provider && !active ? <option value={seat.provider}>{seat.provider}</option> : null}
- </select>
- </label>
+ options={[
+ { value: "", label: label("follow_agent") },
+ ...seats.map((s) => ({ value: s.provider.id, label: `${providerTitle(s, t)} · ${kindSuffix(s.kind, t)}` })),
+ ...(seat.provider && !active ? [{ value: seat.provider, label: seat.provider }] : []),
+ ]}
+ />
+ </div>
{seat.provider ? (
<label className={miniLabel}>
{label("model_name")}
@@ -110,42 +108,30 @@ export function RoutineSeatPicker({ seat, onChange, disabled }: {
</label>
) : null}
{seat.provider && efforts.length > 0 ? (
- <label className={miniLabel}>
- {label("effort")}
- <select
+ <div className={miniLabel}>
+ <span>{label("effort")}</span>
+ <BrandedSelect
className={field}
- aria-label={label("effort")}
+ ariaLabel={label("effort")}
disabled={disabled}
value={seat.effort}
- onChange={(e) => onChange({ ...seat, effort: e.target.value })}
- >
- <option value="">{t("agent_chat.model_default")}</option>
- {efforts.map((level) => (
- <option key={level} value={level}>
- {level}
- </option>
- ))}
- </select>
- </label>
+ onValueChange={(value) => onChange({ ...seat, effort: value })}
+ options={[{ value: "", label: t("agent_chat.model_default") }, ...efforts.map((level) => ({ value: level, label: level }))]}
+ />
+ </div>
) : null}
{seat.provider && (active?.accounts.length ?? 0) > 0 ? (
- <label className={miniLabel}>
- {label("account")}
- <select
+ <div className={miniLabel}>
+ <span>{label("account")}</span>
+ <BrandedSelect
className={field}
- aria-label={label("account")}
+ ariaLabel={label("account")}
disabled={disabled}
value={seat.account_id}
- onChange={(e) => onChange({ ...seat, account_id: e.target.value })}
- >
- <option value="">{t("society.chat.model_active_account")}</option>
- {(active?.accounts ?? []).map((a) => (
- <option key={a.id} value={a.id}>
- {a.label}
- </option>
- ))}
- </select>
- </label>
+ onValueChange={(value) => onChange({ ...seat, account_id: value })}
+ options={[{ value: "", label: t("society.chat.model_active_account") }, ...(active?.accounts ?? []).map((a) => ({ value: a.id, label: a.label }))]}
+ />
+ </div>
) : null}
</div>
);
diff --git a/jarvis/ui/web/frontend/src/components/society/card/SourceControls.test.tsx b/jarvis/ui/web/frontend/src/components/society/card/SourceControls.test.tsx
index e0a69a2327..a4fea47468 100644
--- a/jarvis/ui/web/frontend/src/components/society/card/SourceControls.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/card/SourceControls.test.tsx
@@ -14,10 +14,10 @@ test("a form updated through chat discards input from its previous schema", asyn
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
const view = (name: string) => <QueryClientProvider client={client}><SourceControls taskId="form-1" source={{ kind: "form", form_fields: { [name]: { label: name, kind: "text", required: true, choices: [] } } }} /></QueryClientProvider>;
const mounted = render(view("old_field"));
- fireEvent.click(await screen.findByRole("button", { name: "Trigger input" }));
+ fireEvent.click(await screen.findByRole("button", { name: /input$/i }));
fireEvent.change(screen.getByLabelText("old_field"), { target: { value: "stale" } });
mounted.rerender(view("new_field"));
- fireEvent.click(await screen.findByRole("button", { name: "Trigger input" }));
+ fireEvent.click(await screen.findByRole("button", { name: /input$/i }));
fireEvent.change(screen.getByLabelText("new_field"), { target: { value: "current" } });
fireEvent.submit(screen.getByLabelText("new_field").closest("form")!);
await waitFor(() => expect(requests).toEqual([{ payload: { "new_field": "current" } }]));
diff --git a/jarvis/ui/web/frontend/src/components/society/companion/AgentAppearanceDialog.test.tsx b/jarvis/ui/web/frontend/src/components/society/companion/AgentAppearanceDialog.test.tsx
index 657802ac13..634d3c2ace 100644
--- a/jarvis/ui/web/frontend/src/components/society/companion/AgentAppearanceDialog.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/companion/AgentAppearanceDialog.test.tsx
@@ -66,6 +66,6 @@ it("finds the character's actual style for older recipes without style metadata"
setup(false, true);
fireEvent.click(screen.getByRole("tab", { name: "society.companion.character" }));
await screen.findByTestId("character-preview");
- expect((screen.getByLabelText("society.create.style") as HTMLSelectElement).value).toBe("fantasy");
- expect((screen.getByLabelText("society.create.base") as HTMLSelectElement).value).toBe("rogue");
+ expect(screen.getByLabelText("society.create.style").getAttribute("data-value")).toBe("fantasy");
+ expect(screen.getByLabelText("society.create.base").getAttribute("data-value")).toBe("rogue");
});
diff --git a/jarvis/ui/web/frontend/src/components/society/companion/AgentAppearanceDialog.tsx b/jarvis/ui/web/frontend/src/components/society/companion/AgentAppearanceDialog.tsx
index e20b1b80ce..0733d85b1e 100644
--- a/jarvis/ui/web/frontend/src/components/society/companion/AgentAppearanceDialog.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/companion/AgentAppearanceDialog.tsx
@@ -4,6 +4,7 @@ import { useQueryClient } from "@tanstack/react-query";
import { X } from "lucide-react";
import { useT } from "@/i18n";
import { Button } from "@/components/ui/button";
+import { BrandedSelect } from "@/components/ui/select";
import type { SocietyAgent } from "../data";
import { AgentSwatch } from "../AgentSwatch";
import { defaultRecipe, EDITABLE_CELLS, resolvePalette, type FigureRecipe } from "../figures/figureRecipe";
@@ -30,15 +31,21 @@ function CharacterEditor({ value, onChange, disabled, lead }: { value: FigureRec
const slots = value.model ? [] : slotsWithParts(value.archetype, style, base?.family ?? null, base?.fitSize ?? null);
return <fieldset disabled={disabled} className="grid gap-4 p-4" data-testid="character-editor">
<div className="h-60"><Suspense fallback={null}><AgentFigureViewer recipe={value} quiet /></Suspense></div>
- <label className="grid grid-cols-[6rem_1fr] items-center gap-3 text-sm">{t("society.create.style")}<select aria-label={t("society.create.style")} className={selectClass} value={style} onChange={e => {
- const first = basesForStyle(e.target.value)[0]; if (first) selectBase(first.base, e.target.value);
- }}>{availableStyles.map(s => <option key={s} value={s}>{t(`society.style.${s}`)}</option>)}{value.model && <option value={style}>{t("society.style.custom")}</option>}</select></label>
- {!value.model && <label className="grid grid-cols-[6rem_1fr] items-center gap-3 text-sm">{t("society.create.base")}<select aria-label={t("society.create.base")} className={selectClass} value={value.base} onChange={e => selectBase(e.target.value, style)}>
- {basesForStyle(style).map(b => <option key={b.id} value={b.base}>{b.label}</option>)}
- </select></label>}
- {slots.map(slot => <label key={slot} className="grid grid-cols-[6rem_1fr] items-center gap-3 text-sm">{t(`society.slot.${slot}`)}<select className={selectClass} value={value.parts[slot] ?? ""} onChange={e => {
- const parts = { ...value.parts }; if (e.target.value) parts[slot] = e.target.value; else delete parts[slot]; onChange({ ...value, parts });
- }}><option value="">{t("society.create.none")}</option>{partsForSlot(slot, value.archetype, style, base?.family ?? null, base?.fitSize ?? null).map(p => <option key={p.id} value={p.id}>{p.label}</option>)}</select></label>)}
+ <div className="grid grid-cols-[6rem_1fr] items-center gap-3 text-sm"><span>{t("society.create.style")}</span>
+ <BrandedSelect ariaLabel={t("society.create.style")} className={selectClass} disabled={disabled} value={style}
+ onValueChange={nextStyle => { const first = basesForStyle(nextStyle)[0]; if (first) selectBase(first.base, nextStyle); }}
+ options={[...availableStyles.map(s => ({ value: s, label: t(`society.style.${s}`) })), ...(value.model ? [{ value: style, label: t("society.style.custom") }] : [])]} />
+ </div>
+ {!value.model && <div className="grid grid-cols-[6rem_1fr] items-center gap-3 text-sm"><span>{t("society.create.base")}</span>
+ <BrandedSelect ariaLabel={t("society.create.base")} className={selectClass} disabled={disabled} value={value.base}
+ onValueChange={nextBase => selectBase(nextBase, style)}
+ options={basesForStyle(style).map(b => ({ value: b.base, label: b.label }))} />
+ </div>}
+ {slots.map(slot => <div key={slot} className="grid grid-cols-[6rem_1fr] items-center gap-3 text-sm"><span>{t(`society.slot.${slot}`)}</span>
+ <BrandedSelect ariaLabel={t(`society.slot.${slot}`)} className={selectClass} disabled={disabled} value={value.parts[slot] ?? ""}
+ onValueChange={nextPart => { const parts = { ...value.parts }; if (nextPart) parts[slot] = nextPart; else delete parts[slot]; onChange({ ...value, parts }); }}
+ options={[{ value: "", label: t("society.create.none") }, ...partsForSlot(slot, value.archetype, style, base?.family ?? null, base?.fitSize ?? null).map(p => ({ value: p.id, label: p.label }))]} />
+ </div>)}
<div className="grid grid-cols-2 gap-3">{EDITABLE_CELLS.map(cell => <label key={cell} className="flex items-center justify-between gap-2 text-sm">{t(`society.cell.${cell}`)}<input type="color" value={colors[cell]} onChange={e => onChange({ ...value, palette: { ...value.palette, [cell]: e.target.value } })} className="h-8 w-10 rounded border border-border bg-background" /></label>)}</div>
<label className="text-sm">{t("society.create.height")} <span className="float-right">{(value.heightM ?? base?.heightM ?? 1.75).toFixed(2)} m</span>
<input className="mt-2 w-full" type="range" min={0.6} max={2.4} step={0.05} value={value.heightM ?? base?.heightM ?? 1.75} onChange={e => onChange({ ...value, heightM: Number(e.target.value) })} />
diff --git a/jarvis/ui/web/frontend/src/components/society/companion/CompanionEditor.tsx b/jarvis/ui/web/frontend/src/components/society/companion/CompanionEditor.tsx
index 88c22424dc..01ea59251c 100644
--- a/jarvis/ui/web/frontend/src/components/society/companion/CompanionEditor.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/companion/CompanionEditor.tsx
@@ -1,5 +1,6 @@
import { useT } from "@/i18n";
import { Switch } from "@/components/ui/switch";
+import { BrandedSelect } from "@/components/ui/select";
import { AgentSymbol } from "../AgentSymbol";
import { COMPANION_COLORS, COMPANION_SHAPES, type CompanionAppearance } from "./appearance";
import gigiMark from "@/assets/gigi-companion-avatar.png";
@@ -30,11 +31,11 @@ export function CompanionEditor({ value, onChange, disabled = false, lead = fals
<input type="color" aria-label={t("society.companion.custom_color")} value={value.color} onChange={e => update({ color: e.target.value })} className="h-8 w-10 rounded border border-border bg-background" />
</div>
</div>
- <label className="flex items-center justify-between gap-3 text-sm">{t("society.companion.eyes")}
- <select aria-label={t("society.companion.eyes")} className="rounded-md border border-border bg-background p-2 text-foreground" value={value.eyes} onChange={e => update({ eyes: e.target.value as CompanionAppearance["eyes"] })}>
- <option value="dots">{t("society.companion.dots")}</option><option value="lines">{t("society.companion.lines")}</option>
- </select>
- </label>
+ <div className="flex items-center justify-between gap-3 text-sm"><span>{t("society.companion.eyes")}</span>
+ <BrandedSelect ariaLabel={t("society.companion.eyes")} className="rounded-md border border-border bg-background p-2 text-foreground"
+ disabled={disabled} value={value.eyes} onValueChange={eyes => update({ eyes: eyes as CompanionAppearance["eyes"] })}
+ options={[{ value: "dots", label: t("society.companion.dots") }, { value: "lines", label: t("society.companion.lines") }]} />
+ </div>
</>}
<label className="flex items-center justify-between gap-3 text-sm">{t("society.companion.visible")}
<Switch checked={value.enabled} onCheckedChange={enabled => update({ enabled })} aria-label={t("society.companion.visible")} />
diff --git a/jarvis/ui/web/frontend/src/components/society/mars/MarsNavigationPanel.tsx b/jarvis/ui/web/frontend/src/components/society/mars/MarsNavigationPanel.tsx
index 0ed8f35b0f..8cd0a55ad9 100644
--- a/jarvis/ui/web/frontend/src/components/society/mars/MarsNavigationPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/mars/MarsNavigationPanel.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
+import { BrandedSelect } from "@/components/ui/select";
import { useT } from "@/i18n";
import { MarsApiError } from "./api";
import { cancelMove, clearMoveAttempt, currentRoverRide, latestNavigationRecords, readMoveAttempt, saveMoveAttempt, submitMove, type MoveAttempt } from "./navigationApi";
@@ -53,11 +54,11 @@ export function MarsNavigationPanel({ agentId, active = false }: { agentId: stri
<h3 className="text-sm font-semibold">{t("society.mars.visits")}</h3>
<p className="text-xs text-muted-foreground">{t("society.mars.visit_scope")}</p>
{pending.current && <p className="text-xs text-muted-foreground">{t("society.mars.pending_visit")}: {pending.current.agent_id} · {t(`society.mars.destination_${pending.current.station_id}`)}</p>}
- <label className="grid gap-1 text-sm">{t("society.mars.destination")}
- <select value={destination} disabled={busy || !!pending.current} onChange={(event) => setDestination(event.target.value)} className="rounded border border-border bg-background p-2">
- {VISIT_DESTINATIONS.map((id) => <option key={id} value={id}>{t(`society.mars.destination_${id}`)}</option>)}
- </select>
- </label>
+ <div className="grid gap-1 text-sm"><span>{t("society.mars.destination")}</span>
+ <BrandedSelect value={destination} disabled={busy || !!pending.current} onValueChange={setDestination}
+ ariaLabel={t("society.mars.destination")} className="rounded border border-border bg-background p-2"
+ options={VISIT_DESTINATIONS.map((id) => ({ value: id, label: t(`society.mars.destination_${id}`) }))} />
+ </div>
{destination === "outpost-approach" && <p className="text-xs text-muted-foreground">{t("society.mars.approach_hint")}</p>}
<div className="flex flex-wrap gap-2 text-sm">
<button type="button" disabled={busy || riding || !agentId || (!pending.current && !!inMotion)} onClick={() => void move()} className="rounded border border-border px-2 py-1 disabled:opacity-50">{t(pending.current ? "society.mars.retry_visit" : "society.mars.start_visit")}</button>
diff --git a/jarvis/ui/web/frontend/src/components/society/mars/MarsRoverPanel.tsx b/jarvis/ui/web/frontend/src/components/society/mars/MarsRoverPanel.tsx
index 70f458016c..df7a2870d3 100644
--- a/jarvis/ui/web/frontend/src/components/society/mars/MarsRoverPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/mars/MarsRoverPanel.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
+import { BrandedSelect } from "@/components/ui/select";
import { useT } from "@/i18n";
import { MarsApiError } from "./api";
import { currentRoverRide, type NavigationSnapshot } from "./navigationApi";
@@ -73,22 +74,22 @@ export function MarsRoverPanel({ agentId, active, snapshot, online }: {
{pending.agent_id !== agentId && <p className="text-xs text-muted-foreground">{t("society.mars.rover_pending_other")}</p>}
</div>}
{!ride && <>
- <label className="grid gap-1 text-sm">{t("society.mars.rover_vehicle")}
- <select value={vehicleId} disabled={!enabled || !!pending} onChange={(event) => setVehicleId(event.target.value)} className="rounded border border-border bg-background p-2">
- {WORLD.navigation.rovers.map((row) => <option key={row.id} value={row.id}>{t(`society.mars.rover_vehicle_${row.id}`)}</option>)}
- </select>
- </label>
+ <div className="grid gap-1 text-sm"><span>{t("society.mars.rover_vehicle")}</span>
+ <BrandedSelect value={vehicleId} disabled={!enabled || !!pending} onValueChange={setVehicleId}
+ ariaLabel={t("society.mars.rover_vehicle")} className="rounded border border-border bg-background p-2"
+ options={WORLD.navigation.rovers.map((row) => ({ value: row.id, label: t(`society.mars.rover_vehicle_${row.id}`) }))} />
+ </div>
<button type="button" disabled={!enabled || !!pending || !available} className={buttonClass} onClick={() => void send({ action: "reserve", agent_id: agentId, request_id: crypto.randomUUID(), vehicle_id: vehicleId })}>{t("society.mars.rover_reserve")}</button>
{online && !available && <p role="status" className="text-xs">{t("society.mars.rover_unavailable")}</p>}
</>}
{ride && <>
<p role="status" className="text-sm">{t(`society.mars.rover_state_${ride.state}`)}</p>
{ride.attached && <p className="text-xs text-muted-foreground">{t("society.mars.rover_attached")}</p>}
- <label className="grid gap-1 text-sm">{t("society.mars.rover_route")}
- <select value={selectedDestination} disabled={!enabled || !!pending || !travelReady} onChange={(event) => setDestination(event.target.value)} className="rounded border border-border bg-background p-2">
- {destinations.map((row) => <option key={row.id} value={row.id}>{t(`society.mars.rover_dock_${row.id}`)}</option>)}
- </select>
- </label>
+ <div className="grid gap-1 text-sm"><span>{t("society.mars.rover_route")}</span>
+ <BrandedSelect value={selectedDestination} disabled={!enabled || !!pending || !travelReady} onValueChange={setDestination}
+ ariaLabel={t("society.mars.rover_route")} className="rounded border border-border bg-background p-2"
+ options={destinations.map((row) => ({ value: row.id, label: t(`society.mars.rover_dock_${row.id}`) }))} />
+ </div>
<div className="flex flex-wrap gap-2 text-sm">
{ride.state === "ready_to_board" && <button type="button" disabled={!enabled || !!pending} className={buttonClass} onClick={() => action("board")}>{t("society.mars.rover_board")}</button>}
{travelReady && <button type="button" disabled={!enabled || !!pending || !selectedDestination} className={buttonClass} onClick={() => action("travel")}>{t("society.mars.rover_travel")}</button>}
diff --git a/jarvis/ui/web/frontend/src/components/society/mars/MarsStationPanel.tsx b/jarvis/ui/web/frontend/src/components/society/mars/MarsStationPanel.tsx
index 68dc0a9a12..00e73b4aa2 100644
--- a/jarvis/ui/web/frontend/src/components/society/mars/MarsStationPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/mars/MarsStationPanel.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from "react";
import { useQuery, useQueryClient } from "@tanstack/react-query";
+import { BrandedSelect } from "@/components/ui/select";
import { useLocaleChunk, useT } from "@/i18n";
import { containsCredential } from "./credentialInput";
import { MarsNavigationPanel } from "./MarsNavigationPanel";
@@ -96,12 +97,12 @@ export function MarsStationPanel({ onClose, onOpenAgent }: {
<button type="button" onClick={onClose} className="rounded px-2 py-1 hover:bg-accent">{t("society.mars.close")}</button>
</div>
<p className="text-sm text-muted-foreground">{t("society.mars.station_scope")}</p>
- <label className="grid gap-1 text-sm">
- {t("society.mars.agent")}
- <select value={selectedAgent} disabled={busy || !!attempt.current} onChange={(event) => setAgentId(event.target.value)} className="rounded border border-border bg-background p-2">
- {activeAgents.map((agent) => <option key={agent.agent_id} value={agent.agent_id}>{agent.name}</option>)}
- </select>
- </label>
+ <div className="grid gap-1 text-sm">
+ <span>{t("society.mars.agent")}</span>
+ <BrandedSelect value={selectedAgent} disabled={busy || !!attempt.current} onValueChange={setAgentId}
+ ariaLabel={t("society.mars.agent")} className="rounded border border-border bg-background p-2"
+ options={activeAgents.map((agent) => ({ value: agent.agent_id, label: agent.name }))} />
+ </div>
{!activeAgents.length && <p role="status" className="text-sm">{t(roster.isError ? "society.mars.offline" : "society.mars.no_agents")}</p>}
<label className="grid gap-1 text-sm">
{t("society.mars.draft")}
diff --git a/jarvis/ui/web/frontend/src/components/society/mars/MarsWorldStage.test.tsx b/jarvis/ui/web/frontend/src/components/society/mars/MarsWorldStage.test.tsx
index 62a2d4c3b0..d027514a85 100644
--- a/jarvis/ui/web/frontend/src/components/society/mars/MarsWorldStage.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/mars/MarsWorldStage.test.tsx
@@ -40,7 +40,10 @@ function navigation(commands = [record]) {
graph_signature: "a".repeat(64), seq: 1, commands, occupancies: [] });
}
function stage() { return document.querySelector("[data-mars-world]") as HTMLElement; }
-function start() { fireEvent.change(screen.getByRole("combobox", { name: "society.mars.follow_agent" }), { target: { value: "one" } }); }
+function start() {
+ fireEvent.click(screen.getByRole("combobox", { name: "society.mars.follow_agent" }));
+ fireEvent.click(screen.getByRole("option", { name: "Worker" }));
+}
function saved() { return JSON.parse(localStorage.getItem(VIEW_KEY) ?? "null"); }
beforeEach(() => {
localStorage.clear();
diff --git a/jarvis/ui/web/frontend/src/components/society/mars/MarsWorldStage.tsx b/jarvis/ui/web/frontend/src/components/society/mars/MarsWorldStage.tsx
index ff3aba73b8..25df4fcc3e 100644
--- a/jarvis/ui/web/frontend/src/components/society/mars/MarsWorldStage.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/mars/MarsWorldStage.tsx
@@ -6,6 +6,7 @@ import { useCanvasAwake } from "@/hooks/useCanvasAwake";
import { useWebglSurface } from "@/hooks/useWebglSurface";
import { useWebglSupported } from "@/lib/graphDimension";
import { useLocaleChunk, useT } from "@/i18n";
+import { BrandedSelect } from "@/components/ui/select";
import { CAMERA_FOV, fitWorldBounds } from "./camera";
import { MarsScene, type CameraMode } from "./MarsScene";
import { WORLD, WORLD_BOUNDS } from "./world";
@@ -119,17 +120,14 @@ export function MarsWorldStage({ topRight, onOpenLedger, onSelectAgent, stationP
<div className="mars-actions">
<button type="button" aria-pressed={mode === "overview"} onClick={() => choose("overview")}>{t("society.mars.overview")}</button>
<button type="button" aria-pressed={mode === "outpost"} onClick={() => choose("outpost")}>{t("society.mars.outpost")}</button>
- <select aria-label={t("society.mars.viewpoint")} value={viewpoint} onChange={(event) => {
- setViewpoint(event.target.value as Viewpoint); choose("outpost");
- }}>
- {VIEWPOINTS.map((value) => <option key={value} value={value}>{t(`society.mars.view_${value}`)}</option>)}
- </select>
+ <BrandedSelect ariaLabel={t("society.mars.viewpoint")} value={viewpoint} className="min-w-36"
+ onValueChange={(value) => { setViewpoint(value as Viewpoint); choose("outpost"); }}
+ options={VIEWPOINTS.map((value) => ({ value, label: t(`society.mars.view_${value}`) }))} />
<button type="button" aria-pressed={mode === "player"} onClick={() => choose("player")}>{t("society.mars.walk")}</button>
- <select aria-label={t("society.mars.follow_agent")} value={mode === "follow" ? followAgentId ?? "" : ""} disabled={!followAvailable}
- onChange={(event) => { if (event.target.value) startFollow(event.target.value); else orbit(); }}>
- <option value="">{t("society.mars.follow_agent")}</option>
- {followCandidates.map((row) => <option key={row.agent_id} value={row.agent_id}>{agentNames.get(row.agent_id)}</option>)}
- </select>
+ <BrandedSelect ariaLabel={t("society.mars.follow_agent")} value={mode === "follow" ? followAgentId ?? "" : ""}
+ disabled={!followAvailable} className="min-w-36"
+ onValueChange={(value) => { if (value) startFollow(value); else orbit(); }}
+ options={[{ value: "", label: t("society.mars.follow_agent") }, ...followCandidates.map((row) => ({ value: row.agent_id, label: agentNames.get(row.agent_id) ?? row.agent_id }))]} />
{mode === "follow" && <button type="button" onClick={orbit}>{t("society.mars.stop_follow")}</button>}
<button type="button" aria-pressed={neutral} onClick={() => setNeutral((value) => !value)}>{t("society.mars.neutral")}</button>
<button type="button" aria-pressed={shadows} onClick={() => setShadows((value) => !value)}>{t("society.mars.shadows")}</button>
diff --git a/jarvis/ui/web/frontend/src/components/ui/no-native-selects.test.ts b/jarvis/ui/web/frontend/src/components/ui/no-native-selects.test.ts
index 79c5ca71bf..45d41ea0d4 100644
--- a/jarvis/ui/web/frontend/src/components/ui/no-native-selects.test.ts
+++ b/jarvis/ui/web/frontend/src/components/ui/no-native-selects.test.ts
@@ -47,5 +47,5 @@ describe("dropdown design guard", () => {
violations,
"Use BrandedSelect or Combobox so the opened menu follows the app theme.",
).toEqual([]);
- });
+ }, 20_000);
});
diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.antigravity.test.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.antigravity.test.tsx
index 786fd3d843..619c246682 100644
--- a/jarvis/ui/web/frontend/src/views/ApiKeysView.antigravity.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/ApiKeysView.antigravity.test.tsx
@@ -233,7 +233,7 @@ describe("ApiKeysView — Antigravity (Google subscription) OAuth card", () => {
await waitFor(() =>
// The redesign shortens the card title to just "Antigravity"; the
// subscription billing now lives in the billing badge, not the title.
- expect(screen.getByText("Antigravity")).toBeTruthy(),
+ expect(screen.getAllByText("Antigravity").length).toBeGreaterThan(0),
);
// The "Set active" control now lives ON the subscription card, so there is
@@ -298,7 +298,7 @@ describe("ApiKeysView — Antigravity (Google subscription) OAuth card", () => {
expect((connectBtn.closest("button") as HTMLButtonElement).disabled).toBe(true);
// The install hint sits in the row body; open the row first. The row
// has no login yet, so the click only opens it — no switch.
- fireEvent.click(screen.getByText("Antigravity"));
+ fireEvent.click(screen.getAllByText("Antigravity")[0]);
expect(
await screen.findByText("Install Antigravity or the Gemini CLI before connecting."),
).toBeTruthy();
diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.computer-use.test.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.computer-use.test.tsx
deleted file mode 100644
index 95158c020d..0000000000
--- a/jarvis/ui/web/frontend/src/views/ApiKeysView.computer-use.test.tsx
+++ /dev/null
@@ -1,245 +0,0 @@
-/**
- * Component tests for the dedicated "Computer-Use" tab on the API-Keys
- * screen.
- *
- * Computer-Use (CU — the loop that reads the screen and clicks) used to be
- * hard-locked to the active Brain provider. This tab is an OVERLAY over the
- * SAME brain-provider cards (Claude/OpenAI/OpenRouter/Gemini) shown on the
- * Brain tab, but "Set active" here flips `computer_use_active` via
- * `POST /api/computer-use/switch` — a SEPARATE selection from `brain.primary`,
- * independent of the Brain tab's `active`. The CU provider is GLOBAL, so the
- * tab renders identically in Pipeline and Realtime mode.
- *
- * These tests pin: (1) the tab exists in both modes, (2) it renders the
- * brain-provider cards, (3) activating a card calls
- * `switchComputerUseProvider` with the BRAIN id (never a realtime id) and
- * flips `computer_use_active` without touching the Brain tab's `active` or
- * calling `/api/brain/switch`, (4) the CU-model picker renders under the tab,
- * keyed by the brain id.
- */
-import { afterEach, describe, expect, it, vi } from "vitest";
-import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
-
-// ApiKeysView reads the live `[voice].mode` (for the Pipeline|Realtime mode
-// switch) via useVoiceMode, which needs a QueryClientProvider — mocked here
-// exactly like the other ApiKeysView.*.test.tsx files. realtimeAvailable=true
-// so clicking the Realtime segment actually switches the tab set.
-vi.mock("@/hooks/useVoiceMode", () => ({
- useVoiceMode: () => ({
- mode: "pipeline",
- realtimeAvailable: true,
- setMode: vi.fn(),
- isLoading: false,
- isSaving: false,
- }),
-}));
-
-// Stub CuModelSelector so this test asserts exactly which provider id the CU
-// tab forwards to it, without pulling in its own model-catalog network calls
-// (covered by CuModelSelector's own tests).
-vi.mock("@/components/CuModelSelector", () => ({
- CuModelSelector: ({ providerId }: { providerId: string }) => (
- <div
- data-testid={`cu-model-selector-stub-${providerId}`}
- data-provider-id={providerId}
- />
- ),
-}));
-
-function brainProvider(overrides: Record<string, unknown> = {}) {
- return {
- id: "openai",
- label: "OpenAI",
- tier: "brain",
- auth_mode: "api_key",
- secret_keys: ["OPENAI_API_KEY"],
- secrets_set: { OPENAI_API_KEY: true },
- dashboard_url: null,
- login_cli: null,
- install_hint: null,
- credential_path_hint: null,
- configured: true,
- active: false,
- brain_switchable: true,
- cli_installed: null,
- credential_help: null,
- signup_url: null,
- billing: "api",
- recommended_model: null,
- alt_credential: null,
- computer_use_active: false,
- ...overrides,
- };
-}
-
-function realtimeProvider(overrides: Record<string, unknown> = {}) {
- return {
- id: "openai-realtime",
- label: "OpenAI Realtime",
- tier: "realtime",
- auth_mode: "api_key",
- secret_keys: ["OPENAI_API_KEY"],
- secrets_set: { OPENAI_API_KEY: true },
- dashboard_url: null,
- login_cli: null,
- install_hint: null,
- credential_path_hint: null,
- configured: true,
- active: true,
- brain_switchable: true,
- cli_installed: null,
- credential_help: null,
- signup_url: null,
- billing: "api",
- alt_credential: null,
- ...overrides,
- };
-}
-
-let providersState: Array<Record<string, unknown>> = [];
-
-function jsonResponse(body: unknown, status = 200): Response {
- return {
- ok: status >= 200 && status < 300,
- status,
- statusText: status >= 200 && status < 300 ? "OK" : "ERR",
- json: async () => body,
- text: async () => JSON.stringify(body),
- } as Response;
-}
-
-function installFetchMock() {
- const calls: { url: string; method: string; body: unknown }[] = [];
- const fetchMock = vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {
- const url = String(input);
- const method = (init?.method ?? "GET").toUpperCase();
- let body: unknown = null;
- if (typeof init?.body === "string") {
- try {
- body = JSON.parse(init.body);
- } catch {
- body = init.body;
- }
- }
- calls.push({ url, method, body });
-
- if (url.startsWith("/api/providers/section-health")) {
- return jsonResponse({ sections: {}, checked_at: 0, cached: false });
- }
- if (url === "/api/computer-use/switch" && method === "POST") {
- const providerId = (body as { provider?: string })?.provider ?? "";
- const spec = providersState.find((p) => p.id === providerId);
- if (!spec || !spec.configured) {
- return jsonResponse({ detail: "no key" }, 409);
- }
- providersState = providersState.map((p) => ({
- ...p,
- computer_use_active: p.tier === "brain" && p.id === providerId,
- }));
- return jsonResponse({
- ok: true,
- active: providerId,
- persisted: true,
- restart_required: false,
- });
- }
- if (url.startsWith("/api/providers")) {
- return jsonResponse({ providers: providersState });
- }
- throw new Error(`unexpected fetch ${url} (${method})`);
- });
- (globalThis as unknown as { fetch: typeof fetch }).fetch =
- fetchMock as unknown as typeof fetch;
- return { calls };
-}
-
-import { ApiKeysView } from "@/views/ApiKeysView";
-
-afterEach(() => {
- cleanup();
- vi.restoreAllMocks();
-});
-
-describe("ApiKeysView — Computer-Use tab", () => {
- it("appears in both Pipeline and Realtime mode", async () => {
- providersState = [brainProvider(), realtimeProvider()];
- installFetchMock();
- render(<ApiKeysView />);
-
- expect(await screen.findByRole("tab", { name: /tool model/i })).toBeTruthy();
-
- fireEvent.click(screen.getByRole("button", { name: /^realtime/i }));
-
- expect(await screen.findByRole("tab", { name: /tool model/i })).toBeTruthy();
- expect(screen.getByRole("tab", { name: /^realtime/i })).toBeTruthy();
- });
-
- it("renders the 4 brain-provider cards, same style as the Brain tab", async () => {
- providersState = [
- brainProvider({ id: "claude-api", label: "Claude" }),
- brainProvider({ id: "openai", label: "OpenAI", active: true }),
- brainProvider({ id: "openrouter", label: "OpenRouter" }),
- brainProvider({ id: "gemini", label: "Gemini", configured: false }),
- ];
- installFetchMock();
- render(<ApiKeysView />);
-
- fireEvent.click(await screen.findByRole("tab", { name: /tool model/i }));
-
- expect(await screen.findByText("Claude")).toBeTruthy();
- expect(screen.getByText("OpenAI")).toBeTruthy();
- expect(screen.getByText("OpenRouter")).toBeTruthy();
- expect(screen.getByText("Gemini")).toBeTruthy();
- });
-
- it("'Set active' calls switchComputerUseProvider with the brain id and flips computer_use_active independently of the Brain tab's active", async () => {
- providersState = [
- brainProvider({ id: "claude-api", label: "Claude", configured: true, active: false }),
- brainProvider({ id: "openai", label: "OpenAI", active: true, computer_use_active: true }),
- ];
- const { calls } = installFetchMock();
- render(<ApiKeysView />);
-
- fireEvent.click(await screen.findByRole("tab", { name: /tool model/i }));
- const claudeCard = (await screen.findByText("Claude")).closest("li") as HTMLElement | null;
- if (!claudeCard) throw new Error("Claude card not found");
- fireEvent.click(within(claudeCard).getByRole("radio"));
-
- // The backend call carries the BRAIN id, never a realtime id.
- await waitFor(() =>
- expect(
- calls.some(
- (c) =>
- c.url === "/api/computer-use/switch" &&
- c.method === "POST" &&
- (c.body as { provider?: string })?.provider === "claude-api",
- ),
- ).toBe(true),
- );
-
- // The CU tab's own radio flips to Claude after the refetch.
- await waitFor(() => {
- const card = screen.getByText("Claude").closest("li") as HTMLElement;
- expect(within(card).getByRole("radio")).toHaveProperty("checked", true);
- });
-
- // The Brain tab's real `active` (brain.primary) is untouched — still
- // OpenAI — and no `/api/brain/switch` call was ever made.
- fireEvent.click(screen.getByRole("tab", { name: /^brain$/i }));
- const brainOpenAiCard = screen.getByText("OpenAI").closest("li") as HTMLElement;
- expect(within(brainOpenAiCard).getByRole("radio")).toHaveProperty("checked", true);
- expect(calls.some((c) => c.url.startsWith("/api/brain/switch"))).toBe(false);
- });
-
- it("renders the CU-model picker under the Computer-Use tab, keyed by the brain id", async () => {
- providersState = [
- brainProvider({ id: "openai", label: "OpenAI", active: true, computer_use_active: true }),
- ];
- installFetchMock();
- render(<ApiKeysView />);
-
- fireEvent.click(await screen.findByRole("tab", { name: /tool model/i }));
-
- expect(await screen.findByTestId("cu-model-selector-stub-openai")).toBeTruthy();
- });
-});
diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.recommended-setup.test.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.recommended-setup.test.tsx
deleted file mode 100644
index b4ceb93fe4..0000000000
--- a/jarvis/ui/web/frontend/src/views/ApiKeysView.recommended-setup.test.tsx
+++ /dev/null
@@ -1,136 +0,0 @@
-/**
- * Component tests for the "Personal recommendation" panel in the voice-engine
- * scrollable engine context (RecommendedSetupPanel).
- *
- * The panel is a presentation-only hint (AP-21) for the REALTIME tab set: it
- * lists the maintainer's pick for Realtime / Tool Model / Jarvis-Agents, so it
- * renders ONLY while the Realtime tab set is being viewed (maintainer feedback
- * 2026-07-17: next to the Pipeline tabs it would point at tabs that are not on
- * screen). Each row navigates to the tab it names — VIEW-only navigation that
- * must never persist `[voice].mode` (only the key-gated segmented switch does).
- */
-import { afterEach, describe, expect, it, vi } from "vitest";
-import { cleanup, fireEvent, render, screen, within } from "@testing-library/react";
-
-// Mock the data hooks so the view renders deterministically, without a
-// network round-trip (same pattern as ApiKeysView.two-mode.test.tsx).
-vi.mock("@/hooks/useProviders", () => ({
- sectionHealthForSubject: (
- health: { subject_id?: string } | undefined,
- subjectId?: string,
- ) => (subjectId && health?.subject_id === subjectId ? health : undefined),
- useProviders: () => ({
- providers: [],
- loading: false,
- error: null,
- refetch: vi.fn(),
- setActiveOptimistic: vi.fn(),
- }),
- useSectionHealth: () => ({ health: {} }),
-}));
-
-const putVoiceMode = vi.fn();
-vi.mock("@/hooks/useVoiceMode", () => ({
- useVoiceMode: () => ({
- mode: "pipeline",
- realtimeAvailable: true,
- statusKnown: true,
- sessionActive: false,
- activeSessionMode: null,
- activeSessionProvider: "",
- activeSessionModel: "",
- transitioning: false,
- setMode: putVoiceMode,
- isLoading: false,
- isSaving: false,
- }),
-}));
-
-import { ApiKeysView } from "@/views/ApiKeysView";
-
-afterEach(() => {
- cleanup();
- vi.clearAllMocks();
-});
-
-/** Switch the VIEW to the Realtime tab set via the engine segment. */
-function openRealtimeView() {
- fireEvent.click(screen.getByRole("button", { name: /^realtime/i }));
-}
-
-function panel() {
- return within(screen.getByTestId("recommended-setup-panel"));
-}
-
-describe("ApiKeysView recommended-setup panel", () => {
- it("stays hidden while the Pipeline tab set is viewed", () => {
- render(<ApiKeysView />);
- expect(screen.queryByTestId("recommended-setup-panel")).toBeNull();
- });
-
- it("lists the three maintainer picks once the Realtime tab set is viewed", () => {
- render(<ApiKeysView />);
- openRealtimeView();
- expect(
- screen
- .getByTestId("api-keys-provider-scroll")
- .contains(screen.getByTestId("recommended-setup-panel")),
- ).toBe(true);
- expect(panel().getByText("OpenAI Realtime")).toBeTruthy();
- expect(panel().getByText("Gemini 3.5 Flash")).toBeTruthy();
- expect(panel().getByText("ChatGPT or Claude Max subscription")).toBeTruthy();
- });
-
- it("keeps the segment buttons uniquely addressable (no /^realtime/i collision)", () => {
- render(<ApiKeysView />);
- openRealtimeView();
- // The two-mode tests select the engine segment via /^realtime/i; the
- // recommendation rows must not shadow that accessible name.
- expect(screen.getAllByRole("button", { name: /^realtime/i })).toHaveLength(1);
- });
-
- it("opens the Tool Model tab from its recommendation row", () => {
- render(<ApiKeysView />);
- openRealtimeView();
- // Rows are addressed by stable testids, not their labels — the tab labels
- // are i18n strings other work renames (e.g. Jarvis-Agents -> {name}-Agents).
- fireEvent.click(screen.getByTestId("reco-row-computer-use"));
- expect(
- (screen.getByRole("tab", { name: /tool model/i }) as HTMLElement).getAttribute(
- "aria-selected",
- ),
- ).toBe("true");
- });
-
- it("opens the agents tab from its recommendation row", () => {
- render(<ApiKeysView />);
- openRealtimeView();
- fireEvent.click(screen.getByTestId("reco-row-subagents"));
- // Label-agnostic: both "Jarvis-Agents" and a "{name}-Agents" rebrand end
- // in "Agents", and no other tab does.
- expect(
- (screen.getByRole("tab", { name: /agents$/i }) as HTMLElement).getAttribute(
- "aria-selected",
- ),
- ).toBe("true");
- });
-
- it("returns to the Realtime tab from its row WITHOUT persisting voice mode", () => {
- render(<ApiKeysView />);
- openRealtimeView();
- // Wander off to another tab of the realtime set first.
- fireEvent.click(screen.getByRole("tab", { name: /tool model/i }));
- putVoiceMode.mockClear();
-
- fireEvent.click(screen.getByTestId("reco-row-realtime"));
-
- // The Realtime tab is selected again…
- expect(
- (screen.getByRole("tab", { name: /realtime/i }) as HTMLElement).getAttribute(
- "aria-selected",
- ),
- ).toBe("true");
- // …and `[voice].mode` stays untouched — only the segmented switch persists.
- expect(putVoiceMode).not.toHaveBeenCalled();
- });
-});
diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.unified-model.test.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.unified-model.test.tsx
new file mode 100644
index 0000000000..64305670ed
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/ApiKeysView.unified-model.test.tsx
@@ -0,0 +1,49 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+
+const setVoiceMode = vi.fn();
+
+vi.mock("@/hooks/useProviders", () => ({
+ sectionHealthForSubject: () => undefined,
+ useProviders: () => ({
+ providers: [],
+ loading: false,
+ error: null,
+ refetch: vi.fn(),
+ setActiveOptimistic: vi.fn(),
+ }),
+ useSectionHealth: () => ({ health: {} }),
+}));
+
+vi.mock("@/hooks/useVoiceMode", () => ({
+ useVoiceMode: () => ({
+ mode: "pipeline",
+ realtimeAvailable: true,
+ setMode: setVoiceMode,
+ isLoading: false,
+ isSaving: false,
+ }),
+}));
+
+import { ApiKeysView } from "@/views/ApiKeysView";
+
+afterEach(() => {
+ cleanup();
+ vi.clearAllMocks();
+});
+
+describe("ApiKeysView model selection", () => {
+ it("uses the active voice engine without a separate computer-use model tab", () => {
+ render(<ApiKeysView />);
+
+ expect(screen.getByRole("tab", { name: /^brain$/i })).toBeTruthy();
+ expect(screen.queryByRole("tab", { name: /computer.use|tool model/i })).toBeNull();
+
+ fireEvent.click(screen.getByRole("button", { name: /^realtime/i }));
+
+ expect(screen.getByRole("tab", { name: /^realtime$/i })).toBeTruthy();
+ expect(screen.queryByRole("tab", { name: /computer.use|tool model/i })).toBeNull();
+ expect(screen.queryByTestId("recommended-setup-panel")).toBeNull();
+ expect(setVoiceMode).toHaveBeenCalledWith("realtime");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/views/society/SocietyView.test.tsx b/jarvis/ui/web/frontend/src/views/society/SocietyView.test.tsx
index a75e88e12a..e7c77b015d 100644
--- a/jarvis/ui/web/frontend/src/views/society/SocietyView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/society/SocietyView.test.tsx
@@ -107,13 +107,12 @@ it("navigates back through the window caption instead of a sections toggle", ()
expect(screen.getByTestId("mode-switch")).toBeTruthy();
});
-it("requests fullscreen for Map and leaves it on Escape", async () => {
+it("leaves Map on Escape without requesting native fullscreen in a browser", async () => {
render(<SocietyView />);
fireEvent.click(screen.getByRole("tab", { name: "society.world.mode_map" }));
await screen.findByTestId("map");
- expect(setMapFullscreen).toHaveBeenLastCalledWith(true);
+ expect(setMapFullscreen).not.toHaveBeenCalledWith(true);
fireEvent.keyDown(document, { key: "Escape" });
- expect(setMapFullscreen).toHaveBeenLastCalledWith(false);
expect(screen.queryByTestId("map")).toBeNull();
});