[test](trx-frontend-http): read the statistics counters past their formatting
CI / test (pull_request) Successful in 7m52s
CI / lint (push) Successful in 2m19s
CI / lint (pull_request) Successful in 2m23s
CI / frontend (pull_request) Successful in 4m31s
CI / reuse (pull_request) Successful in 5s
CI / test (push) Successful in 7m43s
CI / frontend (push) Successful in 3m41s
CI / reuse (push) Successful in 6s

The new assertion parsed the decode counter with Number() on its text.  The
counters are written with toLocaleString(), so the 1220 records the history
fixture serves arrive as "1,220" and the parse gave NaN.  It passed here and
failed on CI because the count in the local repro was 18 — below the point
where grouping appears — and the runner's locale groups where mine did not.

Read the digits and ignore the separator, whichever one the locale picks.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyX26FCpMQxiBoC7r5K1A7
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit was merged in pull request #56.
This commit is contained in:
sjg
2026-08-07 09:43:43 +02:00
co-authored by Claude Opus 5
parent e41c13917d
commit 17300170cc
@@ -270,10 +270,13 @@ try {
// on the tab (module loaded at startup, before the history) to show the lot. // on the tab (module loaded at startup, before the history) to show the lot.
await replay.page.evaluate(() => window.navigateToTab("statistics")); await replay.page.evaluate(() => window.navigateToTab("statistics"));
await replay.page.waitForTimeout(1500); await replay.page.waitForTimeout(1500);
const counted = await replay.page.evaluate(() => ({ // The counters are written with toLocaleString(), so a four-figure count
decodes: Number(document.getElementById("stats-total-decodes")?.textContent ?? "0"), // arrives as "1,220" — whichever separator the runner's locale picks. Read
grids: Number(document.getElementById("stats-unique-grids")?.textContent ?? "0"), // the digits rather than the formatting.
})); const counted = await replay.page.evaluate(() => {
const count = (id) => Number((document.getElementById(id)?.textContent ?? "").replace(/\D/g, ""));
return { decodes: count("stats-total-decodes"), grids: count("stats-unique-grids") };
});
assert.equal(counted.decodes, HISTORY_AIS + HISTORY_APRS + HISTORY_FT8 + HISTORY_WSPR, assert.equal(counted.decodes, HISTORY_AIS + HISTORY_APRS + HISTORY_FT8 + HISTORY_WSPR,
`the statistics counted ${counted.decodes} decodes`); `the statistics counted ${counted.decodes} decodes`);
// Grid squares come from the FT8 and WSPR spots, which had no map replay of // Grid squares come from the FT8 and WSPR spots, which had no map replay of