capturing-preview-screenshots-in-ci

Renders Jetpack Compose previews as device screenshots and publishes an HTML catalog from CI.

1|Updated Jul 6, 2026
One-click install
npx skills add https://github.com/citytexi/team-yg-pesonal-agent --skill capturing-preview-screenshots-in-ci-citytexi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: capturing-preview-screenshots-in-ci
Source: https://github.com/citytexi/team-yg-pesonal-agent/tree/main/.claude/skills/capturing-preview-screenshots-in-ci
Command: npx skills add https://github.com/citytexi/team-yg-pesonal-agent --skill capturing-preview-screenshots-in-ci-citytexi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Compose @Preview functions live only in one engineer's IDE on a renderer that is not a real device, so teams lack a shared, browsable artifact of every UI component. This Skill renders every @Preview on a real device or emulator, collects the PNGs into a searchable HTML catalog, regenerates it from CI on every commit, and serves it from GitHub Pages. ## Core Features & Use Cases - Bulk preview capture: Run ./gradlew captureAllPreviews to scan all @Preview functions, screenshot each on a running app via HotSwanPreviewActivity, and generate an HTML catalog with search, module grouping, and dark/light toggle. - Single-preview ADB capture: Screenshot one preview from a shell script using am start with the composable FQN extra plus screencap, no IDE required. - Render-delay tuning: Set a low global renderDelayMs and override per preview with @PreviewScreenshot(renderDelay = ...) for screens loading network images or animations. - CI/CD integration: Run on GitHub Actions with android-emulator-runner or Gradle Managed Devices, then deploy the catalog to GitHub Pages. - Use Case: A design team wants a URL where they can browse every Compose component after each merge to main; the CI workflow boots an emulator, installs and launches the debug app, captures all previews, and publishes the catalog to Pages. ## Quick Start Ask the AI to set up the HotSwan Gradle plugin and a GitHub Actions workflow that runs captureAllPreviews on an emulator and deploys the preview catalog to GitHub Pages.

Frequently Asked Questions about capturing-preview-screenshots-in-ci

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I capture all Compose previews as screenshots in CI?▼

Apply the HotSwan Gradle compiler plugin, add the preview library as debugImplementation, then run ./gradlew captureAllPreviews with the debug app installed and launched on a connected emulator. The task scans all @Preview functions, screenshots each, and generates an HTML catalog in .hotswan/preview-captures/.

Paparazzi vs Roborazzi vs device screenshots for Compose testing?▼

Paparazzi and Roborazzi render on the host JVM via layoutlib and provide pixel-diff golden-image regression gates without an emulator. HotSwan captureAllPreviews renders on a real device with full runtime behavior and produces a browsable catalog, but does not diff images. Many projects run both.

How do I screenshot a single Compose preview over ADB?▼

Launch HotSwanPreviewActivity with adb shell am start, passing the preview's fully-qualified function name as the composable string extra, wait for rendering, then run adb exec-out screencap -p to save the PNG. The debug app must be installed and launched first.

Why does captureAllPreviews produce an empty catalog in CI?▼

The task drives the running app's process, so it fails if no APK is installed or no Activity was started on the emulator. Build the debug APK, install it with adb install -r, launch the main Activity, wait a few seconds, then run captureAllPreviews.

How do I fix half-painted screenshots of previews loading network images?▼

Keep the global renderDelayMs low (around 1000 ms) and annotate slow previews with @PreviewScreenshot(renderDelay = 3000-5000). A blanket high global delay wastes minutes on large catalogs since every preview waits that long.

Can captureAllPreviews fail the build on visual regressions?▼

No. captureAllPreviews produces a catalog and does not store golden images or pixel-diff, so nothing fails when a screenshot changes. Use Paparazzi or Roborazzi as a regression gate alongside it if you need diff-based failures.