Detox: Error performing 'single click' view 'Animations or transitions are enabled on the target device.

Created on 22 Oct 2019  路  18Comments  路  Source: wix/Detox

Description
When tapping on a simple element I get "Error performing single click". On the screen, it seems like the actions are being activated before the actual tests.

await element(by.text('Sign in anonymously')).tap();

Versions

Detox: 14.5.0
React Native: 0.60.5
Node: 10.16.3
Environment type: android.attached

To Reproduce

  1. Set up detox for android
  2. Have a login button
  3. Use await element(by.text('Sign in anonymously')).tap();
  4. Test fails with error: Error performing 'single click' view 'Animations or transitions are enabled on the target device.

I've disabled animation from my app.

Expected behavior

I should be able to go to profile page when i sign in anonymously.

Device and Verbose Detox Logs

detox[6182] INFO:  [test.js] node_modules/.bin/mocha --opts e2e/mocha.opts --configuration android.emu.debug --loglevel trace --grep :ios: --invert --artifacts-location "artifacts/android.emu.debug.2019-10-22 15-39-13Z" "e2e"


detox[6190] INFO:  [DetoxServer.js] server listening on localhost:41855...
detox[6190] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:41855
detox[6190] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"login","params":{"sessionId":"c48c3593-3d72-0067-abc3-58569314a7a0","role":"tester"},"messageId":0}
detox[6190] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=c48c3593-3d72-0067-abc3-58569314a7a0
detox[6190] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=c48c3593-3d72-0067-abc3-58569314a7a0
detox[6190] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"loginSuccess","params":{"sessionId":"c48c3593-3d72-0067-abc3-58569314a7a0","role":"tester"},"messageId":0}

detox[6190] DEBUG: [exec.js/EXEC_CMD, #0] /home/felix/Android/Sdk/platform-tools/adb  devices
detox[6190] DEBUG: [exec.js/EXEC_SUCCESS, #0] List of devices attached
FA6950301847    device


detox[6190] DEBUG: [exec.js/EXEC_CMD, #1] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 shell "getprop ro.build.version.sdk"
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #1] 29

detox[6190] DEBUG: [exec.js/EXEC_CMD, #2] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 shell "dumpsys power | grep \"^[ ]*m[UW].*=\""
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #2]   mWakefulness=Awake
  mWakefulnessChanging=false
  mWakeLockSummary=0x23
  mUserActivitySummary=0x1
  mWakeUpWhenPluggedOrUnpluggedConfig=true
  mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig=false
  mUserActivityTimeoutOverrideFromWindowManager=-1
  mUserInactiveOverrideFromWindowManager=false

detox[6190] DEBUG: [exec.js/EXEC_CMD, #3] /home/felix/Android/Sdk/build-tools/29.0.2/aapt dump badging "/home/felix/banananow/android/app/build/outputs/apk/debug/app-debug.apk" | grep -e "package: name="
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #3] package: name='com.banananow' versionCode='1' versionName='1.0' compileSdkVersion='28' compileSdkVersionCodename='9'

detox[6190] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeUninstallApp({ deviceId: 'FA6950301847', bundleId: 'com.banananow' })
detox[6190] DEBUG: [exec.js/EXEC_CMD, #4] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 shell "pm list packages com.banananow"
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #4] package:com.banananow.test
package:com.banananow

detox[6190] DEBUG: [exec.js/EXEC_CMD, #5] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 uninstall com.banananow
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #5] Success

detox[6190] DEBUG: [exec.js/EXEC_CMD, #6] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 shell "pm list packages com.banananow.test"
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #6] package:com.banananow.test

detox[6190] DEBUG: [exec.js/EXEC_CMD, #7] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 uninstall com.banananow.test
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #7] Success

detox[6190] DEBUG: [exec.js/EXEC_CMD, #8] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 install -r -g -t "/home/felix/banananow/android/app/build/outputs/apk/debug/app-debug.apk"
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #8] Performing Streamed Install
Success

detox[6190] DEBUG: [exec.js/EXEC_CMD, #9] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 install -r -g -t "/home/felix/banananow/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk"
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #9] Performing Streamed Install
Success

detox[6190] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeTerminateApp({ deviceId: 'FA6950301847', bundleId: 'com.banananow' })
detox[6190] DEBUG: [exec.js/EXEC_CMD, #10] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 shell "am force-stop com.banananow"
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #10] 
detox[6190] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeLaunchApp({ deviceId: 'FA6950301847',
  bundleId: 'com.banananow',
  launchArgs:
   { detoxServer: 'ws://localhost:41855',
     detoxSessionId: 'c48c3593-3d72-0067-abc3-58569314a7a0' } })
detox[6190] DEBUG: [exec.js/EXEC_CMD, #11] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 shell "date +\"%m-%d %T.000\""
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #11] 10-22 17:39:24.000

detox[6190] DEBUG: [exec.js/EXEC_CMD, #12] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 reverse tcp:41855 tcp:41855
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #12] 41855

detox[6190] DEBUG: [exec.js/EXEC_CMD, #13] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 shell "pm list instrumentation"
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #13] instrumentation:com.banananow.test/androidx.test.runner.AndroidJUnitRunner (target=com.banananow)

detox[6190] DEBUG: [exec.js/SPAWN_CMD, #14] [pid=6379] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 shell am instrument -w -r -e detoxServer ws://localhost:41855 -e detoxSessionId c48c3593-3d72-0067-abc3-58569314a7a0 -e debug ZmFsc2U= com.banananow.test/androidx.test.runner.AndroidJUnitRunner
detox[6190] DEBUG: [exec.js/EXEC_CMD, #15] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 shell "ps | grep \"com\.banananow$\""
detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #15] u0_a373      10682 22585 5668016  72016                     0 R com.banananow

detox[10682] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onLaunchApp({ deviceId: 'FA6950301847',
  bundleId: 'com.banananow',
  launchArgs:
   { detoxServer: 'ws://localhost:41855',
     detoxSessionId: 'c48c3593-3d72-0067-abc3-58569314a7a0' },
  pid: 10682 })
detox[6190] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"isReady","params":{},"messageId":-1000}
detox[6190] TRACE: [DetoxServer.js/MESSAGE] role=tester action=isReady (sessionId=c48c3593-3d72-0067-abc3-58569314a7a0)
detox[6190] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=c48c3593-3d72-0067-abc3-58569314a7a0)
detox[6190] TRACE: [exec.js/SPAWN_STDOUT, #14] INSTRUMENTATION_STATUS: class=com.banananow.DetoxTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
com.banananow.DetoxTest:
INSTRUMENTATION_STATUS: test=runDetoxTests
INSTRUMENTATION_STATUS_CODE: 1

detox[6190] DEBUG: [DetoxServer.js/LOGIN] role=testee, sessionId=c48c3593-3d72-0067-abc3-58569314a7a0
detox[6190] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=testee, sessionId=c48c3593-3d72-0067-abc3-58569314a7a0
detox[6190] TRACE: [DetoxServer.js/MESSAGE] role=testee action=ready (sessionId=c48c3593-3d72-0067-abc3-58569314a7a0)
detox[6190] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":-1000,"type":"ready","params":{}}

detox[6190] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeAll()
  Example
detox[6190] TRACE: [Detox.js/DETOX_BEFORE_EACH] running test: "Example should show hello screen after tap"
detox[6190] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeEach({ title: 'should show hello screen after tap',
  fullName: 'Example should show hello screen after tap',
  status: 'running' })
detox[6190] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"reactNativeReload","params":{},"messageId":-1000}
detox[6190] TRACE: [DetoxServer.js/MESSAGE] role=tester action=reactNativeReload (sessionId=c48c3593-3d72-0067-abc3-58569314a7a0)
detox[6190] TRACE: [DetoxServer.js/MESSAGE] role=testee action=ready (sessionId=c48c3593-3d72-0067-abc3-58569314a7a0)
detox[6190] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":-1000,"type":"ready","params":{}}

detox[6190] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"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":"matcherForText","args":["Sign in anonymously"]}}]}},{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxViewActions"},"method":"click","args":[]}}]},"messageId":1}
detox[6190] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=c48c3593-3d72-0067-abc3-58569314a7a0)
detox[6190] TRACE: [DetoxServer.js/MESSAGE] role=testee action=error (sessionId=c48c3593-3d72-0067-abc3-58569314a7a0)
detox[6190] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":1,"type":"error","params":{"error":"Error performing 'single click - At Coordinates: 540, 1484 and precision: 16, 16' on view 'Animations or transitions are enabled on the target device.\nFor more info check: http://goo.gl/qVu1yV\n\n(with text: is \"Sign in anonymously\" and view has effective visibility=VISIBLE)'."}}

    1) should show hello screen after tap
detox[6190] TRACE: [Detox.js/DETOX_AFTER_EACH] failed test: "Example should show hello screen after tap"
detox[6190] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onAfterEach({ title: 'should show hello screen after tap',
  fullName: 'Example should show hello screen after tap',
  status: 'failed',
  timedOut: false })

detox[6190] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onAfterAll()
detox[6190] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"cleanup","params":{"stopRunner":false},"messageId":-49642}
detox[6190] TRACE: [DetoxServer.js/MESSAGE] role=tester action=cleanup (sessionId=c48c3593-3d72-0067-abc3-58569314a7a0)
detox[6190] TRACE: [DetoxServer.js/MESSAGE] role=testee action=cleanupDone (sessionId=c48c3593-3d72-0067-abc3-58569314a7a0)
detox[6190] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":-49642,"type":"cleanupDone","params":{}}

detox[6190] DEBUG: [exec.js/KILL] sending SIGINT to [pid = 6379]: /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 shell am instrument -w -r -e detoxServer ws://localhost:41855 -e detoxSessionId c48c3593-3d72-0067-abc3-58569314a7a0 -e debug ZmFsc2U= com.banananow.test/androidx.test.runner.AndroidJUnitRunner
detox[6190] DEBUG: [DetoxServer.js/DISCONNECT] role=tester, sessionId=c48c3593-3d72-0067-abc3-58569314a7a0
detox[6190] DEBUG: [exec.js/KILL] sending SIGINT to [pid = 6379]: /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 shell am instrument -w -r -e detoxServer ws://localhost:41855 -e detoxSessionId c48c3593-3d72-0067-abc3-58569314a7a0 -e debug ZmFsc2U= com.banananow.test/androidx.test.runner.AndroidJUnitRunner
detox[6190] TRACE: [exec.js/SPAWN_END, #14] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 shell am instrument -w -r -e detoxServer ws://localhost:41855 -e detoxSessionId c48c3593-3d72-0067-abc3-58569314a7a0 -e debug ZmFsc2U= com.banananow.test/androidx.test.runner.AndroidJUnitRunner terminated with SIGINT
detox[6190] DEBUG: [exec.js/EXEC_CMD, #16] /home/felix/Android/Sdk/platform-tools/adb -s FA6950301847 reverse --remove tcp:41855
detox[6190] DEBUG: [DetoxServer.js/DISCONNECT] role=testee, sessionId=c48c3593-3d72-0067-abc3-58569314a7a0
detox[6190] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=tester not connected, cannot fw action (sessionId=c48c3593-3d72-0067-abc3-58569314a7a0)
detox[6190] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully

  0 passing (47s)
  1 failing

  1) Example
       should show hello screen after tap:
     Error: Error performing 'single click - At Coordinates: 540, 1484 and precision: 16, 16' on view 'Animations or transitions are enabled on the target device.
For more info check: http://goo.gl/qVu1yV

(with text: is "Sign in anonymously" and view has effective visibility=VISIBLE)'.
      at Client.execute (node_modules/detox/src/client/Client.js:92:28)
      at InvocationManager.execute (node_modules/detox/src/invoke.js:11:39)
      at ActionInteraction.execute (node_modules/detox/src/android/expect.js:128:35)
      at Element.tap (node_modules/detox/src/android/expect.js:220:88)
      at Context.it (e2e/firstTest.spec.js:11:51)
      at process._tickCallback (internal/process/next_tick.js:68:7)



detox[6190] TRACE: [exec.js/EXEC_SUCCESS, #16] 
detox[6182] ERROR: [cli.js] Error: Command failed: node_modules/.bin/mocha --opts e2e/mocha.opts --configuration android.emu.debug --loglevel trace --grep :ios: --invert --artifacts-location "artifacts/android.emu.debug.2019-10-22 15-39-13Z" "e2e"
triagbug android

Most helpful comment

@Grohden this is insanely bizarre, I don't understand how these 2 points can account for anything

All 18 comments

I'm facing the same problem on Android :(

We have the same issue on Android, click is performed, but test is failed with error above, can somebody help?

Espresso recommends disabling animations on the target device. After starting the emulator run:

adb shell settings put global window_animation_scale 0
adb shell settings put global transition_animation_scale 0
adb shell settings put global animator_duration_scale 0

https://developer.android.com/training/testing/espresso/setup#set-up-environment

I'm facing the same problem and disabling the animations did not solve the problem.

I think my problem is because the component ceases to exist right after the click (goes to another screen and current one is "destroyed")

if we could at least ignore the error message...

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.

Can somebody sort this problem?

@voold please attach the device logs from when this happens (i.e. using adb logcat).
My guess is that your app crashes for some reason.

@d4vidi
I'm with all animations disabled (otherwise I get a espresso error). The error happens when I'm trying to tap a RN paper button, which uses TouchableRipple.

Here's the js stack trace:

Error: Error performing 'com.wix.detox.espresso.action.detoxsingletap@f1fcb75 click' on view '(with tag value: is "create-request-button" and view has effective visibility=VISIBLE)'.
    at Client.execute (/home/gabriel/keepfy/keepfy-app/node_modules/detox/src/client/Client.js:92:28)
    at InvocationManager.execute (/home/gabriel/keepfy/keepfy-app/node_modules/detox/src/invoke.js:11:39)
    at ActionInteraction.execute (/home/gabriel/keepfy/keepfy-app/node_modules/detox/src/android/expect.js:128:35)
    at Element.tap (/home/gabriel/keepfy/keepfy-app/node_modules/detox/src/android/expect.js:220:88)
    at Object.pressHandler (/home/gabriel/keepfy/keepfy-app/detox/integration/step_definitions/when.step.ts:8:18)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Here's a logcat:

01-31 11:37:26.622 15133 15231 E DetoxManager: Exception
01-31 11:37:26.622 15133 15231 E DetoxManager: java.lang.reflect.InvocationTargetException
01-31 11:37:26.622 15133 15231 E DetoxManager:  at java.lang.reflect.Method.invoke(Native Method)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at org.apache.commons.lang3.reflect.MethodUtils.invokeStaticMethod(MethodUtils.java:443)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at org.apache.commons.lang3.reflect.MethodUtils.invokeStaticMethod(MethodUtils.java:405)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at com.wix.invoke.types.ClassTarget.execute(ClassTarget.java:23)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at com.wix.invoke.types.Target.invoke(Target.java:59)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at com.wix.invoke.MethodInvocation.invoke(MethodInvocation.java:35)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at com.wix.invoke.MethodInvocation.invoke(MethodInvocation.java:26)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at com.wix.invoke.MethodInvocation.invoke(MethodInvocation.java:20)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at com.wix.detox.InvokeActionHandler.handle(DetoxActionHandlers.kt:51)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at com.wix.detox.DetoxManager$2.run(DetoxManager.java:115)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at android.os.Handler.handleCallback(Handler.java:873)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at android.os.Handler.dispatchMessage(Handler.java:99)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at android.os.Looper.loop(Looper.java:193)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at com.wix.detox.Detox$1.run(Detox.java:138)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at java.lang.Thread.run(Thread.java:764)
01-31 11:37:26.622 15133 15231 E DetoxManager: Caused by: androidx.test.espresso.PerformException: Error performing 'com.wix.detox.espresso.action.detoxsingletap@f1fcb75 click' on view '(with tag value: is "create-request-button" and view has effective visibility=VISIBLE)'.
01-31 11:37:26.622 15133 15231 E DetoxManager:  at androidx.test.espresso.PerformException$Builder.build(PerformException.java:86)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at androidx.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:87)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:59)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:322)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at androidx.test.espresso.ViewInteraction.desugaredPerform(ViewInteraction.java:178)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at androidx.test.espresso.ViewInteraction.perform(ViewInteraction.java:119)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at com.wix.detox.espresso.EspressoDetox.perform(EspressoDetox.java:40)
01-31 11:37:26.622 15133 15231 E DetoxManager:  ... 15 more
01-31 11:37:26.622 15133 15231 E DetoxManager: Caused by: java.lang.RuntimeException: Couldn't click at: 979.0,2096.0 precision: 16.0, 16.0 . Tapper: com.wix.detox.espresso.action.DetoxSingleTap@f1fcb75 coordinate provider: VISIBLE_CENTER precision describer: FINGER. Tried 3 times. With Rollback? false
01-31 11:37:26.622 15133 15231 E DetoxManager:  at androidx.test.espresso.action.GeneralClickAction.perform(GeneralClickAction.java:187)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at com.wix.detox.espresso.action.RNClickAction.perform(RNClickAction.java:55)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at androidx.test.espresso.ViewInteraction$SingleExecutionViewAction.perform(ViewInteraction.java:366)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at androidx.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:255)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at androidx.test.espresso.ViewInteraction.access$100(ViewInteraction.java:65)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:158)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:155)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at android.os.Handler.handleCallback(Handler.java:873)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at android.os.Handler.dispatchMessage(Handler.java:99)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at android.os.Looper.loop(Looper.java:193)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at android.app.ActivityThread.main(ActivityThread.java:6940)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at java.lang.reflect.Method.invoke(Native Method)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
01-31 11:37:26.622 15133 15231 E DetoxManager:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

I'm really not sure what is causing the error here, the stack trace doesn't help me at least
Edit:

971 and #1782 may be related?

Edit:
I seems like the button position on screen is making this crash, I have a button that is placed on the very bottom of the screen, and when I added a marginBottom=50 the click worked.. this is very strange, since the button I'm trying to click is visible.

@Grohden Detox sets the tap at the view's center, which is probably hidden in your case. Unfortunately, we haven't provided a way to manipulate that, just yet.

@d4vidi I see, but I would get a not visible error right? My final solution was just to add a margin bottom of 1, this solved the error...
Edit: And my view center's is definitely visible. The button with the label "criar" at the modal bottom is the one that gives the error. (it's fixed on the image with the bottomMargin=1)
image

Not sure if you would like to give a look at that, if so I can try to make an example project

I would get a not visible error right?

Not necessarily
What did it look like before the margin?

Sorry, my last comment screenshot is without the margin, also the margin value is 2 not 1.
Here's the both versions (without and with margin):

83892784_1029106354121006_757249145701400576_n


84476623_1509508865875746_995649118011392000_n

@Grohden this is insanely bizarre, I don't understand how these 2 points can account for anything

@voold, has @compojoom's suggestion helped you in any way? It adhere's to Google's instructions on this:

Set up your test environment

To avoid flakiness, we highly recommend that you turn off system animations on the virtual or physical devices used for testing. On your device, under Settings > Developer options, disable the following 3 settings:

  • Window animation scale
  • Transition animation scale
  • Animator duration scale

Here's an updated link: https://developer.android.com/training/testing/espresso/setup#set-up-environment

Yikes, this happened on Detox CI as well. I'll get to it soon. https://jenkins-oss.wixpress.com/job/multi-detox-pr/1927/

Post-research update:
The error in question (i.e Error performing 'single click - At Coordinates: x, y and precision: 16, 16' on view 'Animations or transitions are enabled on the target device.), is a _default_ one generated by Espresso for _any_ error occurring while waiting for a ViewInteraction's invocation result.

Hence, effectively, the error itself is very misleading. For example, in the aforementioned failing Detox CI build, the real error was a crash in a core UI handling module; The reported error was merely a far side-effect of what really went wrong.

The takeaway for Detox here, then, is to check why the full error description - stack-traces and cause-chain included, is not reported as the final error.

In the meantime, my advice for @voold and whoever faces this, is to dive into the device logs and look for the genuine failure there. Device logs almost never lie.

After putting in serious efforts into reproducing and analyzing the issue (effectively coming from multiple sources in multiple forms...), it appears #1932 has "fixed" it after all.

It turns out that behind this naively looking error lies a complex scenario. I'll try to explain it all below.

Some background:

From Detox' perspective, we largely differentiate between two types of native-side errors:

A. Errors taking place synchronously while natively handling an invocation command, such as a tap. In this scenario, the associated action (e.g. tap) typically fails, and an error message is gracefully sent back to the tester, explicitly telling it this specific command has failed.

B. Errors taking place asynchronously, or indirectly, as a side-effect of an action. For example, tapping on a button that opens a buggy screen (i.e. which rendering somehow results a native crash). Here as well, the error is reported async'ly back to the tester, and the test runner deduces that it should close everything down (hence, eventually the in-flight command will eventually fail, as well).

While different, in both cases, eventually two things are meant to happen so that the end result would be acceptable by the Detox user:

  1. The tester side of Detox (node) makes sure the command in flight throws an error such that the test runner would fail.
  2. The app should be killed by Android / instrumentation.

The bug

When a _type-A_ error happens in the app while handling a view interaction (e.g. a tap action) - referring here to _any_ error (even a NullPointerException), unless carefully treated, it will be shadowed by the discussed error (i.e. Error performing 'single click...), which is currently reported instead. This is one form of the bug and it is easy to fix.

However, for _type-B_ errors, though reported back async'ly to the tester, in rare cases, it is possible that the discussed error will be reported alongside it (which can be confusing for the user). How can that be? As it seems, of the 2 aforementioned expected end-results, result 2 does not occur when the following _general_ condition is true:

_There are still remaining messages awaiting in queue for handling by a native looper-thread._

In particular, Detox' native test runner is such a thread; If, by a rare occasion, the next test-command has already been received by the app-native side of detox when the crash takes place, then the app will remain alive nevertheless -- hence open for handling of more test commands (such as more view interactions).

In that case, what are such possible rare occasions where a command "slips through" to have the Detox thread blocking the app from dying? I've identified two:

  1. The initial error is actively caught by the test. The test runner then moves on to executing the next test line and sends it to the device.
  2. The initial error occurs inside a beforeEach. Indeed, like it or not - jasmine2, when identifying an error thrown inside a beforeEach, continues on to running the currently targeted test nonetheless; Possibly, the test's first line is yet another action, such as a tap - that is bound to fail. Jasmine _will_ eventually report (through Jest) a summary containing _two_ errors (one from each block), but still remains here a confusing concept where a test is run in spite of set-up preconditions failing...

So having proven this set of weird conditions _is_ possible to occur (though rarely), what is the outcome of it all? Again, the 1st error is reported immediately; As for the 2nd error failing action that's slipped in - it will result in no other than the renowed error - Error performing 'single click (...) Animations or transitions are enabled on the target device, because the app is alive and capable of handling the action, but it can never go idle (implicitly assuming here that the 1st error crashed one of the idle-monitored resources..).

The fix

For _type-A_ errors, reporting the entire stack-trace rather than simply the error message will suffice: the root cause for the chain of events will be included inside the trace, and it will show very vividly in the logs. This is what #1932 does, in essence.

For _type-B_ errors, seeing that we have no control of what the test-runner running on the JS-side does, we have no choice but to report all errors in the chain -- namely the 1st (async) error _and_ the error resulting due to the test-command that's slipped in (blocking the app from dying, etc.). This is effectively what we already do now. Thanks to #1932, we now also report the entire stack-trace, down to the root exception.

In this particularly reported issue we don't have a lot of info, but since only one explicit error shows in the quotes logs, it is likely a type-A error and is therefore fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danut-t picture danut-t  路  3Comments

raphkr picture raphkr  路  4Comments

gtRfnkN picture gtRfnkN  路  4Comments

lc3t35 picture lc3t35  路  4Comments

JB-CHAUVIN picture JB-CHAUVIN  路  3Comments