Skip to content

Wait for the WebSocket disconnect before sending pushes in the push notification E2E tests - #6767

Merged
gpunto merged 1 commit into
developfrom
fix/e2e-push-socket-race
Oct 2, 2026
Merged

gpunto merged 1 commit into
developfrom
fix/e2e-push-socket-race

Conversation

@gpunto

@gpunto gpunto commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Fix the flaky push notification E2E tests. The push was sometimes sent before the app's WebSocket disconnected after going to background, so the SDK ignored it as the socket was connected.

Closes AND-1599

Implementation

  • Wait for the WebSocket disconnect with BackendRobot.waitForWebSocketDisconnection() after every goToBackground() in PushNotificationTests, as MessageListTests already does.

Testing

The E2E run on this PR covers it.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Updated push-notification test flows to wait for the WebSocket connection to close after the app is backgrounded and before a notification is sent.

@gpunto gpunto added the pr:test Test-only changes label Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

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.

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.16 MB 6.16 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.46 MB 11.46 MB 0.00 MB 🟢
stream-chat-android-compose 13.14 MB 13.14 MB 0.00 MB 🟢

@sonarqubecloud

sonarqubecloud Bot commented Oct 1, 2026

Copy link
Copy Markdown

@gpunto
gpunto marked this pull request as ready for review October 2, 2026 07:36
@gpunto
gpunto requested a review from a team as a code owner October 2, 2026 07:36
@gpunto
gpunto enabled auto-merge October 2, 2026 07:36
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: df9d6a63-4093-4e31-baea-bda105ee7840

📥 Commits

Reviewing files that changed from the base of the PR and between cd00309 and 64e3181.

📒 Files selected for processing (1)
  • stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/io/getstream/chat/android/compose/tests/PushNotificationTests.kt

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

Four push-notification test flows now wait for the user’s WebSocket connection to close after the app goes to the background and before sending a notification.

Changes

Push notification test synchronization

Layer / File(s) Summary
Wait for WebSocket disconnection
stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/io/getstream/chat/android/compose/tests/PushNotificationTests.kt
The message-list, channel-list, invalid-required-values, and degraded-optional-values flows wait for WebSocket disconnection before sending notifications.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Other

Suggested reviewers: andremion

Merge Risk: ⚪ Minimal · up to 64e31

The added waits should reduce race-related push-test flakes. The external status contract is unavailable, but current evidence does not show that the synchronization is mis-scoped or identify a verified issue blocking merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: waiting for WebSocket disconnection before sending push notifications in E2E tests.
Description check ✅ Passed The description includes the goal, implementation details, linked issue, and testing information. It omits the contributor and reviewer checklists, UI sections, and GIF, but these omissions are non-cr…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

A rabbit checks the socket’s state
Then waits until the link is closed
Four test paths prepare their notes
A push arrives when each is ready
The rabbit hops, the checks complete

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

@andremion andremion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Small thing on the description, not blocking: the push isn't dropped as a duplicate of the live event. ChatClient.handlePushMessage ignores it while the socket is connected (ignorePushMessageWhenUserOnline defaults to true for message.new). Happy to be told otherwise.

@gpunto
gpunto added this pull request to the merge queue Oct 2, 2026
Merged via the queue into develop with commit fcba859 Oct 2, 2026
21 of 22 checks passed
@gpunto
gpunto deleted the fix/e2e-push-socket-race branch October 2, 2026 09:33
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.

2 participants