blob: 2585f4748cfb01e05dfe2c2f3c5f4df1c02eb832 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
"""
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"
|