Commit Graph
2 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 00e0fd11b7 gui: a key switches off and on again by name, beside Remove (wei_VC on X)
wei_VC on X: "我希望可以 disabled 某些 key,现在只有移除,后面我想使用只能
再次新增". magpie could already keep a key off (KeyAccount.Off, the
caller key's Off), but the only switch was the tick dot at the row's
start, drawn with cursor: default and no word, so no one read it as
one. Remove was the only thing with a name.

- A provider's keys: each row has Switch off (on hover, beside Remove,
  as Remove is) or, when the key is off, Switch on, always shown. The
  first key too, while another key is on: keys/off gives its place to
  the next one on (provider.SetKeyOn's promote, unchanged). The last
  key on has none, as it has no Remove; the provider's own switch is
  for that.
- Gateway keys (the caller keys on the Gateway page): Disable key /
  Enable key is the first item of the key's … menu, above Rotate key
  and Remove.
- Words reused, already in all five languages ("Switch off"/"Switch
  on", "Disable key"/"Enable key"). No new i18n keys, no Go change.

The gateway already skips an off key on every route: providers'
keys go out only through Provider.KeysOn (fallback, key_models, video,
groups, remote key limits) and the first key is always on; an off
caller key is refused in access. Not changed.

Run:
- New internal/gui/tests/key-switch.test.cjs: Chromium + WebKit, en,
  zh, zh-TW, ja, de, 420 and 900px: 20/20 ok on mote. It switches the
  first key off, the off key on, the first back on, checks the posts
  are keys/off and keys/on (never keys/remove), no scroll, the button
  inside the row, and no Switch off on the last key on.
- gateway-card.test.cjs (now checks Disable key, Enable key, Rotate
  key, Remove and the off-key/on-key posts) and api-key-theme: 46/46
  ok with key-switch on mote.
- Broken by hand: key-switch on origin/main's app.js 0/10 (Chromium);
  gateway-card on origin/main's keys.js 0/10 (Chromium).
- gofmt -l clean; go vet ./... darwin and GOOS=windows ok;
  GOOS=linux go vet -tags nogui ./internal/{gui,provider,gateway}/...
  ok (GOOS=linux ./... without nogui stops in Wails' cgo files on a
  cross build, as before).
- go test -timeout 45m ./internal/provider/... ./internal/gateway/...
  ./internal/gui/... on mote at 65bd4e4f7 + this change: provider ok,
  gateway ok, gui red only in TestMainWindowCorners/macOS_26_SDK on
  macOS 27 (#3949, open, AppKit, not this change). Rebased onto
  f6263439a (gateway text to speech) after; this change has no Go.
- The whole GUI suite (989 files, Chromium + WebKit) was started on
  the Linux box (wsl-run, magpie-desktop) at this head and was still
  running when this was pushed; the coordinator asked to push without
  waiting. Its result goes on the tweet thread report, and any red it
  names gets its own issue.

Not tried: the real desktop app with real keys (the rows are the
same page the tests load, with the API faked).
2026-10-29 20:56:05 +08:00