test(kattis): snapshot the real problem-page HTML parser - #105
Conversation
parseKattisProblemPage scrapes open.kattis.com markup for a problem's name (<h1>) and difficulty (.difficulty_number, falling back to .difficulty). Every existing Kattis test mocks parsePage out, so the selector logic most likely to break on upstream markup drift was unexercised. Add a Playwright spec that runs the production function (serialized, not copied) inside a real browser DOM via page.evaluate, asserting name and rating against captured fixtures: full page, legacy .difficulty class, missing difficulty (defaults rating to 5), and missing <h1> (falls back to the problem id). Runs in the browser because the parser uses the browser-only DOMParser; this avoids adding a jsdom/happy-dom dependency.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
PR Author Agent⚡ on behalf of @cameroncuster 👋 This PR is monitored by an Augment Agent. I'll answer questions, implement suggestions, fix CI failures, and resolve merge conflicts. I slow down if the PR goes quiet, but any new comment wakes me back up. |
|
👀 Human Input Needed → Pair Review Briefing |
|
PR Author Agent⚡ on behalf of @cameroncuster Addressing the Risk Analyzer's two focus topics: Fixtures pin real behavior and catch drift. The test runs the production Why Happy to switch to a DOM shim + Node unit test instead if a maintainer prefers that shape. |
cameroncuster
left a comment
There was a problem hiding this comment.
Review completed with 0 suggestions.
|
Verifier 🛰️ 🛰️ Verifier ReportTL;DR: Ran the new Kattis-parser spec in a real browser across desktop + mobile, then broke the production selector to prove the spec actually catches a regression rather than passing blindly. 🔍 Walkthrough
📋 ScopeUnder test: a new Playwright spec ( Not tested:
📦 Artifacts · clean run · mutation proof Don't like what you see? Add a verification skill so the next run tests this kind of change. Want another run? Comment 👍 / 👎 · View session |
Problem —
parseKattisProblemPagescrapes open.kattis.com markup for a problem's name and difficulty, but it's the one Kattis function with no direct coverage: every existing test (unit and e2e) mocksparsePageout. A selector change or upstream markup drift would slip through silently.Solution — add a Playwright spec that exercises the production function (serialized via
.toString(), not a re-implementation) inside a real browser DOM throughpage.evaluate, asserting name + rating against captured fixtures:<h1>+.difficulty_number).difficultyclass fallback<h1>→ falls back to the problem idIt runs in the browser because the parser uses the browser-only
DOMParser; this deliberately avoids adding ajsdom/happy-domdev dependency (per repo guidelines on new deps). The spec runs in the existing mocked desktop/mobile projects and usesabout:blank, so it's decoupled from app/network state.Testing — I could not run the suite in my environment (only Node 22 available; repo requires Node ≥24 with
engine-strict). Opened as draft so CI on Node 24 validateslint/lint:es/checkand the Playwright run. I'll address any CI feedback.Opened by an Augment PR Author agent on behalf of @cameroncuster.