Skip to content

e2e: Port the chat test harness improvements: retry visibility, video on retries only#1746

Merged
andremion merged 1 commit into
developfrom
andrerego/and-1308-port-e2e-harness-improvements
Jul 13, 2026
Merged

e2e: Port the chat test harness improvements: retry visibility, video on retries only#1746
andremion merged 1 commit into
developfrom
andrerego/and-1308-port-e2e-harness-improvements

Conversation

@andremion

@andremion andremion commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Goal

Port the E2E harness improvements from the chat repo (GetStream/stream-chat-android#6568): make retry attempts visible in Allure TestOps, record video only on retries, and fix the CI batch split.

Resolves AND-1308

Implementation

  • RetryRule: each failed attempt that is retried becomes its own Allure result (same historyId), so TestOps shows retries and can flag flaky tests. Before, a pass-on-retry looked identical to a stable pass.
  • RetryRule: screen recording runs only on retry attempts. Before, every test recorded an 8 Mbit/s video and discarded it on pass.
  • RetryRule: the recording file uses methodName instead of displayName (the display name's parentheses break when the recording commands go through the device shell on this uiautomator version), and a recording stop failure logs instead of replacing the test result. Both were caught by a live probe run during the port.
  • RetryRule moved to io.getstream.video.android.rules: the file declared a chat package inside this repo.
  • Wait.kt: waitForText and waitForCount poll at 50ms instead of spinning a CPU core until timeout; unused waitForTextToChange removed.
  • Allurefile: launches are named "Cron checks" only for real scheduled runs, so manual dispatches of the nightly stay out of the flakiness analytics (TestOps project 69).
  • Fastfile: batch_tests splits round-robin (the old rounded-up slicing could produce fewer groups than batches and crash on nil for the last shard).

Metrics

E2E CI duration (this repo), sum of the 3 test batch jobs:

Run Total across batches
recent full runs, other branches 38.1 to 45.6 min
this PR (first run) 37.8 min

That overlaps with the best baseline, so on duration this is within single-run variance. This suite is smaller and more network-bound than chat's, so the recording overhead it removes was a smaller share of its runtime. The nightly trend will tell whether a duration gain shows on top.

Retry visibility and recordings (the substance of this PR):

Before After
Test passes on retry looks identical to a stable pass failed attempt visible in TestOps with its own error, steps and artifacts
First-attempt pass rate unmeasurable measurable
Recording on a passing attempt always, then discarded never

For reference, chat measured a large duration gain from the same change (PR gate from about 40 to about 25 minutes wall clock; see GetStream/stream-chat-android#6568), but its suite is bigger and CPU-bound, so those numbers do not transfer here.

Testing

Verified live on an emulator with a temporary probe test (fails attempt 1, passes attempt 2), pulling /sdcard/googletest/test_outputfiles/allure-results afterwards:

  1. One result JSON per attempt, all sharing the same historyId; the failed attempt carries its own steps, error, logcat_1/screenshot_1/hierarchy_1, and no video; the passed result has the latest start, so TestOps keeps it as the current one.
  2. A normally passing test writes exactly one result and records no video.
  3. To reproduce: temporarily flip an assertion in any test and run it via connectedE2etestingDebugAndroidTest.

No UI changes.

Summary by CodeRabbit

  • Bug Fixes
    • Improved UI test waiting by adding reliable polling for text and object counts.
    • Enhanced retry handling so failed attempts are recorded separately without causing additional failures when video cleanup encounters issues.
    • Fixed test batching to detect and report empty batches clearly.
    • Corrected scheduled test run labeling for automated versus manually triggered runs.

… on retries only

- RetryRule: each failed attempt that is retried is written as its own Allure result sharing the real test's historyId, with that attempt's steps, error and artifacts, so TestOps groups attempts as retries and can flag flaky tests
- RetryRule: screen recording runs only on retry attempts; previously every test recorded an 8 Mbit/s video that was discarded on pass
- RetryRule: the recording file uses methodName instead of displayName (the display name's parentheses break when the recording commands go through the device shell), and a recording stop failure no longer replaces the test result
- RetryRule: move to io.getstream.video.android.rules (the file declared a chat package), remove the unused Retry annotation, simplify DatabaseOperations
- Wait: waitForText and waitForCount poll at 50ms instead of spinning the CPU until timeout; remove the unused waitForTextToChange
- Allurefile: name launches 'Cron checks' only for real scheduled events, so manual dispatches stay distinguishable in TestOps
- Fastfile: batch_tests splits round-robin, always yielding exactly batch_count groups; the previous rounded-up slicing could produce fewer groups and crash on nil for the last batch

Ported from GetStream/stream-chat-android#6568.
@github-actions

github-actions Bot commented Jul 13, 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:ci CI / GitHub Actions / workflow updates label Jul 13, 2026
@andremion

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor
✅ 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.

@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 12.27 MB 12.27 MB 0.00 MB 🟢
stream-video-android-ui-xml 5.68 MB 5.68 MB 0.00 MB 🟢
stream-video-android-ui-compose 6.20 MB 6.20 MB 0.00 MB 🟢

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Retry infrastructure was moved and rewritten, UI waits gained polling delays, Allure cron detection was restricted to scheduled events, and Fastlane batching now validates round-robin groups.

Changes

Retry infrastructure

Layer / File(s) Summary
Retry attempts and attempt results
demo-app/src/androidTestE2etestingDebug/kotlin/io/getstream/video/android/rules/RetryRule.kt, demo-app/src/androidTestE2etestingDebug/kotlin/io/getstream/video/android/tests/StreamTestCase.kt
RetryRule now controls retries from its constructor, records retry attempts, writes finished Allure results for failed attempts, safely stops recording, and is wired into StreamTestCase.
Database cleanup simplification
demo-app/src/androidTestE2etestingDebug/kotlin/io/getstream/video/android/rules/RetryRule.kt
Database cleanup is private and iterates eligible database files using internal database handling.

UI automation polling

Layer / File(s) Summary
Polling-based UI waits
demo-app/src/androidTestE2etestingDebug/kotlin/io/getstream/video/android/uiautomator/Wait.kt
Text and count waits now sleep and re-query between checks; waitForTextToChange was removed.

Fastlane test orchestration

Layer / File(s) Summary
Launch metadata and batch selection
fastlane/Allurefile, fastlane/Fastfile
Cron launches require a scheduled GitHub event, and test batches use round-robin selection with empty-batch validation.

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

Sequence Diagram(s)

sequenceDiagram
  participant TestStatement
  participant RetryRule
  participant ScreenRecorder
  participant AllureLifecycle
  TestStatement->>RetryRule: evaluate test attempt
  RetryRule->>ScreenRecorder: start recording for retry attempts
  TestStatement-->>RetryRule: throw failure
  RetryRule->>ScreenRecorder: stop recording safely
  RetryRule->>AllureLifecycle: schedule finished failed-attempt result
  RetryRule->>TestStatement: retry or rethrow last failure
Loading

Poem

I’m a rabbit with retries to spare,
Polling softly through the air.
Allure records each little run,
Fastlane batches hop in fun.
Databases clear, screens sleep—
Test paths tidy, burrows deep.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly summarizes the main change: porting chat E2E harness improvements with retry visibility and video-on-retry behavior.
Description check ✅ Passed The description covers goal, implementation, metrics, and testing, but omits the template's UI Changes, checklist, and GIF sections.
✨ 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-1308-port-e2e-harness-improvements

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 `@fastlane/Fastfile`:
- Around line 101-106: Validate batch_count is greater than zero and batch is
within the valid range before the current_batch selection uses modulo. Raise a
UI.user_error! with the existing batching context for invalid values, then
preserve the round-robin selection and empty-batch guard for valid inputs.
🪄 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: e4a0175c-c9da-4b48-8001-ce6e57b35434

📥 Commits

Reviewing files that changed from the base of the PR and between 5e3547d and 970ec54.

📒 Files selected for processing (5)
  • demo-app/src/androidTestE2etestingDebug/kotlin/io/getstream/video/android/rules/RetryRule.kt
  • demo-app/src/androidTestE2etestingDebug/kotlin/io/getstream/video/android/tests/StreamTestCase.kt
  • demo-app/src/androidTestE2etestingDebug/kotlin/io/getstream/video/android/uiautomator/Wait.kt
  • fastlane/Allurefile
  • fastlane/Fastfile

Comment thread fastlane/Fastfile
@sonarqubecloud

Copy link
Copy Markdown

@andremion andremion requested a review from testableapple July 13, 2026 09:54
@andremion andremion marked this pull request as ready for review July 13, 2026 09:58
@andremion andremion requested a review from a team as a code owner July 13, 2026 09:58
@andremion andremion merged commit 1d8b702 into develop Jul 13, 2026
20 of 21 checks passed
@andremion andremion deleted the andrerego/and-1308-port-e2e-harness-improvements branch July 13, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:ci CI / GitHub Actions / workflow updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants