Skip to content

perf(mobile): skip the post-gesture stabilization wait for a test's swipe and scroll - #1668

Merged
okwasniewski merged 2 commits into
mainfrom
perf/mobile-gesture-stabilization
Nov 10, 2026
Merged

okwasniewski merged 2 commits into
mainfrom
perf/mobile-gesture-stabilization

Conversation

@kdy1

@kdy1 kdy1 commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator
  • A test's swipe and scroll now send postGestureStabilization: false, so agent-device stops holding the next read for up to 3.5 s (1.5 s poll budget plus a 2 s distrust extension) after a gesture the test checks with expect. The agent's gestures keep the wait.
  • Skipping the wait alone breaks taps: scrollUntilVisible finds the control while the list still coasts, and the tap lands on a moving list, which swallows it to stop the scroll. The step passes and nothing navigates. So the first action on a control within 2 s of a skipped wait re-reads the control every 100 ms until two reads agree on its bounds (steadied in packages/mobile/src/surface.ts). A list that already rests costs one extra snapshot.
  • fill and clear keep relocated's input checks on every re-read, and the poll stops with OPERATION_TIMEOUT when the action budget cannot fit another poll. Both came from the fresh-context review.
  • agent-device 0.21.36 ignores the option, so nothing speeds up until the dependency moves to a release that has it. The nightly 0.21.37-nightly.20261109.153 accepts it.

Verified

Ran it locally: yes

  • Surface: the built CLI on callstack/react-native-pager-view (40 tests in 16 files) on an iOS simulator (iPhone 17), cold boot per run, one build at a time, load below 2 before each run. Command: node node_modules/e2e/dist/cli/bin.js run --target ios, with node_modules/e2e and @e2e-dev/mobile pointing at the built worktrees.
  • Time is the sum of attempt durations over the 38 tests that passed in every run below. Run-to-run noise on this suite is 1 to 2%.
main this branch, nightly agent-device this branch, agent-device 0.21.36
Passed 38/40, 39/40 (two runs) 39/40 39/40
38 common tests 427.1 s, 433.0 s 409.0 s (-4.7%) 438.1 s (+1.9%, inside noise)
locator.tap median 573 ms, 556 ms 767 ms 613 ms
  • The one failure in every run, issue-1096-keyboard-shrink, fails on main too (ENGINE_FAILURE, "behind the visible keyboard"). It is not this change.
  • Without the steady read, the same flag failed issue-1154-page-change-focus in 3 of 3 runs and issue-1050-back-gesture in 3 of 3 (1 of 4 on main). The first tap after a scroll got slower in exchange (714 to 767 ms against 556 to 573 ms), since the wait moved from the scroll to that tap. Lowering transition to 200 ms cut that cost but added 3 more failures, so it is not in this change.
  • The main rows ran at f4bf5299; this branch is on e27f492c, which has unrelated commits in between.
  • Tests: packages/mobile/tests/unit/engine.test.ts covers the flag per origin, the re-read until bounds agree, no re-read for the agent, a field that turns disabled after a gesture, and the budget stop.

Review

A fresh-context review (gpt-6.1-sol) found two issues, both fixed and covered by tests: the re-read dropped fill's input checks, and its 100 ms sleep ignored the operation's remaining budget.

🤖 Generated with Claude Code

…wipe and scroll

Send postGestureStabilization: false with a test's own swipe and scroll, and
re-read a control until two reads agree on its bounds before the first
action within 2 s of such a gesture, so a tap does not land on a list still
coasting.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kdy1
kdy1 requested a review from okwasniewski as a code owner November 10, 2026 08:14
@github-actions github-actions Bot added the size:M Up to 99 changed lines, not counting tests, fixtures, translated docs, or the lockfile label Nov 10, 2026

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/mobile/src/surface.ts Resolved
Comment thread packages/mobile/src/surface.ts Resolved
Comment thread packages/mobile/src/surface.ts Resolved
…re, and say what the re-read costs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e ios agent: 21 passed, 1 skipped

25 agent steps · 12 replayed from cache · 62 model calls · 387.8k tokens (81% cached) · $0.0275

