e2e: Make the remaining UserRobot clicks stale-safe - #6603
Conversation
The composer confirm tap polls one combined send-or-save selector through waitToAppearAndClick instead of clicking objects found by a hand-rolled loop, the waitToAppear().click() call sites convert to waitToAppearAndClick, and the caller-less tapOnMessage is removed.
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
|
@CodeRabbit review |
✅ Action performedReview finished.
|
SDK Size Comparison 📏
|
WalkthroughThe Compose sample’s E2E robot now uses a shared regex selector for send/save confirmation buttons and wait-aware clicks for several message and channel actions. An unused message-tapping helper was removed. ChangesCompose E2E robot behavior
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
|
|
🚀 Available in v7.7.0 |
Aligns with #6603, which converted the remaining UserRobot clicks.
…tate (GetStream#6599) * e2e: Re-enable the unread messages tests and cover mark-as-unread 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. * e2e: Wait for the message delivery before the participant acts in the 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. * e2e: Mark the message as unread by text instead of position Selecting by cell index assumed both participant messages had rendered; openContextMenu falls back to the last message when the index is out of range, which could mark the wrong message on a slow emulator. * ui-common: Compute the unread label before marking the channel read Marking read zeroes the read state optimistically while keeping last_read_message_id, and the unread label pipeline collects a conflating flow. On a busy main thread the collector could observe only the zeroed state, compute a zero-count label, and the sticky design kept it forever, so the unread separator never rendered. Computing the label from the current read state right before the mark-read call makes the order deterministic, since the controller triggers both. * ui-common: Keep the unread label recalculation open on null results The read-state id was marked as processed before the calculator ran, so a first emission arriving while the message list is still empty produced no label and permanently blocked recalculation for that id. The id is now recorded only when a label is produced, so the capture before mark-read computes the label once the messages are loaded. * e2e: Use the stale-safe click for the mark-as-unread menu option Aligns with GetStream#6603, which converted the remaining UserRobot clicks.



Goal
The last nightly run failed on API 35 because
GiphyTests.test_userObservesAnimatedGiphy_afterAddingGiphyThroughComposerMenufailed all 3 retry attempts withStaleObjectException: https://github.com/GetStream/stream-chat-android/actions/runs/30414531872. The click landed on a composer button node that went stale between the find and the click.#6588 introduced the stale-safe
waitToAppearAndClick, but someUserRobotactions still click a foundUiObject2directly, so any of them can fail the same way when Compose recomposes at tap time. This PR routes every remaining click through the stale-safe helper.Resolves AND-1344
Implementation
tapOnComposerConfirmButtonnow taps one combined selector,By.res(Pattern.compile("Stream_Composer(Send|Save)Button")), throughwaitToAppearAndClick, replacing the custom loop that polled the send and save buttons and clicked without stale protection. On timeout the error message now comes fromwaitToAppearinstead of the custom text; the exception type is unchanged.waitToAppear().click()call sites convert towaitToAppearAndClick(): copy, pin, unpin, message reaction, extended reactions picker (2 taps), scroll-to-first-unread button and its dismiss icon, channel swipe "more", and view channel info.tapOnMessageis removed: it was the last unprotected click, and it has no callers.Testing
Ran locally against the mock server (
main) on an API 35 emulator with direct instrumentation:GiphyTests: 10/10 passed in 106s, including the test that failed the nightly.ReactionsTests,PinnedMessagesTests,ChannelActionsTests,MessageActionsTests(the classes that exercise the converted click sites): 21/21 passed in 257s.No retries were needed in either run. To reproduce, build
assembleE2eDebugandassembleE2eDebugAndroidTestofstream-chat-android-compose-sample, start the mock server (bundle exec fastlane start_mock_server), install both APKs, and run the classes above withadb shell am instrument.No UI changes.
Summary by CodeRabbit