-
Notifications
You must be signed in to change notification settings - Fork 20
Add paparazzi and compose snapshots preview #693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| val previewInfo = preview.previewInfo | ||
| preview() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: The previewInfo variable is extracted but unused. The preview() object is invoked directly, which likely ignores the intended preview configuration for the snapshot test.
Severity: HIGH | Confidence: High
🔍 Detailed Analysis
In the snapshot test, the previewInfo variable is extracted from the preview object but is never used. Instead, the preview() object is invoked directly. According to the library's documentation, the composable function should be invoked via the previewInfo object (e.g., previewInfo.previewComposable.invoke()). This discrepancy means that important configuration metadata from the @Preview annotation, such as device settings, locale, and theme, is likely being ignored. As a result, the generated snapshots may not reflect the intended configuration, leading to incorrect or failing tests.
💡 Suggested Fix
Replace the direct invocation preview() with the invocation from the previewInfo object, such as previewInfo.previewComposable.invoke(). This will ensure the composable is rendered with the correct configuration specified in its @Preview annotation.
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location:
android/app/src/test/kotlin/com/emergetools/hackernews/ComposePreviewScanner.kt#L38-L40
Potential issue: In the snapshot test, the `previewInfo` variable is extracted from the
`preview` object but is never used. Instead, the `preview()` object is invoked directly.
According to the library's documentation, the composable function should be invoked via
the `previewInfo` object (e.g., `previewInfo.previewComposable.invoke()`). This
discrepancy means that important configuration metadata from the `@Preview` annotation,
such as device settings, locale, and theme, is likely being ignored. As a result, the
generated snapshots may not reflect the intended configuration, leading to incorrect or
failing tests.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 7526923
🛰️ Build DistributionBuild available for installation
🛸 Powered by Emerge Tools |
Restored BookmarksScreenComposeTest.kt and StoryRowComposeTest.kt from git history to maintain test coverage for Compose UI components.
⏱ Performance AnalysisHacker News
🛸 Powered by Emerge Tools |
…r test Ensures the output directory is cleaned before generating new preview scanner test files to prevent stale generated files from accumulating. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
📸 Snapshot Test8 added, 84 unchanged
🛸 Powered by Emerge Tools |
This adds paparazzi and the compose snapshots preview library to scan and find compose previews for paparazzi.
Paparazzi + compose snapshots preview folder is in
android/paparazzi-preview-scanner-plugin