Commit Graph
4 Commits
Author SHA1 Message Date
yetone ce8b67de37 gui tests: a page's first load gets a minute, not a click's 5s (#4470)
claude-switch-only set page.setDefaultTimeout(5000) and then called
page.goto with no timeout of its own, so Playwright held the first load
of app.js, i18n.js and the plugins to the 5s bar meant for clicks. On a
busy box (a whole-suite run at load 130-160) that load took longer and
goto timed out. The same pattern is in 988 GUI test files (1174 pages):
every one of them now also sets setDefaultNavigationTimeout(60000) on
the same page, right after its default, so goto, reload and waitForURL
wait on the load itself with room, while clicks and waits keep their
short bar. group-from-model-add's own 20s navigation bar is raised to the
same minute. claude-switch-only also gives its first provider row (drawn
from the page's first reads) a minute before clicking it.

nav-timeout.test.cjs (no browser) reads every GUI test file and names
each page given a default under a minute without a navigation timeout of
at least a minute, so a new file can't bring the pattern back.

What was run (WSL magpie-desktop, Playwright 1.62.0, load 70-260 from
other sessions):
- node --check on every file in internal/gui/tests: all parse.
- nav-timeout.test.cjs against origin/main's test files: red (names the
  1174 pages); against this tree: its only reds were my own probe copies
  of the old files, since removed.
- By hand: claude-switch-only with app.js served 7s late (a busy box's
  first load), --test-name-pattern "1100 en": origin/main's file 4 of 4
  red with "page.goto: Timeout 5000ms exceeded"; this file 4 of 4 green.
- claude-switch-only.test.cjs, both engines, en/zh/ja/de, 1100 and 420:
  32 of 32. group-from-model-add, usage-access-key-card and i18n-keys:
  green. agent-plugin-agents: Chromium green; WebKit's de 420 subtest red
  on a 5s waitForFunction at line 115 (a wait after load, not the
  navigation), at load ~230.

Not tried: the whole GUI suite (about 1000 files; the change is one
mechanical line per page), Windows or mote (mote's browsers, #4125).
2026-10-31 02:09:18 +08:00
yetone 3deb85685f gui: Usage's subscription cards in one row are as tall as each other, so their bottoms line up (ikunbots on X)
ikunbots ("magpie 的这个卡片可以对齐吗") and duanjl_china ("有的长有的短"):
Claude Code, Codex and Antigravity sat side by side in one row on the
Usage page, each as tall as what it held, so their bottoms were ragged.

What changed
- packUsage (app.js) still packs the cards into columns as #860 made it
  (a short card stacks beside a tall one, never stretched to a row's
  height). After placing them, the last card in each column gets a
  min-height that takes it down to where the tallest column ends.
  - Cards side by side in one row (one card per column) are as tall as
    the tallest, bottoms on one line, content at each card's top.
  - A stack stays a stack: the upper cards are as tall as themselves and
    only the last one reaches down to end with the tall card beside it,
    which is what #860 asked for (堆叠和 Codex 对齐).
  - One column: each card is as tall as itself, nothing to line up.
  - The min-heights are cleared before every measuring, so a re-pack
    (resize, a fold opened, cards changed) measures each card as tall as
    itself. A min-height rather than a stretch keeps a card that outgrows
    it growing, so the ResizeObserver still re-packs.
- docs/subsystems/gui-shell.md says so.

Tests
- usage-pack.test.cjs:
  - New: ikunbots' three cards (Claude Code 2 windows, Codex, Antigravity
    6 families; content heights 107/169/217px) at 1400 and 1018px are one
    row with bottoms within 0.5px; at 480px one column, each card as tall
    as itself; widened again, one row lined up again.
  - The reporter's #860 stack at 897/1018/1400px still stacks:
    Antigravity as tall as itself, DeepSeek under it with the 7px gap,
    ending where Codex does.
  - sound(): a card is as tall as itself unless it is last in its column,
    which ends with the tallest; no card is shorter than its content.
  - The fold case: opening Codex's brief account grows what the card
    holds; the card already reaching down to the stack's end stays that
    tall rather than growing (was "the card grew").
- Broken by hand: no min-height applied -> "1400px: the cards' bottoms
  line up" red in all 8 (chromium/webkit x en/zh/ja/de); min-height not
  cleared before measuring -> "narrow: antigravity is as tall as itself"
  red. Restored: 8/8 pass.

Run
- usage-pack.test.cjs in Chromium and WebKit, en/zh/ja/de: 8/8 pass.
- Every GUI test file touching the Usage page (75 files, those naming
  #subscriptionUsage/.subscription-card/view=usage, plus click-scroll),
  both engines, concurrency 6: 917/918 pass. panel-usage webkit en failed
  once under that load ("asked: period=today&limit=1", a 2.4s poll in its
  Requests-window step this change doesn't reach), passes 3/3 alone;
  added to #1544 with its cause.
- Screenshots before/after with fixture data looked at: ragged row
  before, one line after; 897px stack unchanged but for DeepSeek/Codex
  ending together.
- No Go change; gofmt/vet/build not run. Full GUI suite not run.
2026-10-12 14:19:39 +08:00
yetone 054bdb8bbe gui tests: the sidebar's room
18e82adc6 shows the sidebar from 1024pt, so the window's pages are 212pt
narrower and start at x=212. Eight files assumed the old room:

- header-centre measures the tabs' gap from the layout button.
- phone-web's desktop browser at 1000pt, under the sidebar's width.
- routing-pause and routing-pointer-pin wheel over the view, not the
  sidebar at x<212.
- routing-scroll-end takes its columns from .rt-more's own width
  (routing.js byWidth); usage-pack opens at 1512 to keep 1300 of room.
- purpose-filter closes the menu by a scroll that ends at the view's
  top, and measures once the rows and scroll are at rest.
- sessions-overview scrolls the shape card no further than a third down,
  and waits a frame after a resize: WebKit starts the reduced-motion
  transition of the sidebar's padding and settles it in the next frame.

Run: all eight, plus sidebar, side-toggle, session-identity and
usage-ledger, pass in Chromium and WebKit; each failed with 18e82adc6
and passed on d4eae3618 with it reverted.
2026-10-12 01:58:58 +08:00
yetone 472b36cec5 gui: the Usage page's short cards stack beside a tall one, packed into columns in the user's order (#860, huoranxuanyuan)
huoranxuanyuan's screenshots (1569px window at 175%, about 897px CSS):
a tall Codex card shared a grid row with Antigravity and a DeepSeek
balance, and both short cards stretched to Codex's height, mostly empty.
They asked for Antigravity and DeepSeek to stack beside Codex.

What changed
- packUsage (app.js) packs #subscriptionUsage into columns on 1px grid
  rows. Each card takes the leftmost column that ends highest and is as
  tall as itself; the cards' 7px gap stays.
  - The DOM order is unchanged and is still settings.usageOrder, so
    dragging, Alt+arrows and screen readers work as before.
  - Column count: the most 260px columns that fit, or one fewer when
    that leaves much less empty room (<0.6x) for a page at most 1.3x
    taller. It is chosen again only when the cards change or the width
    fits another number of columns. A card that grows or shrinks (a fold,
    "Every model") is only re-packed, so the card clicked stays where it
    was, even when the view's scrollbar appears and takes 10px of width.
    Keying the choice on the pixel width moved a card turned to every
    model in WebKit, which quota-families caught.
  - A ResizeObserver on the list and each card re-packs on the next
    frame. A hidden view falls back to the plain grid.
- fitQuotas is split into fitQuota(g), so heights are measured with each
  meter box laid out for the width being tried.
- The tray panel's Allowances list is a single column with no row
  stretching, so it needs no change.
- docs/subsystems/gui-shell.md describes the packing.

Tests
- New usage-pack.test.cjs, with fixtures of the reporter's cards:
  - Codex with a 7-day window, credit resets and a curve; Antigravity by
    family; a DeepSeek balance with its trend.
  - At 897, 1018 and 1400px: Antigravity beside Codex at its top,
    DeepSeek under it with the 7px gap, order kept, no overlap, no card
    taller than its content.
  - Equal cards: one row in order at 1300px, one column at 480px.
  - Opening a brief Codex account grows that card in place, with no
    scroll.
  - Runs in Chromium and WebKit, in en/zh/ja/de. It goes red when
    packUsage returns early (checked by hand).
- usage-accounts-fold: "Show fewer" now holds the card's head where it
  was, as usage-keys-fold already does for keys. Its old assertions
  expected the page to shrink to its end, which packing no longer does.
- usage-fold: scrolls to each fold button before clicking it, since
  Codex is now packed under ZCode, past the 300px-tall window.

Run
- usage-*.test.cjs, quota-families and click-scroll in both engines:
  all pass except usage-heatmap, which fails the same way alone on
  origin/main 497656174.
- Full GUI suite at concurrency 6, under machine load ~170: 5125 pass,
  56 subtests fail.
  - Run alone, these pass in this tree and on origin/main:
    account-arrange, agent-models-redraw, agent-stale-copies,
    agent-update-all, factory-key, group-from-model-add,
    library-servers-bulk, proto-menu-overflow, routing-mode-goes,
    routing-served, sessions-overview, tray-cell-click, update-wait,
    usage-ledger, usage-refresh.
  - These fail the same alone on origin/main: mobile-web, old-webkit,
    plugin-moved-signin, routing-context-fold, routing-group-fold,
    usage-heatmap.
  - quota-families was red only in this tree. That was the width-keyed
    choice above, now fixed and green in both engines.
- No Go change.
2026-10-11 00:30:14 +08:00