Commit Graph
3 Commits
Author SHA1 Message Date
yetoneandcduyzh bf47eb46c4 gui: a long status line goes after 15s at most, not 80ms a character (water5433)
water5433 (cduyzh) on Discord: an error toast stayed on screen far too
long. Since d4c05ca11 (littleHong) status() kept a line for
max(ms, length * 80ms) so a long one could be read, with no upper
bound: a 1,150-character error floated over the window for 92s, and a
longer one for minutes, while it took clicks under it.

The reading time now stops at 15s: max(ms, min(length * 80, 15000)).
Their patch capped the whole thing at 10s, min(10000, max(...)); two
changes from it:
- 15s, not 10s: Test models' failure as littleHong read it (the OfficeAce
  line, 141 characters in English) takes 11.3s, and 10s cut it short.
- The cap is on the length part only, so a time the caller gives is kept
  whole: the damaged-file warning asks for 20s, and the 10s cap cut it to
  half.
The pointer still holds the pill however long, and it goes 2s after it
leaves. The text stays in the pill's title while it shows.

Test: status-long.test.cjs "a long line goes after its reading time, 15s
at most", page.clock driven, en and zh, light 900 and dark 390: a
1,150-character error is there at 14.5s and gone at 15.2s; the reporter's
Test models line is kept for all of its reading time and goes after; a
20s warning is kept to 19.5s; hover holds it past 30s and it goes 2.2s
after the pointer leaves.

Run (mote-run, at this commit and the next on origin/main 12599e9cd):
- status-long.test.cjs: 40/40 in Chromium and WebKit.
- go test -tags nogui ./internal/gui: ok; the core stays in its budget
  with this line's comment cut to one line (1,533,752 of 1,533,802).
- Broken by hand in Chromium: old code 0/4 ("gone at 15s, not after its
  80ms a character"); their 10s cap 0/4 ("still there before 15s").
- No other GUI test both drives the clock and reads #status.
Not tried: the real app; their own failing error, whose text I don't have.

Co-authored-by: cduyzh <cduyzh@users.noreply.github.com>
2026-11-03 10:05:30 +08:00
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 d4c05ca114 gui: a status line longer than its place floats wrapped, whole (littleHong)
littleHong on Discord: Test models in OfficeAce's editor failed on every
model, and the red status pill was one line ending in "…", so the part of
the error saying what to do ("请在 OfficeAce 客户端完成「接入华为云 MaaS
模型」后重试…") was cut off.

status() now lifts the pill (the floating .lift it already had over a
dialog) whenever its text is wider than the footer, too. A lifted pill
wraps (white-space normal, overflow-wrap anywhere), is up to
min(560px, 100vw - 32px) wide and min(166px, 40vh) tall (ten lines),
and scrolls inside itself past that (overscroll contained). One line is
still a 22px pill; its corners went from 999px to 11px so several lines
don't read as a capsule. It stays while the pointer is on it and clears
2s after it leaves, and a long line stays msg.length * 80 ms at least.
The text stays selectable; no border accent.

Siblings: every toast (ok, warn, err) goes through status(), in the
window, over dialogs and in the tray panel's footer
(body.panel .foot .status is overridden by body .foot .status.lift).
A short line stays in the footer as before.

Test: internal/gui/tests/status-long.test.cjs. The reporter's literal
OfficeAce error from /api/provider/test on 10 models, in en, zh, zh-TW,
ja and de, light at 900 wide and dark at 390: lifted, not cut either way,
wraps, in the viewport, user-select text, no left border, last character
inside the pill. In en and zh: err/warn/ok long lines float and a short
one stays in the footer; a very long line holds to ten lines and wheel
scrolls to its end without moving the page; hover holds it, leaving
clears it.

Run (mote-run):
- status-long: 32/32 in Chromium and WebKit.
- Broken by hand in Chromium: old CSS+JS 0/16, old CSS only 2/16 (the
  hover cases), old JS only 10/16 (footer, scroll and hover cases fail).
- i18n-keys, sessions-reads, session-terminal, account-discovery,
  settings-general: ok in both engines.
- go test ./internal/gui: ok except TestMainWindowCorners/macOS_26_SDK,
  open as #3949. TestCoreScriptBudget ok: app.js 1,310,377 bytes
  (budget 1,311,735), budgets unchanged.
- Screenshots looked at: zh light 900, zh dark 390, scroll dark 390.

Not tried: the real app; Windows WebView2 and Linux WebKitGTK.
2026-10-30 00:15:46 +08:00