From b21b194d09f59c9f1217bc37fc58d59ee5446c2b Mon Sep 17 00:00:00 2001 From: SGavrl <277843151+SGavrl@users.noreply.github.com> Date: Mon, 3 Aug 2026 13:36:14 +0000 Subject: [PATCH] Separate live and deterministic render captures --- render-repros/representative-suite/run.sh | 12 +++++++++++- render-repros/representative-suite/test_suite.py | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/render-repros/representative-suite/run.sh b/render-repros/representative-suite/run.sh index a212c35..20bdb28 100755 --- a/render-repros/representative-suite/run.sh +++ b/render-repros/representative-suite/run.sh @@ -11,6 +11,8 @@ PYTHON="${PYTHON_BIN:-python3}" usage() { echo "usage: $0 OUT_DIR [SCROLL_Y]" >&2 echo "SCROLL_Y is an integer CSS-pixel offset or 'bottom'." >&2 + echo "Set CAPTURE_MODE=live to leave animations and runtime state unfrozen." >&2 + echo "CAPTURE_MODE defaults to deterministic (Chromium animations sampled at T=0)." >&2 } if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then @@ -23,6 +25,11 @@ if (( $# < 1 || $# > 2 )); then fi OUT="$1" +CAPTURE_MODE="${CAPTURE_MODE:-deterministic}" +if [[ "$CAPTURE_MODE" != "deterministic" && "$CAPTURE_MODE" != "live" ]]; then + echo "CAPTURE_MODE must be 'deterministic' or 'live': $CAPTURE_MODE" >&2 + exit 2 +fi if [[ -e "$OUT" ]]; then echo "output path already exists: $OUT" >&2 exit 2 @@ -40,7 +47,6 @@ args=( --width 1440 --height 1000 --settle-ms 3000 - --animation-time-ms 0 --geometry-selector "header, nav, footer" --geometry-selector "main, article" --geometry-selector "section" @@ -50,6 +56,10 @@ args=( --geometry-selector "table" ) +if [[ "$CAPTURE_MODE" == "deterministic" ]]; then + args+=(--animation-time-ms 0) +fi + if [[ -n "${CHROMIUM_BIN:-}" ]]; then args+=(--chromium-bin "$CHROMIUM_BIN") fi diff --git a/render-repros/representative-suite/test_suite.py b/render-repros/representative-suite/test_suite.py index 1fe6a00..58d8770 100644 --- a/render-repros/representative-suite/test_suite.py +++ b/render-repros/representative-suite/test_suite.py @@ -122,6 +122,21 @@ class RepresentativeSuiteTests(unittest.TestCase): "bottom", ]) + def test_live_capture_does_not_freeze_chromium_animations(self): + result, arguments, _, _ = self.run_wrapper( + extra_environment={"CAPTURE_MODE": "live"}, + ) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertNotIn("--animation-time-ms", arguments) + + def test_invalid_capture_mode_is_rejected_before_capture(self): + result, arguments, _, _ = self.run_wrapper( + extra_environment={"CAPTURE_MODE": "almost-live"}, + ) + self.assertEqual(result.returncode, 2) + self.assertEqual(arguments, []) + self.assertIn("CAPTURE_MODE must be", result.stderr) + def test_site_corpus_is_https_and_has_no_duplicates(self): urls = [ line.strip()