Skip to content

e2e: Port the iOS push notification tests#6574

Merged
andremion merged 4 commits into
developfrom
andrerego/and-1311-port-the-ios-push-notification-e2e-tests
Jul 17, 2026
Merged

e2e: Port the iOS push notification tests#6574
andremion merged 4 commits into
developfrom
andrerego/and-1311-port-the-ios-push-notification-e2e-tests

Conversation

@andremion

@andremion andremion commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Goal

Port the iOS push notification e2e tests, the last topic of the iOS parity gap. Resolves AND-1311.

Push is the one feature that does not travel over the app's own connection, so it needs a delivery path the mock server can drive. The 7 tests bind to their pre-seeded Allure TestOps case ids via @AllureId.

Implementation

  • PushTestReceiver (e2e flavor): an exported broadcast receiver that turns the payload extras into a RemoteMessage and hands it to FirebaseMessagingDelegate.handleRemoteMessage, the same entry point a real FCM message uses. The payload then goes through the SDK's real validation and notification rendering, so the four degradation tests exercise the actual PayloadValidator. No Play services or root needed.
  • StartupActivity (e2e flavor): a launch from a notification tap routes to the channel via TaskStackBuilder, mirroring the demo flavor. Initialization is guarded on the presence of the BASE_URL extra, so a tap launch reuses the already initialized client instead of re-initializing and tearing down the live one.
  • Robots: ParticipantRobot.sendPushNotification posts to the mock endpoint with the receiver component; UserRobot gets notification-shade helpers; UserRobotPushAsserts asserts a notification is or is not shown.
  • 7 tests: two happy paths (from message list, from channel list), four optional-value degradations, and one invalid-required-values case that asserts no notification appears and the messages still arrive on foreground.

Requires GetStream/stream-chat-test-mock-server#46 for the Android delivery branch of /participant/push; until it merges, these tests fail on CI.

Not ported: iOS scenarios goToBackgroundFrom*_and_tapOnPushNotification no longer exist in the iOS suite, so this is 7 tests, not the 9 case ids originally seeded; the two orphan ids go on the TestOps cleanup list in AND-1301.

Testing

