test(examples): add end-to-end test for the realtime room example#1621
Conversation
📝 WalkthroughWalkthroughAdds a Flutter integration test for the realtime room example, covering Presence, Postgres Changes, Broadcast, message deletion, and asynchronous UI updates. It also adds the testing dependency and documents local-stack execution. ChangesRealtime room integration testing
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)examples/realtime_room/pubspec.yamlTraceback (most recent call last): 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 |
964d20b to
563f672
Compare
a4cb13f to
922a8bc
Compare
…m-e2e-test # Conflicts: # examples/README.md # examples/realtime_room/README.md # examples/realtime_room/pubspec.yaml # pubspec.yaml
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
examples/realtime_room/integration_test/room_test.dart (1)
1-132: 📐 Maintainability & Code Quality | 🔵 TrivialRun
melos analyzeandmelos format
Repo guidance for Dart changes requires the Melos wrappers, not justflutter analyze/dart format.🤖 Prompt for 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. In `@examples/realtime_room/integration_test/room_test.dart` around lines 1 - 132, Run the repository-standard `melos analyze` and `melos format` commands for the Dart changes, and resolve any reported analysis or formatting issues in the integration test before finalizing.Source: Coding guidelines
🤖 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 `@examples/realtime_room/integration_test/room_test.dart`:
- Around line 31-39: Update the realtime room test setup and teardown to
generate per-run unique usernames and message content, then reuse those values
in the posted messages, find.text assertions, and cleanup query. Ensure tearDown
only deletes rows belonging to the current test run rather than all messages
authored by shared usernames.
In `@examples/realtime_room/README.md`:
- Around line 60-66: Update the integration-test instructions around the Flutter
command to clarify that localhost:54321 is only valid for macOS/desktop targets.
Document the appropriate host address or platform alias for Android emulators
and physical devices, and ensure each target uses a reachable SUPABASE_URL.
---
Nitpick comments:
In `@examples/realtime_room/integration_test/room_test.dart`:
- Around line 1-132: Run the repository-standard `melos analyze` and `melos
format` commands for the Dart changes, and resolve any reported analysis or
formatting issues in the integration test before finalizing.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c3c10e8b-95a3-439b-aeb6-13d51ecb7e10
📒 Files selected for processing (3)
examples/realtime_room/README.mdexamples/realtime_room/integration_test/room_test.dartexamples/realtime_room/pubspec.yaml
| tearDown(() async { | ||
| // Remove whatever the test posted so it can run repeatedly. | ||
| await Supabase.instance.client.from('messages').delete().inFilter( | ||
| 'username', | ||
| [ | ||
| 'alice', | ||
| 'bob', | ||
| ], | ||
| ); |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Isolate test rows from shared-stack data.
This deletes every message authored by alice or bob, including pre-existing data or another concurrent run’s rows. Use per-run unique usernames/message content and clean up only those generated values; this also prevents stale rows from making the find.text assertions ambiguous.
🤖 Prompt for 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.
In `@examples/realtime_room/integration_test/room_test.dart` around lines 31 - 39,
Update the realtime room test setup and teardown to generate per-run unique
usernames and message content, then reuse those values in the posted messages,
find.text assertions, and cleanup query. Ensure tearDown only deletes rows
belonging to the current test run rather than all messages authored by shared
usernames.
What
Stacked on top of #1619 (the
realtime_roomexample itself). Adds a full end-to-end integration test that drives the actual app widgets against the local Supabase stack, covering all three realtime features through the UI.Base this on #1619 (
examples/realtime-room), notmain. Merge #1619 first, or rebase this once it lands.The test
integration_test/room_test.dartusestestWidgetsto:RealtimeRoomApp, enter a name on the join screen and open the room.SupabaseClientas another user ("bob") and:Because realtime updates arrive asynchronously over the network, the UI can't be settled with
pumpAndSettle; a small_pumpUntilhelper polls the widget tree with a timeout instead.tearDownremoves the posted rows so the test can run repeatedly.Also re-adds the
integration_testdev dependency and the "Integration test" section to the example README (both were intentionally left out of #1619 so that PR is example-only).Testing
flutter analyze: no issues;dart format: clean.-d macos, an emulator or a real device.Summary by CodeRabbit
Tests
Documentation