"""Actual browser routing, Mapping ACK and native countdown regressions.""" from __future__ import annotations import os from pathlib import Path import shutil import subprocess import pytest ROOT = Path(__file__).resolve().parents[1] SCENARIOS = tuple( f"pair_{side}_short_{order}" for side in ("home", "away") for order in ("short_first", "long_first") ) + tuple(f"phase_expiry_{side}_short" for side in ("home", "away")) + ( "reverse_insertion_remembers_owner", "repeat_main_has_no_wrong_side_flash", "conditional_and_fallback_same_owner", "native_caption_data_ack_before_in", "native_cold_in_dedup_after_caption_mapping", "clock_continuity_pause_resume_home_short", "clock_continuity_pause_resume_away_short", "tail_snapshot_and_hydration", "pending_goal_snapshot_keeps_latest_pause", "pending_goal_blocks_automatic_native_replay", "pending_goal_blocks_legacy_in_preserves_data", "pure_equal_and_foreign_captions_unchanged", "gate_off_blocks_every_penalty_in", ) @pytest.mark.parametrize("scenario", SCENARIOS) def test_penalty_display(scenario: str) -> None: node = shutil.which("node") assert node, "Node is required for actual browser runtime regressions" runtime = Path(os.environ.get("BUILD200_RUNTIME_ROOT", ROOT)) completed = subprocess.run( [node, str(ROOT / "tests/build200_penalty_display.cjs"), scenario, str(runtime)], text=True, capture_output=True, timeout=20, ) assert completed.returncode == 0, completed.stdout + completed.stderr assert f"PASS: {scenario}" in completed.stdout