Separate live and deterministic render captures
This commit is contained in:
1 parent
f1b1f5af5e
commit
b21b194d09
2 files changed
+26
-1
No files matched your search
@@ -11,6 +11,8 @@ PYTHON="${PYTHON_BIN:-python3}"
|
|||||||
usage() {
|
usage() {
|
||||||
echo "usage: $0 OUT_DIR [SCROLL_Y]" >&2
|
echo "usage: $0 OUT_DIR [SCROLL_Y]" >&2
|
||||||
echo "SCROLL_Y is an integer CSS-pixel offset or 'bottom'." >&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
|
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
|
||||||
@@ -23,6 +25,11 @@ if (( $# < 1 || $# > 2 )); then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
OUT="$1"
|
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
|
if [[ -e "$OUT" ]]; then
|
||||||
echo "output path already exists: $OUT" >&2
|
echo "output path already exists: $OUT" >&2
|
||||||
exit 2
|
exit 2
|
||||||
@@ -40,7 +47,6 @@ args=(
|
|||||||
--width 1440
|
--width 1440
|
||||||
--height 1000
|
--height 1000
|
||||||
--settle-ms 3000
|
--settle-ms 3000
|
||||||
--animation-time-ms 0
|
|
||||||
--geometry-selector "header, nav, footer"
|
--geometry-selector "header, nav, footer"
|
||||||
--geometry-selector "main, article"
|
--geometry-selector "main, article"
|
||||||
--geometry-selector "section"
|
--geometry-selector "section"
|
||||||
@@ -50,6 +56,10 @@ args=(
|
|||||||
--geometry-selector "table"
|
--geometry-selector "table"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if [[ "$CAPTURE_MODE" == "deterministic" ]]; then
|
||||||
|
args+=(--animation-time-ms 0)
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n "${CHROMIUM_BIN:-}" ]]; then
|
if [[ -n "${CHROMIUM_BIN:-}" ]]; then
|
||||||
args+=(--chromium-bin "$CHROMIUM_BIN")
|
args+=(--chromium-bin "$CHROMIUM_BIN")
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -122,6 +122,21 @@ class RepresentativeSuiteTests(unittest.TestCase):
|
|||||||
"bottom",
|
"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):
|
def test_site_corpus_is_https_and_has_no_duplicates(self):
|
||||||
urls = [
|
urls = [
|
||||||
line.strip()
|
line.strip()
|
||||||
|
|||||||
Reference in new issue
Block a user