Skip to content

ci(repo): Add E2E message list tests - #2854

Open
testableapple wants to merge 22 commits into
masterfrom
ci/message-list-tests
Open

ci(repo): Add E2E message list tests#2854
testableapple wants to merge 22 commits into
masterfrom
ci/message-list-tests

Conversation

@testableapple

@testableapple testableapple commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Linear: https://linear.app/stream/issue/FLU-603

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

Ports the native MessageList_Tests.swift / MessageListTests.kt suite to the sample app's integration tests, plus the harness plumbing it needed. Second suite after #2825 (reactions).

New tests (integration_test/message_list_test.dart) — 27 total: 23 active, 4 skipped

  • Send — by user / by participant, one emoji, multiple emojis, receiving an emoji, multiline
  • Edit — by user through the UI, by participant through the mock server (incl. the Edited footnote)
  • Delete — by user through the UI, by participant, participant hard-delete
  • Typing indicators — in the channel and in a thread
  • Offline — participant message received while the user is offline
  • Threads — a participant's thread reply appears in the thread
  • Mentions — the overlay appears on @ and disappears when it's removed
  • Scrolling — auto-scrolls when a message arrives at the bottom, does not when scrolled up
  • Pagination — seeds 60 messages and scrolls up to the oldest
  • Link preview — participant-sent YouTube link
  • Geometry — message cell grows/shrinks when edited, composer stops growing at its line limit

Harness additions

  • pages/message_list_page.dart — action rows, list, composer overlays, back button, thread header. All selectors reuse identifiers the SDK already exposes; no test-only keys were added to the SDK.
  • support/widget_test_extensions.darttapFinder (ensureVisible + tap for below-fold modal rows), scrollMessageList(delta), scrollUpUntilVisible, plus a bounded settle() so a perpetual reconnect animation can't hang pumpAndSettle.
  • robots/user_robot.dart — edit / delete / openThread / typeText / clearComposer / tapBackButton / scroll, with chain mirrors; user_robot_message_list_asserts.dart gained edited / deleted / hardDeleted / typing / mentions / linkPreview / threadReply asserts plus pagination and the two getSize-based geometry asserts.
  • robots/participant_robot.dart — chain mirrors for editMessage / deleteMessage / sendMessageInThread / startTyping / stopTyping.
  • support/stream_test_env.dartmoveToBackground() / moveToForeground() lifecycle helpers.
  • lib/pages/thread_page.dart — the sample app's thread page now renders a StreamTypingIndicator(parentId:), which is what the thread-typing test asserts on.

CI: recover a simulator that dies mid-run

The first nightly run of this suite exposed an unrelated harness gap. On the iOS 17.5 leg (job 89985512388) the simulator itself died ~11 min in: 17 tests had passed, the 18th went silent mid-setup, the remaining tests were reported as instant passes with no output, and flutter test exited non-zero. Because prepare_simulator ran once before the attempt loop, every retry after that failed in ~15s with No supported devices found with name or id matching <udid> — and reactions_test.dart never ran a single test.

