fix: enhance removeAbortFilter to handle late async abort events in CI#27732
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: The three changed files are all E2E test infrastructure/framework files — no app code is modified:
These changes affect the
A representative cross-section of test tags is selected to validate the framework changes work correctly across different test scenarios (confirmations, wallet platform, accounts, network, trade, ramps). This covers tests that use MockServer, Android port forwarding, and the full Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
|



Description
Fixes two recurring CI failures affecting Android and iOS E2E smoke suites.
Fix 1: Mockttp
Abortederrors failing tests after filter removalRoot cause: CI logs showed abort events firing ~180ms after
removeAbortFilter()was called and Jest's original handlerswere restored:
17:47:54.898 Abort filter removed — suppressed 0 mockttp "Aborted" error(s)
17:47:55.082 Aborted at IncomingMessage.failWithAbortError ← 184ms later
The existing 500ms drain inside
stop()did not help because it runs beforeremoveAbortFilter(). On loaded CI runners (4 CPUsat 100%), the Node.js event loop delays abort events from destroyed sockets beyond the drain window. By the time
removeAbortFilter()restored Jest's handlers, the queued events fired straight into Jest as test failures.Fix:
removeAbortFilter()is nowasyncand waits 500ms before restoring Jest's handlers (MockServerE2E.ts).withFixturesnowawaits the call (FixtureHelper.ts). Abort events observed at up to ~200ms fire during the 500ms hold windowand are suppressed by the still-active filter.
Fix 2: Android
adb: device 'emulator-XXXX' not foundcrashing testsRoot cause: On CI, emulators occasionally go offline between tests (still booting, brief crash-recovery).
setupAndroidPortForwardinghad no retry logic — anyadb reversefailure was immediately rethrown, propagating throughstartResourceWithRetry→handleLocalNodes→withFixturesand killing the test before it started.Failed to set up Android port forwarding for anvil:
adb: device 'emulator-10342' not found
Failed to start anvil after 0 attempts
Error in withFixtures: Command failed: adb -s emulator-10342 reverse tcp:8545 tcp:55324
Fix:
setupAndroidPortForwardingnow retries up to 3 times (2s apart) when the error indicates the device is transientlyunreachable (
not found,device offline,unauthorized). Persistent failures still fail the test after exhausting retries.Files changed
tests/api-mocking/MockServerE2E.tsremoveAbortFilter()made async with 500ms pre-restore delaytests/framework/fixtures/FixtureHelper.tsawait mockServerInstance.removeAbortFilter()tests/framework/fixtures/FixtureUtils.tssetupAndroidPortForwardingfor device-offline errorsChangelog
CHANGELOG entry:
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Medium risk because it changes E2E fixture cleanup timing (adds an awaited 500ms delay) and introduces retry behavior around
adb reverse, which can mask persistent device issues if misclassified but is limited to specific error strings and test infrastructure.Overview
Reduces flaky E2E CI failures by making
MockServerE2E.removeAbortFilter()async and delaying restoration of Jest handlers by 500ms, then updatingwithFixturescleanup toawaitit so latemockttp"Aborted" events don’t fail tests.Improves Android stability by adding a 3-attempt (2s backoff) retry loop around
adb reverseinsetupAndroidPortForwardingwhen devices are transiently unreachable (e.g., "not found"/"device offline"/"unauthorized"), while keeping non-transient failures fatal.Written by Cursor Bugbot for commit e136696. This will update automatically on new commits. Configure here.