Commit Graph
5 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 7dd965ed22 gui: the tray's allowances show without their history, and stay as drawn when nothing changed (#3192)
parkavenue9639 found three things on the tray panel's Allowances tab:

- loadQuotas waited for /api/usage/quotas/history (45 days, and a
  remote magpie's too) in one Promise.all with the allowances, so the
  skeleton stayed until the curves' history came. The history is now
  read on its own (loadQuotaHist); the cards are drawn as soon as the
  allowances are in, and drawn again when a history that differs lands.
  Of two history reads on their way, the later asked stands.
- The window coming back (focus, visibility) ran renderPanelQuota from
  load() and again when the quotas came, each a rebuild of cards that
  had not changed (and, while loading, a restart of the skeleton's
  shimmer). Those two calls are now lazy: the panel is drawn only when
  something it draws from changed (the allowances, a new history, used
  or left, the curves' range, folded options, the settings, language,
  tab, peek, arranging, or the minute, for its clock deadlines). Every
  other caller draws as before.
- renderQuotas went on to build the Usage page's cards, trend and
  curves in the panel, which never shows that page. It now stops after
  the panel's own draw there.

renderQuotas' local `const mode` (the Used/Left picker) shadowed the
page's mode, so the new panel check hit its temporal dead zone; it is
`pick` now. The fold check `mode !== "panel"` beside it compared that
element, so it was always true; it is dropped, which changes nothing.

Tests: panel-quota-lazy.test.cjs, every language, 440 and 360 wide,
Chromium and WebKit: with the history held the card is drawn and no
skeleton is left; the panel draws no #subscriptionUsage cards; loadBack
with the same answers keeps the card and group nodes; a changed
allowance is drawn.

tray-cell-click waited for the card to be replaced after the window's
focus; with the same allowances it is kept now, so it waits for the
refresh to finish and checks the highlight on the card as drawn. Red
4 of 4 at the old wait, green with the new one.

Run:
- panel-quota-lazy at the old app.js: red in every case; at this change
  20 of 20.
- The whole GUI suite (826 files, --test-concurrency=3, load 40 to 90)
  at e0abb65ff on b1a2eec2c: 11641 tests, 46 failed in 14 files. Each
  of them was run alone at this change:
  - green alone: fonts, library-row-remove, market-have, model-copy-id,
    panel-profiles, remote-group-served, tray-usages, usage-pack.
  - red alone, the same count at the old app.js, filed: quota-count-wrap
    and quota-name-translated (#2228), s3-sync (#2448),
    usage-agents-hide 22 (#2276), usage-checkin 2 (#2549, #3091),
    usage-fold 2 (#2163), usage-ledger 6 (#3104).
- After rebasing onto b0d46ca7f: panel-quota-lazy, tray-cell-click,
  i18n-keys, panel-profiles and tray-usages, 53 of 53; go test
  ./internal/gui (core script budget) ok 4 runs of 5. The first run
  printed FAIL and its log was cut by a tail, so which test failed is
  not known; the next four were ok.
- Full Go suite at 36890807e (on b0d46ca7f): go test -timeout 45m
  ./..., 68 packages ok (gateway 550s, agent 442s, gui 205s); gofmt -l
  clean.
2026-10-22 06:21:54 +08:00
yetone 7f66a0cce2 gui: on Linux the quick panel is dragged by its header, as the window is (#1430, olivezane)
On KDE Wayland the panel can't be put by the tray icon (a Wayland window
can't place itself, so KWin places it), and since ownFrame took KWin's
title bar off it (#1283) it had no handle at all: only Meta+drag moved
it. The panel's header set --wails-draggable: no-drag on every platform
(ebcd5281, when the panel began loading the Wails runtime); it now does so
on the Mac and Windows only, where the panel stays by the icon. On Linux
the header drags it as the main window's does (gtk_window_begin_move_drag,
which Wayland takes), and the tabs and buttons in it stay clicks.

Run: panel-drag-linux.test.cjs (Linux, Mac and Windows platforms; panel
and window; every visible control in the header no-drag) passes in
Chromium and WebKit, en and zh, and fails without the app.js change
("Linux: the panel's header is its handle"). tray-cell-click (which
asserts the Mac's panel stays no-drag) passes in both engines. No new
strings. Not tried on a real KDE Plasma 6 Wayland session.
2026-10-10 17:54:19 +08:00
yetone 2d5f9c748e gui: the Usage page shows every account again, each as compact as before the trend lines, and remembers which ones are open (ARNO on Discord: 以前每个账号所占的空间很小,基本能一页看到所有账号的情况,现在要一个个手动展开账号,展开后占的空间又特别大,余额走势的线条也分散在各个地方很乱。而且关了magpie后又得一个个展开)
With 17 subscriptions and 29 accounts, a card with several accounts showed one of them and hid the rest behind "Show N more accounts". Opening one showed every account at full size, with resets, credit days and its own trend line, so a page that once fit most accounts filled several screens. The open state was kept per subscription, and ARNO had to open the cards again after quitting.

Now every account of a card is on the page. The one in sight (the last served, else the first) is shown in full. The others are shown in brief: the account row and its windows' names, figures and bars, with the reset times only in the bar's tooltip, and no trend line, credit days, "read" line or resets row (the balance stays). A chevron at the end of each account row opens or folds that account alone. The card's button, now in its head beside the name, opens the rest in full or puts them back in brief. Each account's choice is kept in localStorage magpie.usageAccounts (provider + account), so it survives a restart and syncs with the tray panel. A subscription opened under the old magpie.usageOpen starts with all its accounts in full. A brief account's separator sits where a full one's does, so folding doesn't move the account clicked, and the page doesn't scroll (backToReader). The tray panel shows the accounts open in full (or the one in sight) with the same button. A jump to an account from the tray opens that account.

Tested: usage-fold.test.cjs checks the full/brief split, the per-account chevron (no scroll, the account stays put), the head button, that the choice survives a reload, Hide accounts, and the panel following the window. A new case with 17 subscriptions and 29 accounts at 1280x800 with Trends off has all 29 accounts' bars on the page and at least 15 fully on the first screen (16 now; 15 before the curves at 9ccabdfb^; 12 on v0.1.752, with 12 more only behind buttons). It fails on the old code. tray-cell-click now expects the opened account in magpie.usageAccounts. quota-curve, click-scroll, panel-usage, account-mask, mobile-web, tray-cell-click, quota-families and quota-pools pass in WebKit. Screenshots at 1280x800 in zh: Trends off, 19 of 29 accounts' bars fully on screen (scroll height 1360 vs 2005 with Cycle). go vet ./internal/... and go test -tags nogui -count=1 ./internal/gui/ under a temp HOME pass. Not tried in the built app with real accounts.
2026-10-03 19:45:33 +08:00
lizhuo ebcd5281c2 gui: open matching allowance cards from macOS menu-bar quotas (#662)
* gui: navigate menu-bar quota cells to allowance cards

* gui: fix quota navigation in lightweight and folded views

Route quota hits through the existing status-item monitor rather than relying on local monitor ordering. Recreate released panels through panelWin, and expand hidden accounts before focusing them. Keep panel headers non-draggable and cancel pending navigation after five seconds or purposeful scrolling.

Add a native AppKit subprocess regression that fails with the former nil-panel dereference and verifies runtime-queued focus, closing, and recreation. Extend browser checks for folded accounts, expiry, cancellation, and panel drag state.
2026-10-03 19:01:13 +08:00