Skip to content

e2e: Cover the unread messages flows backed by the mock server read state - #6596

Draft
andremion wants to merge 3 commits into
developfrom
andrerego/and-1329-mock-server-endpoints-and-e2e-coverage-for-the-request
Draft

e2e: Cover the unread messages flows backed by the mock server read state#6596
andremion wants to merge 3 commits into
developfrom
andrerego/and-1329-mock-server-endpoints-and-e2e-coverage-for-the-request

Conversation

@andremion

@andremion andremion commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Goal

Cover the unread messages flows now that the mock server maintains per-user read state: the unread separator, the jump-to-unread button, its dismissal, and the mark-as-unread message action. Also fix a send-read race in the read receipt tests that the mock server's new sub-second timestamps expose.

Requires GetStream/stream-chat-test-mock-server#53 to be merged first: without the mock read state, the re-enabled tests cannot pass.

Related: AND-1329. The remaining coverage of the ticket (pinned messages screen, search, block, flag, mute, channel actions, threads list, reminders) comes in a follow-up PR.

Implementation

  • UnreadMessagesTests: the three tests @Ignored in e2e: Cover the Compose features supported by the current mock server #6591 (Allure 11453-11455) run again, and a new test_userMarksMessageAsUnread (Allure 6073) covers the mark-as-unread context menu action end to end, asserting the unread separator and the channel list badge.
  • The two tests that assert the unread count now wait for the channel list badge to settle before reopening the channel. The unread label is sticky per message-list visit and is computed from the first read-state emission, so reopening while the client is still processing the participant's message.new events captures a partial count.
  • New assertChannelUnreadCount: the badge exposes only a content description (clearAndSetSemantics in UnreadCountIndicator removes the child text and tag from the semantics tree), so the assertion matches the stream_compose_channel_item_unread plural and the stale Stream_UnreadCountIndicator selector is removed.
  • MessageDeliveryStatusTests: the four tests whose READ assertions depend on the participant reading after the user's send now wait for the delivery status first, the same fix e2e: Cover the Compose features supported by the current mock server #6591 applied to the participant pin. The send is asynchronous after the composer tap, so the participant's read request could reach the mock server before the message it should mark as read. Second-precision mock timestamps used to hide the wrong order as a tie; with real sub-second precision the order is exposed and the test flaked on slower CI emulators.

Testing

Ran locally against the mock server PR branch (API 35 emulator) via direct instrumentation, each test isolated with a data clear like the CI orchestrator does:

spotlessCheck and detekt pass on the touched module. Test-only change, no public API impact.

Summary by CodeRabbit

  • New Features

    • Added the ability to mark messages as unread from the message actions menu.
    • Channel previews now display updated unread message counts.
    • Unread separators reflect messages marked unread and newly received messages.
  • Bug Fixes

    • Improved reliability of message delivery status and unread message indicators across channels and threads.
    • Improved handling of failed message delivery states in channel previews.

The mock server now maintains per-user read state, so the unread
separator and jump-to-unread tests (11453-11455) run again. Add the
mark-as-unread flow (6073) and a channel list unread badge assertion,
waiting for the badge before reopening the channel so the sticky unread
label is computed from settled state instead of racing the event queue.

The badge exposes only a content description (clearAndSetSemantics in
UnreadCountIndicator removes the text and tag from the semantics tree),
so the assertion matches the stream_compose_channel_item_unread plural
and the stale resource-id selector is removed.
The send is asynchronous after the composer tap, so the participant's
read request could reach the mock server before the message it should
mark as read, leaving the message unread and the double checkmark
never shown. Same fix as for the participant pin. Second-precision mock
timestamps used to hide the wrong order as a tie; with real sub-second
precision the order is exposed.
@andremion andremion added the pr:test Test-only changes label Jul 28, 2026
@andremion

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2dd436b2-3078-4f1b-9ad1-2654d9cc1174

📥 Commits

Reviewing files that changed from the base of the PR and between a7bbf7f and 7d55dd5.

📒 Files selected for processing (5)
  • stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/io/getstream/chat/android/compose/pages/ChannelListPage.kt
  • stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/io/getstream/chat/android/compose/robots/UserRobot.kt
  • stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/io/getstream/chat/android/compose/robots/UserRobotChannelListAsserts.kt
  • stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/io/getstream/chat/android/compose/tests/MessageDeliveryStatusTests.kt
  • stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/io/getstream/chat/android/compose/tests/UnreadMessagesTests.kt
💤 Files with no reviewable changes (1)
  • stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/io/getstream/chat/android/compose/pages/ChannelListPage.kt

Walkthrough

Compose end-to-end coverage now verifies channel unread counts, marking messages unread, unread separators, and message delivery reaching SENT before subsequent participant actions.

Changes

Compose E2E coverage

Layer / File(s) Summary
Robot helpers and selectors
stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/io/getstream/chat/android/compose/pages/ChannelListPage.kt, .../robots/UserRobot.kt, .../robots/UserRobotChannelListAsserts.kt
Adds message-unread and channel-unread-count helpers, and replaces the channel selector with the failed delivery-status selector.
Unread-message scenarios
.../tests/UnreadMessagesTests.kt
Re-enables ignored tests and adds assertions for unread counts, unread separators, marking messages unread, and dismissing the unread indicator.
Delivery-status synchronization
.../tests/MessageDeliveryStatusTests.kt
Adds SENT assertions after sending messages and thread replies before read and participant-removal actions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: gpunto, velikovpetar

Poem

A rabbit checks the unread trail,
Marks one message, counts the tale.
“Sent!” the checkmarks softly say,
Separators guide the way.
Hop through tests—green lights prevail!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the unread-message flow coverage backed by mock server read state.
Description check ✅ Passed The description covers Goal, Implementation, and Testing, and is sufficiently detailed for this repository.
Linked Issues check ✅ Passed The unread-message coverage and selector/test support align with the deferred scope described in #6591.
Out of Scope Changes check ✅ Passed The selector, assertion, and read-status test changes support the unread flows and do not introduce unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch andrerego/and-1329-mock-server-endpoints-and-e2e-coverage-for-the-request

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.95 MB 5.95 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.22 MB 11.22 MB 0.00 MB 🟢
stream-chat-android-compose 12.70 MB 12.70 MB 0.00 MB 🟢

… unread tests

On a slow emulator the participant's first message could reach the mock
server before the user's own message, changing the message order the
tests rely on for the separator position and the marked message index.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:test Test-only changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant