Skip to content

feat(screenshots): capture every screen to PNG in CI - #9

Merged
farhan-syah merged 1 commit into
mainfrom
feat/screenshot-harness
Oct 24, 2026
Merged

farhan-syah merged 1 commit into
mainfrom
feat/screenshot-harness

Conversation

@farhan-syah

Copy link
Copy Markdown
Member

Summary

CI captures every screen of the real app as PNG, light and dark. The images live on an orphan screenshots branch, so they always match main and never enter the code history.

  • Scene runner (screenshots feature, Linux only): drives the app through 39 scenes using the app's own signals and the backend seam. Each scene captures WebKitGTK's own snapshot at 2x. On other targets the feature compiles to nothing.
  • scripts/screenshots.sh [dir]: builds and runs the capture under Xvfb. Writes light/*.png and dark/*.png.
  • .github/workflows/screenshots.yml:
    • Pull request: runs the scene tests, uploads the PNGs as an artifact, and lists changed, added, and removed screens in the job summary (scripts/screenshots-diff.sh).
    • Push to main: a separate job with contents: write replaces the single commit on the screenshots branch. It skips the push when no screen changed.
  • Theme fix: Preferences stored Light/Dark, but the stylesheet followed only the OS. The root now carries data-theme, and the dark tokens key on it.
  • Docs: README gets a light/dark hero image, a gallery, and capture steps. AGENTS.md gets the command and the rule that a new screen needs a scene.

Notes

  • Dependencies: webkit2gtk and cairo-rs (png feature) are optional and Linux-only. wry and tao already build both.
  • README links: they return 404 until the first push to main creates the screenshots branch.
  • Bare binaries: a bare binary, including cargo build --release output, renders unstyled. Dioxus loads asset! files from the source tree only under cargo run. The script uses cargo run, and README now says so.
  • Unconfirmed package names: this PR's run is the first check of the Ubuntu 24.04 names fonts-inter and fonts-jetbrains-mono.

Test plan

  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo nextest run --workspace --all-features: 283 passed
  • scripts/screenshots.sh locally: 78 PNGs, byte-identical across two runs
  • Screenshots workflow passes on this PR, and its artifact holds 78 PNGs

Add a `screenshots` feature (Linux) that runs a scene list through the
real app and snapshots WebKitGTK's pixels, light and dark. The root
element now carries a `data-theme` attribute that the stylesheet keys
the dark tokens on.

scripts/screenshots.sh runs the capture under Xvfb. A workflow uploads
the images on pull requests with a diff summary against main, and
publishes them to a `screenshots` branch on push to main for the
README.
@farhan-syah
farhan-syah merged commit f25c723 into main Oct 24, 2026
4 checks passed
@farhan-syah
farhan-syah deleted the feat/screenshot-harness branch October 24, 2026 21:03
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.

1 participant