Execute a single UI test case and return its result. Works across iPhone, iPad, and macOS — pass the platform param to adjust behavior. Requires the app to already be built and running before calling this skill. Returns: pass, flaky, or fail — with screenshot path, logs, and root cause on failure.
How this skill is triggered — by the user, by Claude, or both
Slash command
/apple-ui-test-automation:run-test-caseThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- `test_case` — one parsed test case object (id, name, feature, steps, expect)
test_case — one parsed test case object (id, name, feature, steps, expect)platform — "iphone" | "ipad" | "macos"udid — simulator UDID (omit for macOS)bundle_id — app bundle identifierreport_dir — path to write screenshots, e.g. tests/reports/screenshotsiPhone / iPad:
Navigate to a known base state before running:
axe tap --label Dashboard --udid <UDID> --wait-timeout 3
If this fails (modal blocking, crash):
xcodebuildmcp simulator stop --simulator-id <UDID> --bundle-id <bundle>
xcodebuildmcp simulator launch-app --simulator-id <UDID> --bundle-id <bundle>
Then poll until interactive (max 30s, retry every 3s):
axe describe-ui --udid <UDID>
# Success: root element has "type": "Application"
macOS: Skip reset. macOS apps do not have a tab bar to navigate to. Proceed directly to Step 2.
Translate all YAML steps into a single axe batch call via stdin.
iPhone / iPad:
axe batch --udid <UDID> --stdin << 'EOF'
tap --label <label> --wait-timeout 5
type '<text>'
EOF
macOS:
axe batch --stdin << 'EOF'
tap --label <label> --wait-timeout 5
type '<text>'
EOF
Rules:
--stdin, not --step or --file--wait-timeout to every tap and navigate stepRun describe-ui in a separate call (batch is fire-and-forget):
iPhone / iPad: axe describe-ui --udid <UDID>
macOS: axe describe-ui
For each expect entry:
ui_contains: "X" → assert element with AXLabel == "X" existselement_not_exists: "X" → assert NO element with AXLabel == "X" existsIf all pass, capture screenshot and return ✅:
iPhone / iPad: axe screenshot --udid <UDID> --output <report_dir>/<id>-pass.png
macOS: axe screenshot --output <report_dir>/<id>-pass.png
If any assertion fails:
Capture error screenshot:
axe screenshot --udid <UDID> --output <report_dir>/<id>-error.pngaxe screenshot --output <report_dir>/<id>-error.pngStart log capture:
xcodebuildmcp logging start-simulator-log-capture \
--simulator-id <UDID> \ # omit on macOS
--bundle-id <bundle> \
--capture-console true
# Save the returned logSessionId
Retry the failing step only with --wait-timeout 5, then re-run describe-ui and assert again.
Stop log capture:
xcodebuildmcp logging stop-simulator-log-capture --log-session-id <logSessionId>
Determine result:
Suggest root cause from logs:
{
id: string
name: string
feature: string
result: "pass" | "flaky" | "fail"
duration_s: number
screenshot: string
error?: string
logs?: string
suggested_cause?: string
}
npx claudepluginhub hoangdh2001/apple-app-ui-test-automation --plugin apple-ui-test-automationGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.