Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
gui tests: the sidebar lists expect Masking's tab, and Built-in wheels to rows it can reach (#3498)
yetone95a4180c0b0a
diff --git a/internal/gui/tests/builtins.test.cjs b/internal/gui/tests/builtins.test.cjsindex 3f89c1abb..76dbd25ca 100644--- a/internal/gui/tests/builtins.test.cjs+++ b/internal/gui/tests/builtins.test.cjs@@ -111,7 +111,8 @@ function server(lang, posts, broken) {// the pages' tabs shown, the page shownconst tabs = (page) => page.evaluate(() => [...document.querySelectorAll("#nav button[data-view]")].filter((b) => !b.hidden && b.offsetParent && getComputedStyle(b).display !== "none").map((b) => b.dataset.view));const viewShown = (page) => page.evaluate(() => [...document.querySelectorAll("main.view")].filter((v) => !v.hidden).map((v) => v.id));-const KEPT = ["agents", "providers", "routing", "gateway", "usage", "plugins"];+// the tabs with Sessions and Library off, the preset's masking on+const KEPT = ["agents", "providers", "routing", "gateway", "usage", "masking", "plugins"];const rowsOf = (page) => page.evaluate(() => [...document.querySelectorAll("#builtinList .feat-row")].map((r) => {const b = r.querySelector('[role="switch"]');return { id: r.dataset.id, name: r.querySelector(".name").textContent, on: b.getAttribute("aria-checked"), disabled: b.disabled, why: r.querySelector(".feat-why")?.textContent || "" };@@ -206,20 +207,29 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",assert.deepEqual(posts, [["library", true]], where);if (width >= 800) assert.deepEqual(await tabs(page), ["agents", "library", ...KEPT.slice(1)], `${where}: Library back`);assert.deepEqual(await viewShown(page), ["view-plugins"], `${where}: Plugins stays`);+ // Observability's, Routing's and Usage's rows can be below the fold:+ // the reader scrolls to them with the wheel, since the page puts back+ // a scroll that isn't the reader's (scrollOnPurpose), a click's own+ // too. The wheel turns over what shows of the list (its top may have+ // scrolled away, and a wheel there scrolls nothing), as often as the+ // row needs: at 420 the rows wrap and Usage's is more than one turn+ // down+ const below = (id) => page.evaluate((id) => { const r = document.querySelector(`#builtinList [data-id="${id}"] [role="switch"]`).getBoundingClientRect(), foot = document.querySelector("footer.foot"); return r.bottom > Math.min(document.getElementById("view-plugins").getBoundingClientRect().bottom, foot && foot.offsetParent ? foot.getBoundingClientRect().top : Infinity); }, id);+ const wheelTo = async (id) => {+ for (let i = 0; i < 5 && await below(id); i++) {+ const at = await page.evaluate(() => { const l = document.getElementById("builtinList").getBoundingClientRect(), v = document.getElementById("view-plugins").getBoundingClientRect(); return { x: l.x + 20, y: (Math.max(l.top, v.top) + Math.min(l.bottom, v.bottom)) / 2 }; });+ await page.mouse.move(at.x, at.y);+ await page.mouse.wheel(0, 400);+ await page.waitForFunction(() => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r(true)))));+ }+ assert.equal(await below(id), false, `${where}: ${id}'s row reached by the wheel`);+ };// and Observability: its Settings tab is back+ await wheelTo("otel");await page.locator('#builtinList [data-id="otel"] [role="switch"]').click();await page.waitForSelector('#builtinList [data-id="otel"] [aria-checked="true"]');assert.ok(await page.locator("#setTab-otel").evaluate((b) => getComputedStyle(b).display !== "none"), `${where}: Observability back`);// Routing switched off: its tab and the panel's go, the page stays.- // Its row and Usage's can be below the fold: the reader scrolls to- // them with the wheel, since the page puts back a scroll that isn't- // the reader's (scrollOnPurpose), a click's own too- const wheelTo = async (id) => {- const list = await page.locator("#builtinList").boundingBox();- await page.mouse.move(list.x + 20, list.y + 20);- await page.mouse.wheel(0, 400);- await page.waitForFunction((id) => { const r = document.querySelector(`#builtinList [data-id="${id}"] [role="switch"]`).getBoundingClientRect(), foot = document.querySelector("footer.foot"); return r.bottom <= Math.min(document.getElementById("view-plugins").getBoundingClientRect().bottom, foot && foot.offsetParent ? foot.getBoundingClientRect().top : Infinity); }, id);- };await wheelTo("routing");await page.locator('#builtinList [data-id="routing"] [role="switch"]').click();await page.waitForSelector('#builtinList [data-id="routing"] [aria-checked="false"]');diff --git a/internal/gui/tests/gateway-mode.test.cjs b/internal/gui/tests/gateway-mode.test.cjsindex a15233b5d..219e5648a 100644--- a/internal/gui/tests/gateway-mode.test.cjs+++ b/internal/gui/tests/gateway-mode.test.cjs@@ -84,7 +84,7 @@ const L = {};const HIDDEN = ["agents", "library"];// in the order the pages are grouped in (work, models, insights, extend)-const KEPT = ["sessions", "providers", "routing", "gateway", "usage", "plugins"];+const KEPT = ["sessions", "providers", "routing", "gateway", "usage", "masking", "plugins"];// the tabs shown, the page shownconst tabs = (page) => page.evaluate(() => [...document.querySelectorAll("#nav button[data-view]")].filter((b) => !b.hidden && b.offsetParent).map((b) => b.dataset.view));@@ -154,7 +154,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",await clickStill(page, "#gatewayModeSegs .opt:nth-child(4)", `${where}: Off`);await page.waitForFunction(() => !document.querySelector('#nav button[data-view="agents"]').hidden);assert.deepEqual(posts.filter((p) => p[0] === "gateway-mode"), [["gateway-mode", "off"]], where);- assert.deepEqual(await tabs(page), ["agents", "sessions", "library", "providers", "routing", "gateway", "usage", "plugins"], `${where}: off`);+ assert.deepEqual(await tabs(page), ["agents", "sessions", "library", "providers", "routing", "gateway", "usage", "masking", "plugins"], `${where}: off`);assert.deepEqual(await viewShown(page), ["view-settings"], `${where}: Settings stays`);assert.deepEqual(await agentRows(page), [true, true, true, true, true], `${where}: rows back`);assert.doesNotMatch(await page.locator("#gatewayModeSub").textContent(), new RegExp(L[lang].noAgents), where);@@ -187,7 +187,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",await page.route("**/*", server(lang, [], { web, gateway: false, agents: true }));await page.goto("http://magpie.test/");await page.waitForSelector("#nav button.on");- assert.deepEqual(await tabs(page), ["agents", "sessions", "library", "providers", "routing", "gateway", "usage", "plugins"], where);+ assert.deepEqual(await tabs(page), ["agents", "sessions", "library", "providers", "routing", "gateway", "usage", "masking", "plugins"], where);assert.deepEqual(await viewShown(page), ["view-agents"], where);await page.locator("#prefs").click();await page.waitForSelector("#langPick span");diff --git a/internal/gui/tests/sidebar.test.cjs b/internal/gui/tests/sidebar.test.cjsindex 0b2a06325..9b7215a49 100644--- a/internal/gui/tests/sidebar.test.cjs+++ b/internal/gui/tests/sidebar.test.cjs@@ -60,7 +60,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",assert.equal(await page.locator(".top #nav").count(), 0, "and not in the header");assert.deepEqual(await page.locator("#nav .nav-gl:visible").allTextContents(), w.groups);assert.deepEqual(await page.locator("#nav button[data-view]").evaluateAll((bs) => bs.map((b) => b.dataset.view)),- ["agents", "sessions", "library", "providers", "routing", "gateway", "usage", "plugins"]);+ ["agents", "sessions", "library", "providers", "routing", "gateway", "usage", "masking", "plugins"]);assert.ok(await page.locator("#side .side-foot #prefs").isVisible(), "Settings at the sidebar's foot");assert.equal((await page.locator("#prefs .side-l").textContent()).trim(), w.settings);// no page's name or group cut, and nothing scrolls sideways