run_e2e_test now calls boot_simulator at the top of every attempt except the first: a no-op when the device is already booted, simctl bootstatus -b when it is shut down, and an early return when the udid is gone entirely (so a missing device can't block the run). One crashed simulator now costs one attempt instead of the rest of the job.

Test

Summary by CodeRabbit

Summary

  • New Features

    • Added a bottom-aligned typing indicator overlay for thread conversations.
  • Bug Fixes

    • Improved composer error handling in channel and thread views with clearer error details in logs.
    • Enhanced test teardown reliability by ensuring Stream client disconnects occur before persistence is closed.
  • Tests

    • Expanded end-to-end message-list coverage and assertions (offline delivery transitions, edits/deletes, mentions, pagination, link previews, delivery statuses), with more reliable scrolling/visibility waits and richer test robots/helpers.
  • Chores

    • Improved iOS simulator retry/boot behavior and updated embedded iOS frameworks for the sample app.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes expand message-list integration testing with new page objects, fluent robot actions, assertions, lifecycle and URL-launch controls, and Allure metadata. They also update thread/channel UI error handling, persistence teardown, iOS simulator retries, and embedded framework configuration.

Changes

Message list integration testing

Layer / File(s) Summary
Deterministic integration-test harness
sample_app/integration_test/support/*, sample_app/pubspec.yaml, melos.yaml
Adds URL-launch mocking, lifecycle controls, bounded settling, scrolling utilities, persistence draining, and the URL launcher test dependency.
Message-list page and robot actions
sample_app/integration_test/pages/message_list_page.dart, sample_app/integration_test/robots/*
Adds selectors and fluent user/participant actions for composing, editing, deleting, threading, typing, scrolling, and links.
Message-list assertions
sample_app/integration_test/robots/user_robot_message_list_asserts.dart
Adds assertions for message states, overlays, pagination, link previews, cell sizing, composer growth, and delivery status.
Message-list integration scenarios
sample_app/integration_test/message_list_test.dart
Adds Allure identifiers and coverage for rendering, editing, offline persistence, threads, deletion, mentions, scrolling, pagination, links, sizing, and composer limits.
Sample message and thread UI wiring
sample_app/lib/pages/channel_page.dart, sample_app/lib/pages/thread_page.dart
Adds composer error logging and overlays the thread typing indicator above the message list.
iOS E2E and framework setup
sample_app/fastlane/Fastfile, sample_app/ios/Runner.xcodeproj/project.pbxproj
Boots eligible iOS simulators before retry attempts, detects post-completion failures, and updates embedded Pod frameworks.
Persistence teardown ordering
sample_app/lib/auth/auth_controller.dart
Disconnects the Stream client while flushing chat persistence before completing test teardown.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant StreamTestEnv
  participant UserRobot
  participant MessageListPage
  participant FakeUrlLauncher
  StreamTestEnv->>FakeUrlLauncher: install URL-launch fake
  UserRobot->>MessageListPage: tap link preview
  MessageListPage->>FakeUrlLauncher: launch URL
  FakeUrlLauncher-->>StreamTestEnv: record launched URL
  StreamTestEnv-->>UserRobot: assert expected URL
Loading

Possibly related PRs

Suggested reviewers: xsahil03x

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding E2E message list tests to the sample app.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/message-list-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
Contributor

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 `@sample_app/integration_test/support/widget_test_extensions.dart`:
- Around line 47-93: Replace the unbounded pumpAndSettle() calls in tapFinder,
scrollMessageList, and scrollUpUntilVisible with the bounded settle() helper
already used by the visibility methods. Preserve the existing sequencing and
ensure scrollUpUntilVisible’s timeout can be enforced between iterations even
when perpetual animations are active.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 20fd9c56-b7e3-4570-aada-4ceca4e1deac

📥 Commits

Reviewing files that changed from the base of the PR and between 2507ca5 and 1d0810c.

📒 Files selected for processing (10)
  • sample_app/fastlane/Fastfile
  • sample_app/integration_test/message_list_test.dart
  • sample_app/integration_test/pages/message_list_page.dart
  • sample_app/integration_test/robots/participant_robot.dart
  • sample_app/integration_test/robots/user_robot.dart
  • sample_app/integration_test/robots/user_robot_message_list_asserts.dart
  • sample_app/integration_test/support/stream_test_env.dart
  • sample_app/integration_test/support/widget_test_extensions.dart
  • sample_app/ios/Runner.xcodeproj/project.pbxproj
  • sample_app/lib/pages/thread_page.dart

Comment thread sample_app/integration_test/support/widget_test_extensions.dart
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.86%. Comparing base (a7e26f0) to head (204251b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2854   +/-   ##
=======================================
  Coverage   72.86%   72.86%           
=======================================
  Files         429      429           
  Lines       27698    27698           
=======================================
  Hits        20183    20183           
  Misses       7515     7515           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@testableapple
testableapple marked this pull request as draft July 29, 2026 20:09
@testableapple
testableapple marked this pull request as ready for review July 30, 2026 15:30

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 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 `@sample_app/integration_test/pages/message_list_page.dart`:
- Around line 99-116: Update sendingStatus’s hasStatus cases for sent and
pending to mirror StreamSendingIndicator.build()’s priority order: exclude
messages that are already read or delivered, and ensure pending also does not
match completed messages. Preserve the existing status checks while preventing
lower-priority statuses from matching higher-priority states.

In `@sample_app/lib/pages/channel_page.dart`:
- Around line 125-132: Update both StreamMessageComposer onError handlers in
sample_app/lib/pages/channel_page.dart lines 125-132 and
sample_app/lib/pages/thread_page.dart lines 103-107 to include the received
stackTrace in their debugPrint failure logs alongside the error, preserving the
existing logging behavior and retry handling.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a563ea45-a671-4ace-b0bc-ee2a80cf3da3

📥 Commits

Reviewing files that changed from the base of the PR and between 2eece57 and ee9adb1.

📒 Files selected for processing (8)
  • melos.yaml
  • sample_app/integration_test/message_list_test.dart
  • sample_app/integration_test/pages/message_list_page.dart
  • sample_app/integration_test/robots/user_robot_message_list_asserts.dart
  • sample_app/integration_test/support/stream_test_env.dart
  • sample_app/integration_test/support/widget_test_extensions.dart
  • sample_app/lib/pages/channel_page.dart
  • sample_app/lib/pages/thread_page.dart

Comment thread sample_app/integration_test/pages/message_list_page.dart
Comment thread sample_app/lib/pages/channel_page.dart

@coderabbitai coderabbitai Bot 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.

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 `@sample_app/fastlane/Fastfile`:
- Line 28: Validate udid before the sh call, rejecting any value containing
characters outside 0-9, A-F, a-f, and hyphen, then apply Shellwords.escape to
the validated value before interpolating it into the xcrun simctl bootstatus
command.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 31566eea-a395-42e9-b355-c8cbea489942

📥 Commits

Reviewing files that changed from the base of the PR and between da5adb6 and ee9adb1.

📒 Files selected for processing (14)
  • melos.yaml
  • sample_app/fastlane/Fastfile
  • sample_app/integration_test/message_list_test.dart
  • sample_app/integration_test/pages/message_list_page.dart
  • sample_app/integration_test/robots/participant_robot.dart
  • sample_app/integration_test/robots/user_robot.dart
  • sample_app/integration_test/robots/user_robot_message_list_asserts.dart
  • sample_app/integration_test/support/fake_url_launcher.dart
  • sample_app/integration_test/support/stream_test_env.dart
  • sample_app/integration_test/support/widget_test_extensions.dart
  • sample_app/ios/Runner.xcodeproj/project.pbxproj
  • sample_app/lib/pages/channel_page.dart
  • sample_app/lib/pages/thread_page.dart
  • sample_app/pubspec.yaml
🚧 Files skipped from review as they are similar to previous changes (11)
  • sample_app/pubspec.yaml
  • sample_app/integration_test/support/fake_url_launcher.dart
  • sample_app/lib/pages/channel_page.dart
  • sample_app/ios/Runner.xcodeproj/project.pbxproj
  • sample_app/integration_test/robots/participant_robot.dart
  • sample_app/integration_test/support/stream_test_env.dart
  • sample_app/lib/pages/thread_page.dart
  • sample_app/integration_test/robots/user_robot.dart
  • sample_app/integration_test/support/widget_test_extensions.dart
  • sample_app/integration_test/robots/user_robot_message_list_asserts.dart
  • sample_app/integration_test/message_list_test.dart

Comment thread sample_app/fastlane/Fastfile

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 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 `@sample_app/integration_test/support/stream_test_env.dart`:
- Around line 180-190: Update _drainPendingPersistenceWork to await the
persistence layer’s actual idle or pending-request completion signal instead of
polling for a fixed two-second duration. Ensure tearDown waits until all
recovery queries and persistence work have completed before debugReset() closes
persistence, while preserving the existing _usePersistence guard.

In `@sample_app/lib/auth/auth_controller.dart`:
- Around line 273-280: Serialize client teardown by storing or awaiting the
Future started in disconnect() when it calls _client?.disconnectUser(...), then
have debugReset() await that same shared disconnect operation before disposing
the client. Preserve the existing flushChatPersistence behavior and ensure both
logout and reset cannot mutate or dispose the client concurrently.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e438e4d5-1a1f-482d-af38-6acbf99650db

📥 Commits

Reviewing files that changed from the base of the PR and between 376af03 and 4f63b0b.

📒 Files selected for processing (3)
  • sample_app/fastlane/Fastfile
  • sample_app/integration_test/support/stream_test_env.dart
  • sample_app/lib/auth/auth_controller.dart

Comment thread sample_app/integration_test/support/stream_test_env.dart Outdated
Comment thread sample_app/lib/auth/auth_controller.dart Outdated

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

Some small (and some unrelated) discussion points, but looks good to me!

/// is `'1'` (the newest is `'$messagesCount'`).
Future<UserRobot> assertMessageListPagination({required int messagesCount}) async {
await tester.waitUntilVisible(find.text('$messagesCount'));
await tester.scrollUpUntilVisible(find.text('1'));

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.

Small suggestion - maybe this can be dynamic value instead of 1? Or is it safe to assume 1 will always be the first message?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fair concern, i updated it so now it does by message id and not by hard-coded text

// response builds a `ChannelClientState`, whose constructor reads the cached
// threads. Both used to throw an async StateError, which the test framework
// then blamed on an unrelated test that had already passed.
final persistence = _client?.chatPersistenceClient;

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.

I think we should also spend some time investigating why this workaround is needed. It might be surfacing a potential race-condition in the SDK (HTTP call in progress when the client is disposed).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

i created a ticket for this https://linear.app/stream/issue/FLU-664/

child: Container(
alignment: Alignment.centerLeft,
color: context.streamColorScheme.backgroundApp.withValues(alpha: .9),
child: StreamTypingIndicator(

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.

Question (not directly related to this PR): I see that we are manually adding the StreamTypingIndicator here - should it maybe be packaged together in the StreamMessageListView (I believe that's how other SDKs ship it)? it will be a breaking change to add it now, but perhaps something to consider for the next major release.

cc @xsahil03x

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

i think this ticket might be related to this https://linear.app/stream/issue/FLU-661

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, we have a ticket for this one

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants