27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
"""回放器播放器的 JS 逻辑回归:用 DOM 桩跑发布的 app.js/replay.js 原文。
|
||
|
||
曾回归出两类"加载即冻结"bug(applyEvents 参数遮蔽模块级状态、switch 段缺
|
||
at 导致 robot.x TypeError),当时只有 Python 层测试、JS 层零覆盖——本文件
|
||
补上该防线:有 node 环境则执行 referee/tests/js/replay_harness.cjs,
|
||
无 node 环境跳过(回放器为纯前端功能,Python 测试仅覆盖静态资源存在性)。
|
||
"""
|
||
|
||
import os
|
||
import shutil
|
||
import subprocess
|
||
from pathlib import Path
|
||
|
||
import pytest
|
||
|
||
REPO = Path(__file__).resolve().parents[2]
|
||
HARNESS = REPO / "referee" / "tests" / "js" / "replay_harness.cjs"
|
||
|
||
|
||
@pytest.mark.skipif(shutil.which("node") is None, reason="需要 node 环境运行 JS 桩测试")
|
||
def test_replay_player_logic():
|
||
result = subprocess.run(["node", str(HARNESS)], capture_output=True, text=True,
|
||
env={**os.environ, "REPO": str(REPO)}, timeout=60,
|
||
check=False)
|
||
assert result.returncode == 0, f"回放器逻辑测试失败:\n{result.stdout}\n{result.stderr}"
|
||
assert "ALL PASS" in result.stdout
|