Add Compose snapshot tests for redesigned components#6424
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
9c7c249 to
fa0978a
Compare
1ae271a to
4f729f9
Compare
WalkthroughThis PR refactors Compose preview composables into granular, reusable helpers across multiple UI components, adds comprehensive Paparazzi snapshot tests for component variants, and refactors the typing indicator animation to use ValueAnimator-driven animation instead of System.currentTimeMillis()-based timing for deterministic control. ChangesCompose Previews & Snapshot Testing
Typing Animation Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollAnswers.kt`:
- Around line 388-417: The previewPollWithAnswers() function uses Date() (now)
for createdAt/updatedAt which causes snapshot drift; replace the dynamic now
with a fixed Date/Instant constant (e.g., a single fixed epoch value) and use
that constant for all Answer.createdAt and updatedAt values so PollAnswersItem
rendering is deterministic for Paparazzi snapshots.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 61dfb668-96e0-4675-a5cc-4377c602df6f
⛔ Files ignored due to path filters (22)
stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.button_StreamButtonTest_button_sizes.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.button_StreamButtonTest_disabled_buttons.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.button_StreamButtonTest_enabled_buttons.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.common_CountBadgeTest_count_badge_sizes.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_MessageFooterTest_outgoing_thread_start_with_replies.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_MessageReactionsTest_clustered_reactions.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_MessageReactionsTest_overflow_segmented_reactions.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_MessageReactionsTest_overflow_segmented_reactions_in_dark_mode.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_MessageReactionsTest_segmented_reactions.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_QuotedMessageTest_from_other_user.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_QuotedMessageTest_from_self.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_QuotedMessageTest_in_composer.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_QuotedMessageTest_with_file_attachment.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_QuotedMessageTest_with_image_attachment.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_QuotedMessageTest_with_long_text.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.poll_PollAnswersTest_closed_anonymous.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.poll_PollAnswersTest_content.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.poll_PollAnswersTest_with_current_user_answer.pngis excluded by!**/*.pngstream-chat-android-ui-components/src/test/snapshots/images/io.getstream.chat.android.ui.feature.channels.header_ChannelListHeaderViewTest_connecting,_no_user.pngis excluded by!**/*.pngstream-chat-android-ui-components/src/test/snapshots/images/io.getstream.chat.android.ui.feature.channels.header_ChannelListHeaderViewTest_connecting,_with_user.pngis excluded by!**/*.pngstream-chat-android-ui-components/src/test/snapshots/images/io.getstream.chat.android.ui.feature.channels.list_ChannelListViewTest_loaded_channels.pngis excluded by!**/*.pngstream-chat-android-ui-components/src/test/snapshots/images/io.getstream.chat.android.ui.feature.channels.list_ChannelListViewTest_loading_channels.pngis excluded by!**/*.png
📒 Files selected for processing (16)
stream-chat-android-compose/api/stream-chat-android-compose.apistream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/button/StreamButton.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/common/ContextualMenu.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/common/CountBadge.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messageactions/UserReactionRow.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/MessageReactions.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/QuotedMessage.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollAnswers.ktstream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/components/button/StreamButtonTest.ktstream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/components/common/CountBadgeTest.ktstream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/components/messages/MessageFooterTest.ktstream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/components/messages/MessageReactionsTest.ktstream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/components/messages/QuotedMessageTest.ktstream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/components/poll/PollAnswersTest.ktstream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/widgets/typing/internal/TypingIndicatorAnimationView.ktstream-chat-android-ui-components/src/test/kotlin/io/getstream/chat/android/ui/PaparazziViewTest.kt
|



Goal
Backfill Paparazzi snapshot coverage for Compose components introduced during the
redesigned. Also fixed the typing dot indicator's animation not being deterministic in snapshot
tests.
Implementation
StreamButton,CountBadge,MessageReactions,QuotedMessage.MessageFooterTestwith an outgoing thread-start case to cover theMessageAlignment.Endvariant of
MessageThreadFooter.System.currentTimeMillis()inTypingDrawablewith aValueAnimator. The drawable nowimplements
Animatableand starts/stops viaDrawable.setVisible, the standard hookImageViewalready calls on attach/detach/visibility changes. Add Paparazzi's
InstantAnimationsRuletoPaparazziViewTestso the animator settles to a deterministic frame in tests.Testing
verifyPaparazziDebug.frame the typing indicator. Re-running
verifyPaparazziDebugshould no longer produces drift.Summary by CodeRabbit
Bug Fixes
Tests