""" The photo backup section in Settings, 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"]