Skip to content

20 AI testers on 20 different phones, in parallel, on GitHub's free runners: Claude Code agents on iOS Simulators and Android emulators that find broken flows, translation, layout and accessibility bugs

Accessibility check on every screen: controls with no name, touch targets under 48 dp / 44 pt

Pierre RAFFALLI88c430d699a4
diff --git a/AGENT_BRIEF.md b/AGENT_BRIEF.md
index d91c5d0..be4ce60 100644
--- a/AGENT_BRIEF.md
+++ b/AGENT_BRIEF.md
@@ -36,6 +36,9 @@ iOS
3. Layout on THIS device: cut text, buttons hidden by the keyboard, notch or home bar,
large text sizes, dark mode contrast.
4. Error and empty states: no network answer, empty lists, wrong input.
+5. Accessibility: when `screen.py` ends with an `accessibility check` line (controls with no
+ name, touch targets under 48 dp / 44 pt), look at those controls on the screenshot. Report
+ each kind once, with the screens where you saw it: minor, unless it stops a task.
## Final report
1. `results/<persona>/report.md`
diff --git a/scripts/a11y.py b/scripts/a11y.py
new file mode 100644
index 0000000..8288a36
--- /dev/null
+++ b/scripts/a11y.py
@@ -0,0 +1,148 @@
+"""Accessibility check of one screen, printed under the element list by screen.py.
+
+Flags two things a screen reader user or a shaky thumb runs into:
+- controls with no name (nothing for TalkBack or VoiceOver to read out),
+- touch targets under the platform minimum: 48 dp on Android, 44 pt on iOS.
+Elements cut by the edge of a scrolling list or of the screen are skipped,
+and so are big containers, keyboards and system switches. Returns one line,
+or None when the screen passes."""
+import re
+
+MAX_LISTED = 4
+
+
+def _line(noname, small, unit, minimum):
+ parts = []
+ if noname:
+ at = " ".join(f"({x},{y})" for x, y in noname[:MAX_LISTED])
+ more = f" and {len(noname) - MAX_LISTED} more" if len(noname) > MAX_LISTED else ""
+ parts.append(f"{len(noname)} control{'s' if len(noname) > 1 else ''} with no name at {at}{more}")
+ if small:
+ quoted = ['"%s" ' % n if n else "" for n, _, _, _, _ in small[:MAX_LISTED]]
+ at = ", ".join(f"{q}{w}x{h} {unit} at ({x},{y})" for q, (_, w, h, x, y) in zip(quoted, small[:MAX_LISTED]))
+ more = f" and {len(small) - MAX_LISTED} more" if len(small) > MAX_LISTED else ""
+ parts.append(f"{len(small)} touch target{'s' if len(small) > 1 else ''} under {minimum} {unit}: {at}{more}")
+ if not parts:
+ return None
+ return "accessibility check (confirm on the screenshot): " + "; ".join(parts)
+
+
+def _cut(box, frames, small_is_height):
+ """True if box touches or crosses the edge of one of frames (scroll areas, screen) along its small side."""
+ x1, y1, x2, y2 = box
+ for fx1, fy1, fx2, fy2 in frames:
+ if small_is_height and (y1 <= fy1 or y2 >= fy2):
+ return True
+ if not small_is_height and (x1 <= fx1 or x2 >= fx2):
+ return True
+ return False
+
+
+# ---------- Android: uiautomator dump ----------
+
+def _bounds(n):
+ b = re.findall(r"-?\d+", n.get("bounds", ""))
+ return tuple(map(int, b)) if len(b) == 4 else None
+
+
+def _name(n):
+ for m in n.iter("node"):
+ t = (m.get("text") or "").strip() or (m.get("content-desc") or "").strip()
+ if t:
+ return t
+ return ""
+
+
+def android(root, density, w, h):
+ """root: <hierarchy> element of `uiautomator dump`; density: dpi from `wm density`; w, h: screen in pixels."""
+ noname, small, seen = [], [], set()
+ screen = (0, 0, w, h)
+
+ def visit(n, scrolls):
+ b = _bounds(n)
+ if b and n.get("scrollable") == "true":
+ scrolls = scrolls + [b]
+ active = n.get("clickable") == "true" or n.get("long-clickable") == "true" or n.get("checkable") == "true"
+ if b and active and n.get("enabled") != "false":
+ x1, y1, x2, y2 = b
+ if x2 > x1 and y2 > y1 and (b, "a") not in seen:
+ seen.add((b, "a"))
+ cx, cy = (x1 + x2) // 2, (y1 + y2) // 2
+ name = _name(n)
+ big = (x2 - x1) * (y2 - y1) > 0.4 * w * h
+ if not name and not big:
+ noname.append((cx, cy))
+ wdp, hdp = round((x2 - x1) * 160 / density), round((y2 - y1) * 160 / density)
+ if min(wdp, hdp) < 48 and not _cut(b, scrolls + [screen], hdp <= wdp):
+ small.append((name[:30], wdp, hdp, cx, cy))
+ for c in n:
+ if c.tag == "node":
+ visit(c, scrolls)
+
+ for top in root:
+ if top.tag == "node":
+ visit(top, [])
+ return _line(noname, small, "dp", 48)
+
+
+# ---------- iOS: `axe describe-ui` ----------
+
+ACTIVE = ("Button", "Link", "Tab", "Switch", "Slider", "Cell", "MenuItem", "Stepper", "SegmentedControl")
+SCROLLING = ("ScrollView", "Table", "CollectionView", "List", "WebView")
+
+
+def _ios_kind(n):
+ return (n.get("type") or n.get("role_description") or "").strip()
+
+
+def _ios_name(n):
+ label = (n.get("AXLabel") or n.get("title") or "").strip()
+ if label:
+ return label
+ for c in n.get("children") or []:
+ if isinstance(c, dict):
+ label = _ios_name(c)
+ if label:
+ return label
+ return ""
+
+
+def ios(tree, wpt, hpt):
+ """tree: JSON of `axe describe-ui`; wpt, hpt: screen size in points."""
+ noname, small, seen = [], [], set()
+ screen = (0, 0, wpt, hpt)
+
+ def visit(n, scrolls):
+ if isinstance(n, list):
+ for c in n:
+ visit(c, scrolls)
+ return
+ if not isinstance(n, dict):
+ return
+ kind = _ios_kind(n)
+ if "Keyboard" in kind or kind == "Key":
+ return
+ f = n.get("frame") or {}
+ box = None
+ if f.get("width", 0) > 0 and f.get("height", 0) > 0:
+ box = (f["x"], f["y"], f["x"] + f["width"], f["y"] + f["height"])
+ if box and kind in SCROLLING:
+ scrolls = scrolls + [box]
+ if box and kind in ACTIVE and n.get("enabled", True) is not False:
+ x1, y1, x2, y2 = box
+ cx, cy = round((x1 + x2) / 2), round((y1 + y2) / 2)
+ on_screen = 0 <= cx <= wpt and 0 <= cy <= hpt
+ if on_screen and (cx, cy, kind) not in seen:
+ seen.add((cx, cy, kind))
+ name = _ios_name(n)
+ big = (x2 - x1) * (y2 - y1) > 0.4 * wpt * hpt
+ if not name and not big:
+ noname.append((cx, cy))
+ wd, hd = round(x2 - x1), round(y2 - y1)
+ if kind not in ("Switch", "Cell", "Slider") and min(wd, hd) < 44 \
+ and not _cut(box, scrolls + [screen], hd <= wd):
+ small.append((name[:30], wd, hd, cx, cy))
+ visit(n.get("children") or [], scrolls)
+
+ visit(tree, [])
+ return _line(noname, small, "pt", 44)
diff --git a/scripts/android/screen.py b/scripts/android/screen.py
index 1392d15..1d430ce 100644
--- a/scripts/android/screen.py
+++ b/scripts/android/screen.py
@@ -2,12 +2,16 @@
Usage: python3 scripts/android/screen.py <dir> <NN>
Saves <dir>/<NN>.png at HALF size (cheaper to read) and prints each element
with its centre in REAL screen pixels, ready for `adb shell input tap X Y`.
-Also prints crashes logged since the previous call."""
-import io, re, subprocess, sys
+Also prints crashes logged since the previous call, and an accessibility check
+(controls with no name, touch targets under 48 dp) when the screen fails it."""
+import io, os, re, subprocess, sys
import xml.etree.ElementTree as ET
from pathlib import Path
from PIL import Image
+sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
+import a11y # noqa: E402
+
def adb(*a, raw=False):
r = subprocess.run(["adb", *a], capture_output=True, timeout=60)
@@ -25,9 +29,10 @@ print(f"screenshot: {out}/{nn}.png (screen {w}x{h}; image is half size: multiply
adb("shell", "uiautomator", "dump", "/sdcard/ui.xml")
xml = adb("exec-out", "cat", "/sdcard/ui.xml")
try:
- nodes = list(ET.fromstring(xml[xml.find("<"):]).iter("node"))
+ root = ET.fromstring(xml[xml.find("<"):])
except ET.ParseError:
- nodes = []
+ root = ET.Element("hierarchy")
+nodes = list(root.iter("node"))
for n in nodes:
text, desc = (n.get("text") or "").strip(), (n.get("content-desc") or "").strip()
edit = n.get("class", "").endswith("EditText")
@@ -37,6 +42,16 @@ for n in nodes:
x1, y1, x2, y2 = map(int, b)
kind = "field" if edit else ("button" if n.get("clickable") == "true" else "text")
print(f"- {kind} \"{(text or desc)[:70]}\" centre=({(x1 + x2) // 2},{(y1 + y2) // 2})")
+try:
+ memo = Path(os.environ.get("RUNNER_TEMP", "/tmp")) / "density_dpi"
+ if not memo.exists():
+ dpi = re.findall(r"\d+", adb("shell", "wm", "density"))
+ memo.write_text(dpi[-1] if dpi else "160") # last one = override, if any
+ check = a11y.android(root, int(memo.read_text()), w, h)
+ if check:
+ print(check)
+except Exception: # the check must never break seeing the screen
+ pass
crash = adb("logcat", "-d", "-b", "crash") + adb("logcat", "-d", "AndroidRuntime:E", "ReactNativeJS:E", "*:S")
adb("logcat", "-c")
lines = [x for x in crash.splitlines() if x.strip() and not x.startswith("-----")]
diff --git a/scripts/ios/screen.py b/scripts/ios/screen.py
index 7a0a25f..1b4bc91 100644
--- a/scripts/ios/screen.py
+++ b/scripts/ios/screen.py
@@ -2,11 +2,15 @@
Usage: python3 scripts/ios/screen.py <dir> <NN>
The PNG is resized to the screen size in POINTS, so a position read on the
image goes straight to `bash scripts/ios/gesture.sh tap X Y`. Also warns
-when the app is no longer running or a crash report just appeared."""
+when the app is no longer running or a crash report just appeared, and prints an
+accessibility check (controls with no name, touch targets under 44 pt)."""
import json, os, subprocess, sys, time
from pathlib import Path
from PIL import Image
+sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
+import a11y # noqa: E402
+
UDID, APP = os.environ["UDID"], os.environ.get("APP_ID", "")
@@ -64,6 +68,12 @@ for kind, label, value, f in els:
name = "field" if "Field" in kind or kind == "TextArea" else ("button" if kind in ("Button", "Link", "Switch", "Cell", "Tab") else "text")
extra = f" value \"{value[:40]}\"" if value and value != label else ""
print(f"- {name} \"{(label or value)[:70]}\"{extra} centre=({cx},{cy})")
+try:
+ check = a11y.ios(tree, wpt, hpt)
+ if check:
+ print(check)
+except Exception: # the check must never break seeing the screen
+ pass
if APP and APP not in run("xcrun", "simctl", "spawn", UDID, "launchctl", "list"):
print("WARNING: the app is no longer running (crash or closed).")
reports = Path.home() / "Library/Logs/DiagnosticReports"