Repository Public
1#!/usr/bin/env python32# SP Chat iOS3# File: Scripts/shots.py4# Description: Copies the screenshots attached by a UI test run (build/shots/<simulator>/, exported by build.sh uitest)5# under their readable names: shots.py <simulator dir> <destination dir> <prefix> → <prefix>-<name>.png6#7# Author: Simon-Pierre Boucher8# Contact: contact@spboucher.ai9import json10import re11import shutil12import sys13from pathlib import Path1415src, dst, prefix = Path(sys.argv[1]), Path(sys.argv[2]), sys.argv[3]16dst.mkdir(parents=True, exist_ok=True)17count = 018for test in json.loads((src / "manifest.json").read_text()):19 for a in test.get("attachments", []):20 name = re.sub(r"_\d+_[0-9A-F-]{36}\.png$", "", a.get("suggestedHumanReadableName", ""))21 if not name or not (src / a["exportedFileName"]).exists():22 continue23 shutil.copyfile(src / a["exportedFileName"], dst / f"{prefix}-{name.removeprefix('v2-')}.png")24 count += 125print(f"{count} captures → {dst}")26