Commit Graph
3 Commits
Author SHA1 Message Date
yetone f3a8b38550 gui tests: privacy-hides-accounts scrolls to Hide accounts as a reader does, and usage-stale-answer lifts quotasOpened with loadUsage (#1632)
Both were red on origin/main when run alone; each had its own cause.

privacy-hides-accounts (WebKit, every run): since Settings' search box
(51042630e; the test passes on its parent and fails on it) the Hide
accounts row sits under the window's foot at 900x760. Playwright scrolls
it into view by code, and the click guard puts a scroll that isn't the
reader's back (a scrollIntoView from the page: 0 -> 38 -> 0 in both
engines); WebKit's click came after the put-back and hit the foot.
Nothing a reader meets: they scroll with the wheel. The test now wheels
the settings view until the row is clear of the foot, waits for the
scroll to settle, and checks the click doesn't move the view's own
scrollTop (it read window.scrollY, which is always 0 here, so "a click
never scrolls" checked nothing).

usage-stale-answer (every run): since #1588 (917a36577) loadUsage(asked)
calls quotasOpened(), which the test's faked page didn't have, so the
asked read threw before it read anything ([] for [true]). The test now
lifts quotasOpened and QUOTAS_OPEN_GAP from app.js with loadUsage, in
both of its pages. Broken by hand (loadUsage no longer opening the
allowances when asked): red again.

Run: privacy-hides-accounts 20/20 green in WebKit and 20/20 in Chromium;
usage-stale-answer 20/20; the other browserless GUI tests pass.
2026-10-12 01:55:05 +08:00
tsuixl 4c4e1ab5c5 test(gui): accept CRLF source in regression tests (#935) 2026-10-06 01:00:52 +08:00
Snowyy fa1e3947f9 plugin: isolate stalled streams and guard GUI refreshes (#664)
* plugin,gui: a stalled stream can't wedge the host, stale reads can't draw, and the browser suite runs in CI

internal/plugin: the host has one reader of the child's stdout, and it handed
each message to its call by sending on that call's channel. A caller that
stopped draining a streamed body (a slow HTTP client on a plugin-backed chat
stream) filled the channel; the reader then blocked, and every other call
through the host -- all plugin providers and accounts, moved built-ins
included -- stopped being dispatched until the stalled stream was drained. A
second call's answer arrived only after the first was drained.

Each call now queues its head and chunks in a bounded backlog (4 MiB of
chunks, 4096 of them) drained by its own reader, so the host's reader never
waits on one consumer; a call whose consumer stops reading is given up on
alone, with the limit as why. Aborts go through a goroutine too (abortLoop),
so a child that stopped reading its stdin can't make an abort wait either.
host_test.go covers the stalled consumer, the bounds and the abort path.

internal/gui: loadUsage() and refreshUsage() both read the Overview's
usage?period=, and neither checked after the await that its answer was still
the newest: a 24 h answer landing after a 7 d one drew the old period's
figures under the new period's name, and leaving the tab could still write the
Overview's cost into the shared header. Both now claim one shared read
generation before the request and draw only when it is still the newest and
the page, tab and period are unchanged. providersWhileFetching() also stopped
for good after one failed poll or reload; it now asks again.

usage-stale-answer.test.cjs and providers-fetching-retry.test.cjs lift the
real functions out of app.js and drive them with a faked api/page/timers, so
they need no browser; usage-refresh-flight.test.cjs gains the browser case for
the same race.

Makefile/.github: `make test-ui` runs every internal/gui/tests/*.test.cjs
through Node's test runner -- auto-discovered, UI_TEST_CONCURRENCY files at a
time (default 2) -- and a new `ui` job in Test runs it on ubuntu-latest with
Playwright's Chromium and WebKit. A missing browser fails the job; it never
skips to a pass. internal/gui/tests/README.md points at `make test-ui` instead
of a hand-kept command line.

Verified: node --test on the two new files 21/21; go test -count=1
./internal/plugin/ ok; go test -race -count=1 ./internal/plugin/ ok; go vet
./internal/plugin/ and go build ./... clean; node --check on the changed JS;
actionlint on the workflow.

Not verified: the full browser suite is not green yet. `make test-ui` is 1641
passed / 70 failed of 1711 across 225 files, and 12 of the 19 failing files
fail the same way on a pristine main (a known baseline: a fixture boots the
page in web mode while asserting the desktop window's narrow behaviour). The
`ui` job will be red until those baselines are dealt with -- nothing is
skipped or masked -- and the job has not yet run on a GitHub-hosted runner.

* plugin: distinguish stalled readers from large responses

* plugin: clarify best-effort abort delivery
2026-10-04 11:22:31 +08:00