From 5dfe1c353caf4f148ff8fb2d1d204eb5ae6c8c75 Mon Sep 17 00:00:00 2001 From: Alexandre Teixeira <111787685+alteixeira20@users.noreply.github.com> Date: Thu, 1 Oct 2026 06:39:22 +0100 Subject: [PATCH] test: stabilize final PR 40 validation gates --- scripts/css_snapshot.py | 7 +- tests/css_snapshot/README.md | 34 +++- tests/css_snapshot/baseline.json | 168 ++++++++-------- tests/css_snapshot/capture.mjs | 52 ++++- tests/css_snapshot/inventory.json | 1 + tests/css_snapshot/pr40-validation.md | 190 ++++++++++++++++++ ...kdown_codefence_placeholder_regression.mjs | 57 +----- tests/test_css_computed_style_snapshot.py | 51 +++++ tests/test_markdown_rendering_js.py | 8 + website/configuration-reference.md | 2 +- 10 files changed, 424 insertions(+), 146 deletions(-) create mode 100644 tests/css_snapshot/pr40-validation.md diff --git a/scripts/css_snapshot.py b/scripts/css_snapshot.py index 360fa11da..12baf4f40 100644 --- a/scripts/css_snapshot.py +++ b/scripts/css_snapshot.py @@ -97,7 +97,8 @@ def playwright_available(node="node", cwd=ROOT): def capture(origin, inventory=None, *, swap_rule=None, variants=None, - node="node", cwd=ROOT, timeout=CAPTURE_TIMEOUT_SECONDS): + measurement_delay_ms=0, node="node", cwd=ROOT, + timeout=CAPTURE_TIMEOUT_SECONDS): """Drive the browser capture and return ``{"snapshot": ..., "missing": ...}``. ``swap_rule`` swaps the first two top-level declarations of one selector @@ -107,6 +108,9 @@ def capture(origin, inventory=None, *, swap_rule=None, variants=None, ``variants`` restricts the run to the named variants, for a faster focused capture. + + ``measurement_delay_ms`` perturbs the capture timing for the determinism + self-test; elapsed wall time must not change an idle-state snapshot. """ inventory = inventory or load_inventory() selected = inventory["variants"] @@ -122,6 +126,7 @@ def capture(origin, inventory=None, *, swap_rule=None, variants=None, "variants": selected, "pages": inventory["pages"], "swapRule": swap_rule, + "measurementDelayMs": measurement_delay_ms, } result = subprocess.run( [node, str(CAPTURE_SCRIPT)], diff --git a/tests/css_snapshot/README.md b/tests/css_snapshot/README.md index 8d58e50df..3d8e86e82 100644 --- a/tests/css_snapshot/README.md +++ b/tests/css_snapshot/README.md @@ -92,6 +92,20 @@ same bytes, so the capture: - injects the theme and density classes into `` *before* first paint rather than toggling them afterwards, so no CSS transition is ever mid-interpolation while `getComputedStyle` runs; +- removes `autofocus` before parsing: focus states are outside this inventory, + and the browser's asynchronous autofocus step otherwise races the capture; +- pauses CSS animations at time zero and finishes CSS transitions before each + measurement, including newly revealed modals and newly mounted bench nodes. + Animation and transition declarations are still captured; the harness does + not inject `animation: none` or `transition: none`; +- pins Chromium's standard font preference to `Times New Roman` via CDP, + without overriding any author declaration; +- canonicalizes only the `BlinkMacSystemFont` family token to `"system-ui"`, + the spelling Chromium uses for that alias on macOS. Other family names and + their order remain significant; +- measures the `custom-system-prompt` element's `max-height` in `lh`, as opted + into by its inventory entry. Its authored `30lh` resolves to different pixel + heights with different fallback fonts; the line count remains significant; - aborts images, fonts and media, which cost time and change nothing in the pinned property set; - hides scrollbars, so a platform's scrollbar width cannot change the width @@ -111,11 +125,11 @@ same bytes, so the capture: - **JS-applied classes.** State the app adds at runtime (collapsed sidebar, open panels, active tabs) is not represented beyond what the served markup and the bench selectors already carry. -- **Cross-platform equality has not been measured.** The baseline was recorded - on macOS. The self-hosted Fira Code face means text metrics should not differ - from CI's Linux Chromium, and the layout-derived properties are excluded, but - until a Linux run confirms it, treat a CI-only drift as a possible harness - artifact and diff the dumps before assuming the CSS moved. +- **Browser upgrades and additional platforms.** The original macOS baseline + and Linux captures were compared property by property through exact hash + recovery; the proven platform differences are now controlled above. A new + capture on macOS has not been performed. New browser serialization changes + still need investigation rather than automatic baseline regeneration. - **The stylesheet is only one of the inputs.** `static/login.html` styles itself from an inline `
+ + +