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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
"""
The photo backup section of the Android Sync page, measured in Chrome at phone widths
(harness/photo_sync_probe.py). Android's WebView is the only engine that ever
shows it.
A group, a folder or an album is named by somebody else and often has no space
in it; one such name made a 360px page 634px wide before `.settings-name`, and
a page wider than the screen takes every pinned header with it (CLAUDE.md).
"""
import json
import shutil
import subprocess
import sys
from pathlib import Path
import pytest
PROBE = Path(__file__).parent / "harness" / "photo_sync_probe.py"
@pytest.fixture(scope="module")
def probe():
if shutil.which("google-chrome") is None:
pytest.skip("chrome is not available")
proc = subprocess.run([sys.executable, str(PROBE)], capture_output=True, text=True,
timeout=240)
assert proc.returncode == 0, f"probe failed: {proc.stdout}{proc.stderr}"
return json.loads(proc.stdout)
def test_it_renders_without_an_error(probe):
for state, r in probe.items():
assert r["err"] == "", f"{state}: {r['err']}"
assert r["text"].strip(), f"{state}: nothing was drawn"
def test_no_name_widens_the_page_on_a_phone(probe):
for state, r in probe.items():
assert r["scrollW"] <= r["vw"], (
f"{state}: {r['scrollW']}px of page in a {r['vw']}px window — {r['wide']}")
def test_the_camera_and_the_photos_already_there_are_the_defaults(probe):
for state in ("setup360", "partial360"):
assert probe[state]["checked"] == [
"Camera", "The photos already on this phone, then new ones"], probe[state]["checked"]
def test_a_refusal_is_said_where_the_backup_is(probe):
assert "the node's disk is full" in probe["configured360"]["text"]
def test_limited_access_is_said_rather_than_failing_quietly(probe):
assert "Access is limited to the photos you selected" in probe["partial360"]["text"]
def test_where_backups_go_lists_each_kinds_folder(probe):
text = probe["dest360"]["text"]
assert all(f"Media/bob-{k}" in text for k in ("photos", "contacts", "calendar", "messages", "drive", "whatsapp"))
def test_photos_the_photos_tab_will_not_show_are_said(probe):
assert "does not show Media/bob-photos" in probe["dest360"]["text"]
def test_the_contacts_backup_says_where_its_copies_go(probe):
assert "bob-contacts/contacts-2026-10-10-0900.vcf" in probe["configured360"]["text"]
def test_the_messages_backup_says_where_its_copies_go(probe):
assert "bob-messages/2026/sms-2026-10-10-0900.xml" in probe["configured360"]["text"]
def test_the_calendar_backup_says_where_its_copies_go(probe):
assert "bob-calendar/calendar-2026-10-10-0900.ics" in probe["configured360"]["text"]
def test_videos_are_offered_and_off_by_default(probe):
assert "Videos too" in probe["setup360"]["text"]
assert "Videos too" not in probe["setup360"]["checked"]
def test_the_files_backup_lists_its_folders_and_what_it_leaves_out(probe):
text = probe["configured360"]["text"]
assert "Documents" in text and "Scans_from_the_office_printer" in text
assert "DCIM, Pictures and Movies cannot be chosen" in text
def test_the_whatsapp_backup_says_how_to_restore(probe):
text = probe["configured360"]["text"]
assert "WhatsApp's folder is chosen" in text
assert "To restore on a new phone" in text
|