All 7 pass locally as a suite against the mock server (PR #46 branch) on a Pixel 8 API 35 emulator, first attempt:

./gradlew :stream-chat-android-compose-sample:connectedE2eDebugAndroidTest \
  -Pandroid.testInstrumentationRunnerArguments.class=io.getstream.chat.android.compose.tests.PushNotificationTests

No UI changes to the SDK.

Summary by CodeRabbit

  • New Features

    • Added support for opening push notifications directly into the relevant channel and message.
    • Improved notification navigation for messages launched from both channel and message lists.
    • Added coverage for push notifications with optional or malformed payload data.
  • Bug Fixes

    • Improved handling of invalid notification payloads so unsupported notifications are ignored safely.
    • Preserved message navigation context, including parent messages, when opened from a notification.

@github-actions

github-actions Bot commented Jul 15, 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.

@andremion andremion added the pr:test Test-only changes label Jul 15, 2026
@andremion

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 15, 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.

@andremion
andremion requested a review from testableapple July 15, 2026 15:09
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds end-to-end push notification infrastructure and coverage for the Compose sample, including mock payload delivery, notification-shade assertions, notification deep-link navigation, and valid, degraded, and invalid payload scenarios.

Changes

Push notification E2E flow

Layer / File(s) Summary
Mock push delivery and receiver
stream-chat-android-e2e-test/.../ParticipantRobot.kt, stream-chat-android-compose-sample/src/e2e/.../PushTestReceiver.kt, stream-chat-android-compose-sample/src/e2e/AndroidManifest.xml
Adds a mock push request API, registers the exported test receiver, converts broadcast extras into an FCM message, and forwards it to the Firebase messaging delegate.
Notification deep-link navigation
stream-chat-android-compose-sample/src/e2e/.../StartupActivity.kt
Handles notification launches separately from test initialization and forwards channel, message, and parent-message identifiers through the navigation stack.
Notification assertions and E2E scenarios
stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/.../robots/*, stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/.../tests/PushNotificationTests.kt
Adds notification-shade actions and assertions, plus tests for notification receipt, tapping, degraded optional payloads, and invalid required payloads.

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

Sequence Diagram(s)

sequenceDiagram
  participant ParticipantRobot
  participant PushTestReceiver
  participant FirebaseMessagingDelegate
  participant NotificationShade
  participant StartupActivity
  participant ChannelActivity

  ParticipantRobot->>PushTestReceiver: send mock push payload
  PushTestReceiver->>FirebaseMessagingDelegate: handleRemoteMessage(RemoteMessage)
  FirebaseMessagingDelegate->>NotificationShade: display push notification
  NotificationShade->>StartupActivity: launch with channel and message extras
  StartupActivity->>ChannelActivity: build and open channel navigation
Loading

Suggested labels: pr:new-feature, pr:ci

Poem

I’m a rabbit with alerts in my ear,
Mock pushes hop from far to near.
Shade opens wide, messages gleam,
Deep links whisk through a channel stream.
Good payloads stay; bad ones hide—
E2E carrots tested side by side!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: porting iOS push notification e2e tests to Android.
Description check ✅ Passed The description covers Goal, Implementation, and Testing with specific details; missing template sections are non-critical for this change.
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.
✨ 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-1311-port-the-ios-push-notification-e2e-tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-sample/src/androidTestE2eDebug/kotlin/io/getstream/chat/android/compose/robots/UserRobotPushAsserts.kt`:
- Around line 40-45: Update UserRobot.assertPushNotificationDoesNotAppear so the
negative assertion waits through the asynchronous notification-delivery window
before evaluating visibility. Use the framework’s full-duration wait mechanism,
such as By.text(text).waitDisplayed with the appropriate timeout, or an
equivalent explicit delay, and assert the notification remains absent before
pressing back and returning.
🪄 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: fc93a9da-7a8e-4e5f-937b-fa6fa6824715

📥 Commits

Reviewing files that changed from the base of the PR and between 4338a8e and ae77eb4.

📒 Files selected for processing (7)
  • 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/UserRobotPushAsserts.kt
  • stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/io/getstream/chat/android/compose/tests/PushNotificationTests.kt
  • stream-chat-android-compose-sample/src/e2e/AndroidManifest.xml
  • stream-chat-android-compose-sample/src/e2e/java/io/getstream/chat/android/compose/sample/push/PushTestReceiver.kt
  • stream-chat-android-compose-sample/src/e2e/java/io/getstream/chat/android/compose/sample/ui/StartupActivity.kt
  • stream-chat-android-e2e-test/src/main/kotlin/io/getstream/chat/android/e2e/test/robots/ParticipantRobot.kt

@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.21 MB 11.21 MB 0.00 MB 🟢
stream-chat-android-compose 12.69 MB 12.69 MB 0.00 MB 🟢

@andremion

andremion commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

CI note: the red Test compose batches fail only on the push tests, which depend on GetStream/stream-chat-test-mock-server#46. They pass once #46 merges.

@andremion
andremion marked this pull request as ready for review July 16, 2026 07:48
@andremion
andremion requested a review from a team as a code owner July 16, 2026 07:48

@testableapple testableapple 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.

LGTM, just make sure tests are green 👍

@andremion

Copy link
Copy Markdown
Contributor Author

LGTM, just make sure tests are green 👍

Sure. It will be when GetStream/stream-chat-test-mock-server#46 is merged 🙏🏻

@andremion
andremion force-pushed the andrerego/and-1311-port-the-ios-push-notification-e2e-tests branch from 1b61fdb to 716f71c Compare July 17, 2026 09:10
@sonarqubecloud

Copy link
Copy Markdown

@andremion
andremion enabled auto-merge (squash) July 17, 2026 13:31
@andremion
andremion merged commit 9780755 into develop Jul 17, 2026
21 of 24 checks passed
@andremion
andremion deleted the andrerego/and-1311-port-the-ios-push-notification-e2e-tests branch July 17, 2026 13:57
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.

3 participants