From 1024 points wide (SIDE_AT) the window lays its pages down the left as a Mac app's sidebar: Work (Agents, Sessions, Library), Models (Providers, Routing, Gateway), Insights (Usage), Extend (Plugins), with Settings and the gateway's address at the foot. The open page's own tabs (Usage, Library, Plugins, Settings) are listed under it, opening and folding on an iOS-like spring, and the page's strip is hidden. The header becomes a breadcrumb, and pages whose head held only tools have them in the title bar. Graphite: the open page is in the text's ink, not purple. A pressed row darkens and never shrinks. The selection under the tabs sets off as the row is pressed, on a 0.3s curve (it felt behind the finger), and is the list's only shape: a sub-row hovered or pressed has no ground of its own, which showed a block under the finger before the selection slid there. The page's tab is clicked at once, so what is typed next goes to it. The title bar's button (or ⌃⌘S, Ctrl+Shift+S), there at every width, picks the sidebar or the header's tabs. The choice is kept in localStorage magpie.navLayout (side or top) at every width, so it is laid out from the first frame; picked in a narrow window the sidebar is 184 points under 860. The two trade places in a view transition: the sidebar slides, each tab flies to its place, and the page slides as one. Without view transitions or under reduced motion, the change is at once. With nothing picked, narrower than 1024 the page beside a sidebar would be narrower than Usage's requests table needs, so the header's tabs come back. A resize drops what a click held (heldWidth). Usage's KPI strip goes two to a line by the room the page gives it (a container query), and Japanese counts wrap there. Tests whose window is 1024+ were updated for the sidebar, and docs/subsystems/gui-shell.md says how it works. Run: sidebar.test.cjs and side-toggle.test.cjs 16/16 in chromium and webkit, in en, zh, zh-TW, ja and de. Each was broken by hand (press shrink, address cut, press glide, sub-row ground, view transition, kept choice) and went red. Every page at 560 points with the sidebar picked, zh and de, both engines: nothing scrolls sideways. session-identity's ledger row sits under the footer beside the sidebar; WebKit's click doesn't scroll to it, so the test wheels it up first. Animation frames were checked from a recorded video. The 105 affected GUI files in both engines; their reds were rerun alone and fixed (filter-ime: the sub-row's click now at once; session-identity, above) or fail the same on main (tray-logos). The full GUI suite in chromium, on the rebase ontod5cae267a, was cut short at 352 tests on the owner's "ship": 6 reds (account-alias, account-models, codex-auto-review, codex-credits, context-text) each pass alone, here and on maind5cae267a, so they are timing under the full run's load and are to be filed. After rebasing ontoe4e22b23e: sidebar, side-toggle, session-identity, filter-ime, library-instr-busy, usage-speed-count and view-scrollbar, 50/50 in chromium and webkit. go build ./... passes.
78 lines
4.2 KiB
JavaScript
78 lines
4.2 KiB
JavaScript
const assert = require("node:assert/strict");
|
|
const { test } = require("node:test");
|
|
const { chromium, webkit } = require("playwright");
|
|
const { fixture } = require("./fixtures/caller-keys.cjs");
|
|
|
|
// coeo91 on Discord: the LAN address picked as Gateway's Base URL went back
|
|
// to 127.0.0.1 after a restart or an update. The address and the gateway key
|
|
// picked in Connect, and the address picked under Share on local network,
|
|
// are kept across reloads; an address the machine doesn't have right now
|
|
// (the network not up yet after a start) shows this computer's, and the
|
|
// pick comes back with it.
|
|
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
|
|
for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) {
|
|
for (const width of [1100, 420]) {
|
|
test(`${engine} ${lang} ${width}: the address and key picked in Connect are kept`, async (t) => {
|
|
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
|
|
t.after(() => browser.close());
|
|
const page = await (await browser.newContext({ viewport: { width, height: 800 }, reducedMotion: "reduce" })).newPage();
|
|
page.setDefaultTimeout(6000);
|
|
const errors = [];
|
|
page.on("pageerror", (e) => errors.push(e.message));
|
|
const lanURLs = ["http://192.168.1.10:3999", "http://10.0.0.10:3999"];
|
|
await page.route("**/*", fixture(lang, "light", [], { lan: true, lanURLs }));
|
|
const pick = async (button, text) => {
|
|
await page.locator(button).click();
|
|
await page.locator(".proto-menu .pm-item", { hasText: text }).click();
|
|
await page.locator(".proto-menu").waitFor({ state: "detached" });
|
|
};
|
|
const shown = (sel) => page.locator(sel).textContent();
|
|
const open = async () => {
|
|
await page.goto("http://magpie.test/?view=gateway");
|
|
await page.locator("#connect .val code").first().waitFor();
|
|
};
|
|
|
|
await open();
|
|
await pick("#connectAddress", "10.0.0.10");
|
|
await page.waitForFunction(() => document.querySelector("#connectAddress")?.textContent.includes("10.0.0.10"));
|
|
await page.locator("#connectKey").waitFor();
|
|
await pick("#connectKey", "Server");
|
|
await page.waitForFunction(() => document.querySelector("#connectKey")?.textContent.includes("Server"));
|
|
|
|
// a restart or an update opens the page again
|
|
await open();
|
|
await page.waitForFunction(() => document.querySelector("#connectKey")?.textContent.includes("Server"));
|
|
assert.match(await shown("#connectAddress"), /10\.0\.0\.10:3999\/v1/);
|
|
assert.match(await shown("#connectKey"), /Server/);
|
|
await page.waitForFunction(() => document.querySelector("#connect pre.snip")?.textContent.includes("fixture-server"));
|
|
|
|
// the network isn't up yet: this computer's address is shown, and
|
|
// nothing of the pick is lost
|
|
lanURLs.length = 0;
|
|
await open();
|
|
assert.match(await page.locator("#connect").textContent(), /127\.0\.0\.1:3999\/v1/);
|
|
assert.equal(await page.locator("#connectAddress").count(), 0);
|
|
lanURLs.push("http://192.168.1.10:3999", "http://10.0.0.10:3999");
|
|
await open();
|
|
assert.match(await shown("#connectAddress"), /10\.0\.0\.10:3999\/v1/);
|
|
await page.waitForFunction(() => document.querySelector("#connectKey")?.textContent.includes("Server"));
|
|
|
|
// Share on local network's address is kept the same way
|
|
await page.locator("#prefs").click();
|
|
await page.locator(":is(#setTab-network, .nav-s[data-of=setTab-network]):visible").click();
|
|
await page.locator("#lanList .lan-address-row").waitFor();
|
|
await pick("#lanList .lan-interface", "10.0.0.10");
|
|
await page.reload();
|
|
await page.locator("#prefs").click();
|
|
await page.locator(":is(#setTab-network, .nav-s[data-of=setTab-network]):visible").click();
|
|
await page.locator("#lanList .lan-address-row").waitFor();
|
|
assert.match(await shown("#lanList .lan-interface"), /10\.0\.0\.10:3999/);
|
|
|
|
// nothing on the page is wider than the window
|
|
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true);
|
|
assert.deepEqual(errors, []);
|
|
});
|
|
}
|
|
}
|
|
}
|