All 22 tests in 1 file
Test Agent Time
⏭️ tests-agent/scenarios.e2e.ts · 21 passed, 1 skipped 25 steps · 62 calls 9m 17s
🟢 act completes Login Form 1 step 39.7s
🟢 act completes Infinite Scroll List 1 step 44.2s
🟢 act completes Modal Flow 1 step 11.2s
🟢 act completes Bottom Tabs 1 step 8.0s
🟢 act completes Text Input Variations 1 step 14.4s
🟢 act completes Broken Accessibility 2 steps · 10 calls 58.6s
🟢 act completes Vision Only 2 steps · 6 calls 30.4s
🟢 act completes Gestures 1 step · 10 calls 45.1s
🟢 act completes Async States 1 step · 10 calls 33.2s
🟢 act completes Debounced Search 1 step · 1 call 27.2s
🟢 act completes Flattened Registration Form 2 steps · 1 call 29.6s
🟢 act completes Flattened Login 2 steps · 10 calls 53.9s
🟢 act completes Sticky Chrome Target 1 step 14.1s
🟢 act completes WebView Accessibility 1 step 12.3s
🟢 act completes Permission Prompt 1 step 12.0s
🟢 act completes Photo Picker 1 step · 2 calls 30.2s
🟢 act completes Product Catalog 1 step 10.3s
🟢 act completes Error Recovery 1 step 9.6s
🟢 act completes Choice Controls 1 step · 5 calls 34.7s
🟢 act completes Stripe PaymentSheet 1 step · 7 calls 27.7s
🟢 act completes Apple Pay 1 step 10.9s
⏭️ act completes Apple Pay Billing Address (skipped: the CI simulator's Apple Pay sheet skips the billing-address step, so the scenario cannot be completed there)

Tested by e2e 0.23.0 · 9m 18s · ios-simulator · run artifacts

@cubic-dev-ai cubic-dev-ai 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.

0 issues found across 3 files (changes from recent commits).

View guided diff | Turn on auto-fix | Re-trigger cubic

@github-actions

Copy link
Copy Markdown
Contributor

🟢 e2e android agent: 20 passed

24 agent steps · 15 replayed from cache · 38 model calls · 208.0k tokens (86% cached) · $0.0121

All 20 tests in 1 file
Test Agent Time
🟢 tests-agent/scenarios.e2e.ts · 20 passed 24 steps · 38 calls 6m 18s
🟢 act completes Login Form 1 step 28.2s
🟢 act completes Infinite Scroll List 1 step 24.1s
🟢 act completes Modal Flow 1 step 12.6s
🟢 act completes Bottom Tabs 1 step 8.2s
🟢 act completes Text Input Variations 1 step 7.9s
🟢 act completes Broken Accessibility 2 steps · 6 calls 19.6s
🟢 act completes Vision Only 2 steps · 1 call 7.1s
🟢 act completes Gestures 1 step · 7 calls 22.3s
🟢 act completes Async States 1 step · 11 calls 25.3s
🟢 act completes Debounced Search 1 step 7.1s
🟢 act completes Huge Virtualized List 1 step 2m 0s
🟢 act completes Flattened Registration Form 2 steps · 1 call 8.6s
🟢 act completes Flattened Login 2 steps · 6 calls 15.2s
🟢 act completes Sticky Chrome Target 1 step 9.2s
🟢 act completes WebView Accessibility 1 step · 6 calls 19.2s
🟢 act completes Permission Prompt 1 step 6.5s
🟢 act completes Product Catalog 1 step 8.6s
🟢 act completes Error Recovery 1 step 9.5s
🟢 act completes Choice Controls 1 step 8.9s
🟢 act completes Sequential Onboarding 1 step 9.9s

Tested by e2e 0.23.0 · 6m 18s · android-emulator · run artifacts

@github-actions

Copy link
Copy Markdown
Contributor

🟢 e2e ios: 55 passed, 1 skipped

All 56 tests in 7 files
Test Time
⏭️ tests/controls.e2e.ts · 23 passed, 1 skipped 3m 0s
🟢 control inventory › a label query resolves a labeled text field 15.5s
🟢 control inventory › a labeled field answers name, display value, value reads, fill, and clear 16.9s
🟢 control inventory › a placeholder query and attribute reads find the field 4.4s
🟢 control inventory › a secure field takes a fill and denies value reads 9.5s
🟢 control inventory › press sends a character and Enter through the soft keyboard 9.0s
🟢 control inventory › a field autofocuses on mount and focus() moves the focus 10.2s
🟢 control inventory › toBeFocused follows the focus 8.7s
🟢 control inventory › a switch checks, unchecks, and reports its state 10.2s
🟢 control inventory › checkbox and radio roles answer getByRole, and a checkbox toggles by tap 8.1s
🟢 control inventory › checkbox and radio roles check, uncheck, and report their state 12.4s
🟢 control inventory › a radio group reports the checked option 8.6s
🟢 control inventory › buttons report disabled, enabled, and a state that arrives later 7.5s
🟢 control inventory › a display: none element is absent rather than hidden, its visible twin attached 7.1s
🟢 control inventory › a header answers its accessible name 4.1s
🟢 control inventory › a tab row answers count, all, texts, filters, positions, and switching 6.0s
🟢 control inventory › a list answers counts, list-form text, reads, and boxes in order 6.5s
⏭️ control inventory › a row contains its texts (skipped: React Native flattens a plain View out of the accessibility tree on both platforms: XCTest and the Android helper report a View with a testID as a leaf beside its children, so filter({ has }) and a query scoped to it match nothing; only Sc…)
🟢 control inventory › a long press lands as one 8.1s
🟢 control inventory › pointer verbs land at the point asked for 9.9s
🟢 control inventory › an ambiguous locator fails at once 5.5s
🟢 control inventory › screenshot, restart, and clearState reopen the app on its home list 10.4s
🟢 refusals › verbs a device never declares are refused before the engine 1ms
🟢 refusals › keys the soft keyboard cannot send are refused by the engine 467ms
🟢 refusals › a missing locator fails as not found once its timeout passes 1.1s
🟢 tests/device-fixture.e2e.ts · 11 passed 1m 38s
🟢 device fixture › setAppearance flips the color scheme the app reads 17.4s
🟢 device fixture › setOrientation rotates the window the app measures 12.7s
🟢 device fixture › the clipboard reads back what was written 7.3s
🟢 device fixture › home leaves the app, openApp brings it back where it was 7.5s
🟢 device fixture › closeApp then openApp relaunches on the home list 7.6s
🟢 device fixture › closeApp leaves the next commands on the same device 10.4s
🟢 device fixture › foregroundApp after closeApp reports the closed session as APP_NOT_OPEN 5.5s
🟢 device fixture › device.back pops the scenario 5.5s
🟢 device fixture › unstable_raw reaches the test session through agent-device 4.7s
🟢 device fixture › setLocation and clearLocation change what the app reads 10.0s
🟢 device fixture › enrollBiometrics and setBiometrics answer a biometric prompt 9.6s
🟢 tests/device.e2e.ts · 3 passed 1m 6s
🟢 sequential onboarding echoes the exact values 40.2s
🟢 onboarding rejects a malformed email before advancing 13.9s
🟢 dismissing the keyboard over choice controls leaves them as they were 11.6s
🟢 tests/flows-lists.e2e.ts · 7 passed 4m 11s
🟢 infinite scroll reaches the target item 35.3s
🟢 product catalog adds exactly two of the right variant 9.9s
🟢 gestures: long-press, then swipe left 8.7s
🟢 sticky chrome: accept below the fold, then continue 12.5s
🟢 async states: load, pull to refresh, claim through the toast 12.3s
🟢 huge virtualized list reaches row 512 2m 40s
🟢 web view coupon form applies the code shown on the page 12.3s
🟢 tests/flows.e2e.ts · 7 passed 1m 8s
🟢 text inputs unlock the submit button 12.9s
🟢 filled text inputs report their values 10.3s
🟢 modal flow confirms through the native alert 9.7s
🟢 bottom tabs act inside the last tab 7.2s
🟢 error recovery retries, then confirms the delete 9.2s
🟢 choice controls place the exact order 7.3s
🟢 debounced search selects the target once results arrive 11.2s
🟢 tests/login-form.e2e.ts · 3 passed 46.9s
🟢 login form › rejects a malformed email 13.4s
🟢 login form › rejects an unknown account 13.6s
🟢 login form › signs in and logs out 19.8s
🟢 tests/smoke.e2e.ts · 1 passed 7.3s
🟢 home lists the scenarios and opens one 7.3s

Tested by e2e 0.23.0 · 6m 56s · ios-simulator · run artifacts

@github-actions

Copy link
Copy Markdown
Contributor

🟢 e2e android: 57 passed, 1 skipped

All 58 tests in 7 files
Test Time
⏭️ tests/controls.e2e.ts · 24 passed, 1 skipped 2m 54s
🟢 control inventory › a label query resolves a labeled text field 26.4s
🟢 control inventory › a labeled field answers name, display value, value reads, fill, and clear 11.6s
🟢 control inventory › a placeholder query and attribute reads find the field 9.2s
🟢 control inventory › a secure field takes a fill and denies value reads 8.1s
🟢 control inventory › press sends a character and Enter through the soft keyboard 8.5s
🟢 control inventory › a field autofocuses on mount and focus() moves the focus 8.7s
🟢 control inventory › toBeFocused follows the focus 9.0s
🟢 control inventory › a switch checks, unchecks, and reports its state 8.1s
🟢 control inventory › checkbox and radio roles answer getByRole, and a checkbox toggles by tap 6.8s
🟢 control inventory › checkbox and radio roles check, uncheck, and report their state 10.2s
🟢 control inventory › a tab role answers getByRole 3.8s
🟢 control inventory › a radio group reports the checked option 7.5s
🟢 control inventory › buttons report disabled, enabled, and a state that arrives later 6.6s
🟢 control inventory › a display: none element is absent rather than hidden, its visible twin attached 6.6s
🟢 control inventory › a header answers its accessible name 3.7s
🟢 control inventory › a tab row answers count, all, texts, filters, positions, and switching 5.5s
🟢 control inventory › a list answers counts, list-form text, reads, and boxes in order 5.3s
⏭️ control inventory › a row contains its texts (skipped: React Native flattens a plain View out of the accessibility tree on both platforms: XCTest and the Android helper report a View with a testID as a leaf beside its children, so filter({ has }) and a query scoped to it match nothing; only Sc…)
🟢 control inventory › a long press lands as one 7.1s
🟢 control inventory › a double tap lands inside the 300 ms window 6.6s
🟢 control inventory › an ambiguous locator fails at once 4.9s
🟢 control inventory › screenshot, restart, and clearState reopen the app on its home list 6.8s
🟢 refusals › verbs a device never declares are refused before the engine 2ms
🟢 refusals › keys the soft keyboard cannot send are refused by the engine 1.6s
🟢 refusals › a missing locator fails as not found once its timeout passes 1.0s
🟢 tests/device-fixture.e2e.ts · 10 passed 1m 19s
🟢 device fixture › setOrientation rotates the window the app measures 4.6s
🟢 device fixture › home leaves the app, openApp brings it back where it was 4.1s
🟢 device fixture › foregroundApp sees the home screen after home() 3.7s
🟢 device fixture › closeApp then openApp relaunches on the home list 6.6s
🟢 device fixture › closeApp leaves the next commands on the same device 7.0s
🟢 device fixture › foregroundApp after closeApp reports the closed session as APP_NOT_OPEN 4.9s
🟢 device fixture › device.back pops the scenario 5.4s
🟢 device fixture › unstable_raw reaches the test session through agent-device 4.2s
🟢 device fixture › setNetwork and setAirplaneMode change what the app sees 16.1s
🟢 device fixture › setLocation and clearLocation change what the app reads 22.7s
🟢 tests/device.e2e.ts · 5 passed 44.1s
🟢 permission prompt › allowing the system dialog enables the microphone 7.1s
🟢 permission prompt › a denied prompt recovers once the permission is granted outside 14.2s
🟢 sequential onboarding echoes the exact values 10.3s
🟢 onboarding rejects a malformed email before advancing 5.8s
🟢 dismissing the keyboard over choice controls leaves them as they were 6.8s
🟢 tests/flows-lists.e2e.ts · 7 passed 3m 16s
🟢 infinite scroll reaches the target item 29.9s
🟢 product catalog adds exactly two of the right variant 8.3s
🟢 gestures: long-press, then swipe left 8.0s
🟢 gestures: double-tap completes the flow 9.5s
🟢 sticky chrome: accept below the fold, then continue 11.1s
🟢 async states: load, pull to refresh, claim through the toast 11.9s
🟢 huge virtualized list reaches row 512 1m 57s
🟢 tests/flows.e2e.ts · 7 passed 50.9s
🟢 text inputs unlock the submit button 6.6s
🟢 filled text inputs report their values 5.5s
🟢 modal flow confirms through the native alert 9.2s
🟢 bottom tabs act inside the last tab 6.4s
🟢 error recovery retries, then confirms the delete 8.5s
🟢 choice controls place the exact order 6.1s
🟢 debounced search selects the target once results arrive 8.7s
🟢 tests/login-form.e2e.ts · 3 passed 28.3s
🟢 login form › rejects a malformed email 7.5s
🟢 login form › rejects an unknown account 8.0s
🟢 login form › signs in and logs out 12.7s
🟢 tests/smoke.e2e.ts · 1 passed 5.8s
🟢 home lists the scenarios and opens one 5.8s

Tested by e2e 0.23.0 · 9m 39s · android-emulator · run artifacts

@kdy1 kdy1 added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 10, 2026
@kdy1

kdy1 commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator Author

[claude-sonnet-5-5] responding on behalf of kdy1

Ready for review. Left for the human:

  • The speedup reaches customers only after a stable agent-device release accepts postGestureStabilization; then the dependency and the @e2e-dev/mobile peer floor need a bump. I did not bump to the nightly (declined cubic's request, replied on the thread).
  • Until then the re-read adds one snapshot to the first action after a test's swipe or scroll (measured +1.9% on 0.21.36, inside noise).
  • The timings in ## Verified were measured one commit before the node-swipe fix; performAt taps get no re-read yet.

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

Labels

Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. size:M Up to 99 changed lines, not counting tests, fixtures, translated docs, or the lockfile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants