""" A phone's clips among the photos of an album (harness/photo_video_probe.py). Backed up beside the photos (docs/MESHBAY_DESIGN.md §9.12), a clip belongs to its album: counted on the card, marked and timed on its tile, and played in the group's video player from the lightbox, never downloaded whole into it. A slideshow is of photos and passes a clip by. """ import json import shutil import subprocess import sys from pathlib import Path import pytest HARNESS = Path(__file__).parent / "harness" / "photo_video_probe.py" @pytest.fixture(scope="module") def cases(): if shutil.which("google-chrome") is None: pytest.skip("Chrome is not available") proc = subprocess.run([sys.executable, str(HARNESS)], capture_output=True, text=True, timeout=180) assert proc.returncode == 0, f"probe failed: {proc.stdout}{proc.stderr}" out = json.loads(proc.stdout) assert "error" not in out, out["error"] assert out["logs"] == [] return {c["case"]: c for c in out["cases"]} def test_the_album_counts_photos_and_videos_apart(cases): assert "2 photos · 1 video" in cases["card"]["text"] def test_a_clip_is_in_the_album_marked_with_its_length(cases): assert cases["tiles"]["count"] == 3 assert cases["tiles"]["badges"] == [None, "0:42", None] def test_the_lightbox_hands_a_clip_to_the_video_player(cases): c = cases["lightbox"] assert c["title"] == "b.mp4" and c["play"] assert c["played"] == ["v1"] assert "0:42" in c["info"] def test_a_slideshow_passes_a_clip_by(cases): assert cases["slideshow"]["button"] and cases["slideshow"]["now"] == "c.jpg"