Skip to content

Add Xcode Cloud screenshot fetch scripts and tests - #17

Draft
gsbernstein wants to merge 10 commits into
cursor/extract-cozy-colors-b65cfrom
cursor/xcode-cloud-screenshots-fb5b
Draft

Add Xcode Cloud screenshot fetch scripts and tests#17
gsbernstein wants to merge 10 commits into
cursor/extract-cozy-colors-b65cfrom
cursor/xcode-cloud-screenshots-fb5b

Conversation

@gsbernstein

@gsbernstein gsbernstein commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Summary

Xcode Cloud screenshots on every push — no manual triggers or custom polling.

Flow

push → Xcode Cloud runs BedtimeUITests → ci_post extracts PNGs
     → uploads to Imgur → sticky commit comment (success / failed / diff vs main)

Cursor waits for CI, then reads the commit comment on that push's SHA.

What's included

  • BedtimeUITests/ScreenshotTests.swift — scenario-named screenshot capture
  • Bedtime/ci_scripts/ci_post_xcodebuild.sh — extract, upload, comment (including failures)
  • Commit comments on main (baseline) and PRs (before/after vs CI_PULL_REQUEST_TARGET_COMMIT)

Removed (no longer needed)

  • trigger-screenshots.sh
  • wait-for-commit-report polling
  • App Store Connect API fetch/trigger commands

Secrets (Xcode Cloud)

  • IMGUR_CLIENT_ID
  • GITHUB_TOKEN (commit comment write)

New screenshot scenarios

Merge new test cases to main early so the baseline exists before feature work diverges.

Open in Web Open in Cursor 

cursoragent and others added 10 commits June 28, 2026 19:08
Introduce a Python CLI that downloads Xcode Cloud test result bundles via
the App Store Connect API, extracts UI test screenshots with xcresulttool
when available, and can post a summary comment to GitHub PRs.

Add ci_post_xcodebuild.sh so extraction can run directly on the Xcode Cloud
Mac using CI_RESULT_BUNDLE_PATH, avoiding a separate macOS runner.

Include pytest coverage with mocked API responses for the fetch path.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Expose a trigger-and-fetch CLI command that starts a workflow via the App
Store Connect API, polls until the build run completes, and then downloads
screenshots in one blocking invocation.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Document the macOS-only xcresulttool extraction requirement prominently and
make the recommended PR path extract-on-Xcode-Cloud, upload to a public
bucket, then embed stable URLs in GitHub comments.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Imgur only needs a free Client-ID for anonymous uploads, which is much
lighter than S3. Auto-detect prefers Imgur when IMGUR_CLIENT_ID is set.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Add BedtimeUITests with ScreenshotTests that capture home and settings
screens via XCTAttachment (.keepAlways) for Xcode Cloud PR previews.

Support -ui_testing launch argument with mock sleep data so simulator runs
do not require HealthKit authorization.

Remove the pytest suite for the Python fetch/upload helpers; those scripts
remain as optional post-build tooling.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Add trigger-screenshots.sh for branch/tag pushes that start a dedicated
screenshots/* Xcode Cloud workflow without App Store Connect credentials.

Parse What to test notes from commit messages and auto-detect PR context from
CI_PULL_REQUEST_* or screenshots/pr-N branch names in ci_post_xcodebuild.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Compare new screenshots against a per-PR baseline stored on the
screenshot-baselines branch. Only changed and new screenshots appear
in the PR comment table; unchanged runs get a short no-changes note.
The same comment is updated in place each build via a hidden marker.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Replace the screenshot-baselines JSON branch with sticky GitHub commit
comments. Main builds embed Imgur URLs in the comment metadata; PR
builds compare against CI_PULL_REQUEST_TARGET_COMMIT and post a
before/after table on the PR head commit.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Post terminal success/failed/no_screenshots commit comments from ci_post
even when xcodebuild fails. Add hidden build-status metadata, comment-build
and wait-for-commit-report CLI commands, and poll instructions in
trigger-screenshots.sh.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Xcode Cloud runs on every push; Cursor can wait for CI instead of
custom polling. Drop trigger-screenshots.sh, wait-for-commit-report,
and ASC fetch/trigger commands. Keep ci_post, Imgur upload, and commit
comments as the only integration surface.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants