wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.24k stars 1.92k forks source link

.scrollTo() work too slow on Android #2496

Closed retyui closed 3 years ago

retyui commented 3 years ago

Describe the bug

I've just added Detox to my App, using a debug build I run a test with scroll to bottom action. And it seems very laggy

  // I tried to diables Synchronization but I didn't see effect
  await device.disableSynchronization(); 
  await elementById(EMOTIONS_INTRO_SCROLL_VIEW).scrollTo('bottom');
  await elementById(EMOTIONS_INTRO_DONE_BUTTON).tap();
  await device.enableSynchronization();

To Reproduce

Steps to reproduce:

  1. Android + debug build
  2. scrollTo()
  3. See a video below
      <ScrollView testID={EMOTIONS_INTRO_SCROLL_VIEW}>
        <View
          style={{
            height: 400,
            borderWidth: 1,
            borderColor: 'red',
          }}
        />
        <View
          style={{
            height: 400,
            borderWidth: 1,
            borderColor: 'gold',
          }}
        />
        <View
          style={{
            height: 400,
            borderWidth: 1,
            borderColor: 'blue',
          }}
        />
        <View
          style={{
            height: 400,
            borderWidth: 1,
            borderColor: 'green',
          }}
        />
        <View
          style={{
            height: 400,
            borderWidth: 1,
            borderColor: 'pink',
          }}
        />
        <Button
          testID={EMOTIONS_INTRO_DONE_BUTTON}
          title="MyButton"
          onPress={() => {}}
        />
      </ScrollView>

Expected behavior Scroll action works without laggy

Screenshots

Device and Verbose Detox Logs

11-30 13:00:21.043 20219 20338 I DetoxManager: onAction: type: invoke params: {"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["EMOTIONS_INTRO_SCROLL_VIEW"]}}]}},{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAction"},"method":"scrollToEdge","args":[{"type":"Integer","value":4}]}}]}
11-30 13:00:21.044 20219 20325 D Detox   : class com.wix.detox.espresso.DetoxMatcher, matcherForTestId, [EMOTIONS_INTRO_SCROLL_VIEW]
11-30 13:00:21.044 20219 20325 D Detox   : class androidx.test.espresso.Espresso, onView, [(with tag value: is "EMOTIONS_INTRO_SCROLL_VIEW" and view has effective visibility=VISIBLE)]
11-30 13:00:21.045 20219 20325 D Detox   : class com.wix.detox.espresso.DetoxAction, scrollToEdge, [4]
11-30 13:00:21.045 20219 20325 D Detox   : class com.wix.detox.espresso.EspressoDetox, perform, [androidx.test.espresso.ViewInteraction@125d31a, com.wix.detox.espresso.DetoxAction$2@388fe4b]
11-30 13:00:21.049 20219 20219 I ViewInteraction: Performing 'scrollToEdge' action on view (with tag value: is "EMOTIONS_INTRO_SCROLL_VIEW" and view has effective visibility=VISIBLE)
11-30 13:00:21.050 20219 20219 D DetoxScrollHelper: scroll Point(540, 1791) --> Point(540, 156)
11-30 13:00:21.195  1804  1871 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@570502d)
11-30 13:00:21.195  1804  1818 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@570502d)
11-30 13:00:21.234 20219 20338 I WebSocketClient: At onMessage
11-30 13:00:21.235 20219 20338 I WebSocketClient: At receiveAction
11-30 13:00:21.235 20219 20338 D WebSocketClient: Detox Action Received: currentStatus
11-30 13:00:21.235 20219 20338 I DetoxManager: onAction: type: currentStatus params: {}
11-30 13:00:21.243 20219 20338 I WebSocketClient: At onMessage
11-30 13:00:21.243 20219 20338 I WebSocketClient: At receiveAction
11-30 13:00:21.243 20219 20338 D WebSocketClient: Detox Action Received: currentStatus
11-30 13:00:21.243 20219 20338 I DetoxManager: onAction: type: currentStatus params: {}
11-30 13:00:21.715 20219 20219 W UiControllerImpl: Waiting for: MOTION_INJECTION_HAS_COMPLETED for 200 iterations.
11-30 13:00:22.195  1804  1871 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@90e0962)
11-30 13:00:22.195  1804  1818 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@90e0962)
11-30 13:00:22.979 20219 20219 W UiControllerImpl: Waiting for: MOTION_INJECTION_HAS_COMPLETED for 400 iterations.
11-30 13:00:23.062  1675  1750 E storaged: getDiskStats failed with result NOT_SUPPORTED and size 0
11-30 13:00:23.196  1804  1871 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@5a20af3)
11-30 13:00:23.197  1804  1818 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@5a20af3)
11-30 13:00:23.709 20219 20219 W UiControllerImpl: Waiting for: MOTION_INJECTION_HAS_COMPLETED for 500 iterations.
11-30 13:00:23.858  1547  1637 W audio_hw_generic: Not supplying enough data to HAL, expected position 68379262 , only wrote 68182560
11-30 13:00:24.197  1804  1871 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@faebe3f)
11-30 13:00:24.198  1804  1818 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@faebe3f)
11-30 13:00:25.197  1804  1871 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@f18630c)
11-30 13:00:25.197  1804  1818 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@f18630c)
11-30 13:00:25.240 20219 20219 W UiControllerImpl: Waiting for: MOTION_INJECTION_HAS_COMPLETED for 700 iterations.
11-30 13:00:25.551 20219 20219 D DetoxScrollHelper: scroll Point(540, 1791) --> Point(540, 156)
11-30 13:00:26.158 20219 20244 W FA      : No number filter for long property. property: _fot
11-30 13:00:26.196  1804  1871 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@e190d1)
11-30 13:00:26.196  1804  1818 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@e190d1)
11-30 13:00:26.236 20219 20219 W UiControllerImpl: Waiting for: MOTION_INJECTION_HAS_COMPLETED for 200 iterations.
11-30 13:00:26.323 20219 20244 W FA      : No number filter for long property. property: _fot
11-30 13:00:26.483 20219 20244 I chatty  : uid=10499(com.sintylapse.therapydiaries.debug) Measurement Wor identical 1 line
11-30 13:00:26.647 20219 20244 W FA      : No number filter for long property. property: _fot
11-30 13:00:26.996 20219 20219 W UiControllerImpl: Waiting for: MOTION_INJECTION_HAS_COMPLETED for 300 iterations.
11-30 13:00:27.196  1804  1871 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@295e0c2)
11-30 13:00:27.201  1804  1818 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@295e0c2)
11-30 13:00:27.732 20219 20219 W UiControllerImpl: Waiting for: MOTION_INJECTION_HAS_COMPLETED for 400 iterations.
11-30 13:00:28.197  1804  1871 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@c57fed3)
11-30 13:00:28.198  1804  1818 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@c57fed3)
11-30 13:00:28.514 20219 20219 W UiControllerImpl: Waiting for: MOTION_INJECTION_HAS_COMPLETED for 500 iterations.
11-30 13:00:29.196  1804  1871 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@b4dfa10)
11-30 13:00:29.197  1804  1818 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@b4dfa10)
11-30 13:00:29.290 20219 20219 W UiControllerImpl: Waiting for: MOTION_INJECTION_HAS_COMPLETED for 600 iterations.
11-30 13:00:29.401  1804  1818 E memtrack: Couldn't load memtrack module
11-30 13:00:29.401  1804  1818 W android.os.Debug: failed to get memory consumption info: -1
11-30 13:00:30.062 20219 20219 I Detox   : UIManagerModule is busy
11-30 13:00:30.068 20219 20219 D DetoxScrollHelper: scroll Point(540, 1791) --> Point(540, 156)

Environment (please complete the following information):

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this reporsitory, read this discussion.

retyui commented 3 years ago

активный

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this reporsitory, read this discussion.

retyui commented 3 years ago

noooo please stop

aleparty commented 3 years ago

We have the same issue, while on iOS scroll works smooth and fast - it does not do so on Android

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this reporsitory, read this discussion.

d4vidi commented 3 years ago

@retyui On Android we've decided to prefer accuracy over smoothness. When the scroll happens too fast, acceleration catches up and the scrolling continues uncontrollably due to a subsequent fling. However, we might allow for a speed factor parameter (slow = default vs. fast). Would that work in your use case?

KatieSnell-TomTom commented 3 years ago

@d4vidi joining this as I would love to see a speedier scroll on Android emulators!

Also, both the swipe and scrollTo actions are not working on all the scroll views in my app (some work as expected, some do not get scrolled). Do you know how I can figure out what is different and why it is not working"?

d4vidi commented 3 years ago

@KatieSnell-TomTom please try to follow #2787, if you think it matches your scenarios. If it does, feel free to submit your artifacts and use case details as well, there.