test: revive the two dead root test files (#170) - #173
Merged
Merged
Conversation
…#170) test-rx-coverage-escape.js sliced the row builder out of public/rx-coverage.js by marker strings. The end marker no longer exists, so it failed with "could not locate row-builder end" at every commit since it was added and was never wired into CI. Rewrite it to load the real public/rx-coverage.js in a vm (like test-issue-124-rx-coverage-viewport.js) with the real escapeHtml from public/app.js, mount the page, answer /api/rx-leaderboard with hostile observers and strictly parse the rendered #rxBoard rows. Names with <script>, ", ', & and <img onerror> and hostile pubkeys must render escaped in the label, data-rx, data-name and aria-label. Register it in test-all.sh and in the JS unit step of deploy.yml. Relates to #170 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n playwright (#170) test-pr-1490-live-map-gpu-animations-e2e.js required @playwright/test, which is not a dependency, so it could not load and was never run in CI. Its checks are not covered elsewhere: test-issue-1599-replay-freeze-e2e.js only drains one animation after a replay handoff, and test-live-anims.js is a source-string check that is not in CI. Port it to the plain playwright API used by the other *-e2e.js files (chromium.launch, local step helper, CHROMIUM_REQUIRE). Per viewport (desktop and mobile) it waits for an idle engine, fires 20 lines through window._liveDrawAnimatedLine and checks that the canvas is on the animations pane, the burst queues and wakes the engine, drains, keeps recentPaths at most 5 in the frame it drains, sleeps again, and that the fading polylines render on the animations pane. The drain is driven by awaiting rAF in the page, as test-issue-1599 does. The old fade-pane assertion was satisfied by the animation canvas itself; it now looks for the Leaflet renderer canvas the fades create there. Register it in the Playwright E2E step after test-issue-1599. Relates to #170 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relates to #170
Both dead root test files are now real tests that run in CI. No production code changed, and no npm dependencies were added.
1.
test-rx-coverage-escape.js: rewrittenWhy it failed. It cut the leaderboard row builder out of
public/rx-coverage.jsby marker strings. The end marker (o.nodes + '</span></div>';) no longer exists, so it stopped withcould not locate row-builder end. This still reproduces on master84c637ea.Now. It loads the real
public/rx-coverage.jsin avmcontext, the same waytest-issue-124-rx-coverage-viewport.jsdoes, with the realescapeHtmlfrompublic/app.js. It then mounts the page, answers/api/rx-leaderboardwith hostile observers and parses the rendered#rxBoardrows strictly. Each row's opening tag must contain exactly the expected double-quoted attributes, with no raw<,>or"in any value. The name span must contain no raw quotes or brackets, and every&must start an entity.<script>,",',&,"><img src=x onerror=…>and'><svg onload=…>are escaped in the label,data-nameandaria-label. The exact escaped forms are checked.data-rxand in the unnamed-label fallback (pubkey.slice(0, 10)…).rx=in the URL) is still escaped (class="rxb-row sel",aria-pressed="true").role="button",tabindex="0"andaria-pressed(kept from the old test).Registered in
test-all.shand in the JS unit step ofdeploy.yml.Mutants (run on a copy, all red)
escapeHtml(o.name)removed from the labelescapeHtmlremoved from the pubkey label fallbackescapeHtmlremoved fromdata-rxescapeHtmlremoved fromdata-nameescapeHtmlremoved fromaria-labelescapeHtmlinapp.jswithout'/&/"escaping2.
test-pr-1490-live-map-gpu-animations-e2e.js: ported, not deletedDecision: port. The file's checks are not covered elsewhere:
test-issue-1599-replay-freeze-e2e.js(in CI) drains a single animation after a replay handoff. It does not check that the engine wakes and then sleeps again, the 20-line burst, therecentPathscap or the panes.test-live-anims.jsandtest-issue-1485-live-anim-z.jsonly match strings in thelive.jssource. Neither is indeploy.yml, and both already fail on master (see below).test-live.jsandtest-e2e-playwright.jsdo not touch_liveTestSeams,isAnimatingorrecentPaths.Now. The test uses the plain
playwrightAPI like the other*-e2e.jsfiles:chromium.launch, a localstephelper andCHROMIUM_REQUIRE. For each viewport, desktop 1400×900 and mobile 375×812, it:/#/liveand waits until init is done (_liveWSHandler()) and the engine is idle;.leaflet-animations-pane(z-index 625);window._liveDrawAnimatedLineand checks that all 20 are queued and the engine wakes;recentPathsis at most 5 in the frame where the queue empties (20 > 5, so the cap actually runs);The drain is driven by awaiting
requestAnimationFrameinside the page, astest-issue-1599does.Changes from the original:
svg path, canvasin the pane, which the animation canvas alone satisfies. The test now looks for the Leaflet renderer canvas (canvas.leaflet-zoom-animated) that the fades create on that pane.Registered in the Playwright E2E step, right after
test-issue-1599-replay-freeze-e2e.js.Mutants (each
public/live.jsmutant served from a copy ofpublic/, all red)isAnimating = falseremoved from the empty-queue branchrecentPathscap 5 → 50pane: 'animationsPane'removed from both fading polylinesoverlayPane<canvas>on .leaflet-animations-pane"drawAnimatedLinedisabledLocal verification
The server was built from this head, using CI's fixture recipe on a scratch copy:
freshen-fixture.sh, the Kpa-clawbot#1486/Kpa-clawbot#1791 seed block fromdeploy.yml,corescope-migrateandseed-2073-route-adverts.sql.test-pr-1490-…-e2e.js, plainpublic/test-pr-1490-…-e2e.js,public-instrumented/(as in CI), 3 runstest-issue-1599-replay-freeze-e2e.js(neighbour)test-rx-coverage-escape.jstest-issue-124-rx-coverage-viewport.jstest-live.jstest-packet-filter.js/test-aging.jstest-frontend-helpers.jstest-all.shstops at line 18 on the favStar baseline (set -e), so I ran each of itsnodelines separately:84c637ea: 92/104 pass.The same 12 files fail on both. The one extra pass on this branch is
test-rx-coverage-escape.js. The 12 pre-existing local failures are out of scope here:test-frontend-helpers,test-channel-psk-ux,test-analytics-channels-integration,test-observers-headings,test-issue-1648-m3-emoji-scan,test-issue-1648-m6-final-sweep,test-issue-1648-m6-lint-self,test-issue-1438-customizer-mcrole,test-issue-1446-cb-preset-cascade,test-issue-1470-node-tile-helper,test-issue-1485-live-anim-zandtest-naive-banner-tone.deploy.ymlThere are two added lines and nothing else. The fork guards are unchanged: 9 ×
github.repository == 'Kpa-clawbot/CoreScope'on both base and head.Not covered
vmrender test of the real page module.🤖 Generated with Claude Code