From 17300170cc9af42c189968dab834e41c084437ad Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Fri, 7 Aug 2026 09:43:43 +0200 Subject: [PATCH] [test](trx-frontend-http): read the statistics counters past their formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Claude-Session: https://claude.ai/code/session_01SyX26FCpMQxiBoC7r5K1A7 Signed-off-by: Stan Grams --- .../trx-frontend-http/frontend/tests/decode-flow.mjs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/trx-client/trx-frontend/trx-frontend-http/frontend/tests/decode-flow.mjs b/src/trx-client/trx-frontend/trx-frontend-http/frontend/tests/decode-flow.mjs index 99beeccb..7f98859a 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/frontend/tests/decode-flow.mjs +++ b/src/trx-client/trx-frontend/trx-frontend-http/frontend/tests/decode-flow.mjs @@ -270,10 +270,13 @@ try { // on the tab (module loaded at startup, before the history) to show the lot. await replay.page.evaluate(() => window.navigateToTab("statistics")); await replay.page.waitForTimeout(1500); - const counted = await replay.page.evaluate(() => ({ - decodes: Number(document.getElementById("stats-total-decodes")?.textContent ?? "0"), - grids: Number(document.getElementById("stats-unique-grids")?.textContent ?? "0"), - })); + // The counters are written with toLocaleString(), so a four-figure count + // arrives as "1,220" — whichever separator the runner's locale picks. Read + // 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, `the statistics counted ${counted.decodes} decodes`); // Grid squares come from the FT8 and WSPR spots, which had no map replay of