"""Unit tests for the pure helpers in harness.screenshot (Phase 3 U1). The Playwright capture itself needs a live app (exercised in the U1 live demo); here we cover the pure bits: the artifact path and the SCREENSHOT-hook resolution. Run cold: cc-ci-run -m pytest tests/unit/test_screenshot.py -q """ from __future__ import annotations import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "runner")) from harness import screenshot as S # noqa: E402 def test_screenshot_path(): assert S.screenshot_path("/var/lib/cc-ci-runs/42") == "/var/lib/cc-ci-runs/42/screenshot.png" def test_hook_none_when_absent(): assert S._load_screenshot_hook(None) is None assert S._load_screenshot_hook({}) is None assert S._load_screenshot_hook({"SCREENSHOT": "not-callable"}) is None def test_hook_returned_when_callable(): def hook(page, domain, meta): pass assert S._load_screenshot_hook({"SCREENSHOT": hook}) is hook