Detox: Android tap, swipe, scroll, and scrollTo do not work

What happened?

I was able to confirm that the detox build and test work properly on iOS. On Android, the detox build works fine, but the following error occurs in the test.

At first, I had speculated that this error was due to not finding the testID on Android. However, my first test is to find the scrollView id on the initial screen. await expect(element(by.id('dashboardScrollView'))).toBeVisible(); Given that this is successful, it seems that it’s correctly identifying the testID.

What was the expected behaviour?

The tap, swipe, scroll, scrollTo function should work properly.

Was it tested on latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test throw out a timeout?

Help us reproduce this issue!

No response

In what environment did this happen?

Detox version: 20.13.1 React Native version: 0.67.5 Has Fabric (React Native’s new rendering system) enabled: no Node version: v16.19.0 Device model: Samsung Galaxy Note10 Android version: 12 Test-runner (select one): jest

Detox logs

Detox logs

10:14:41.289 detox[74182] E ws-client scroll to bottom
  error: java.lang.NoSuchMethodException: No such accessible method: perform() on class: com.wix.detox.espresso.EspressoDetox
        at org.apache.commons.lang3.reflect.MethodUtils.invokeStaticMethod(MethodUtils.java:439)
        at org.apache.commons.lang3.reflect.MethodUtils.invokeStaticMethod(MethodUtils.java:405)
        at com.wix.invoke.types.ClassTarget.execute(ClassTarget.java:23)
        at com.wix.invoke.types.Target.invoke(Target.java:59)
        at com.wix.invoke.MethodInvocation.invoke(MethodInvocation.java:35)
        at com.wix.invoke.MethodInvocation.invoke(MethodInvocation.java:26)
        at com.wix.invoke.MethodInvocation.invoke(MethodInvocation.java:20)
        at com.wix.detox.adapters.server.InvokeActionHandler.handle(DetoxActionHandlers.kt:54)
        at com.wix.detox.adapters.server.ActionsExecutor.executeAction$lambda-2$lambda-1(DetoxActionsDispatcher.kt:64)
        at com.wix.detox.adapters.server.ActionsExecutor.$r8$lambda$nk3cF8ntnfFqbJOcVqd04vjb5nY(Unknown Source:0)
        at com.wix.detox.adapters.server.ActionsExecutor$$ExternalSyntheticLambda0.run(Unknown Source:8)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at com.wix.detox.adapters.server.ActionsExecutor._init_$lambda-0(DetoxActionsDispatcher.kt:50)
        at com.wix.detox.adapters.server.ActionsExecutor.$r8$lambda$Hi5vyewqQiQqk57AkJy_cHqNGKY(Unknown Source:0)
        at com.wix.detox.adapters.server.ActionsExecutor$$ExternalSyntheticLambda1.run(Unknown Source:4)
        at java.lang.Thread.run(Thread.java:920)
  
  Check device logs for full details!
  
10:14:41.293 detox[74182] B artifacts-manager onTestFnFailure
  args: ({"error":{"name":"DetoxRuntimeError"}})
10:14:41.293 detox[74182] E artifacts-manager onTestFnFailure
10:14:41.294 detox[74182] E lifecycle test_fn
  error: java.lang.NoSuchMethodException: No such accessible method: perform() on class: com.wix.detox.espresso.EspressoDetox
        at org.apache.commons.lang3.reflect.MethodUtils.invokeStaticMethod(MethodUtils.java:439)
        at org.apache.commons.lang3.reflect.MethodUtils.invokeStaticMethod(MethodUtils.java:405)
        at com.wix.invoke.types.ClassTarget.execute(ClassTarget.java:23)
        at com.wix.invoke.types.Target.invoke(Target.java:59)
        at com.wix.invoke.MethodInvocation.invoke(MethodInvocation.java:35)
        at com.wix.invoke.MethodInvocation.invoke(MethodInvocation.java:26)
        at com.wix.invoke.MethodInvocation.invoke(MethodInvocation.java:20)
        at com.wix.detox.adapters.server.InvokeActionHandler.handle(DetoxActionHandlers.kt:54)
        at com.wix.detox.adapters.server.ActionsExecutor.executeAction$lambda-2$lambda-1(DetoxActionsDispatcher.kt:64)
        at com.wix.detox.adapters.server.ActionsExecutor.$r8$lambda$nk3cF8ntnfFqbJOcVqd04vjb5nY(Unknown Source:0)
        at com.wix.detox.adapters.server.ActionsExecutor$$ExternalSyntheticLambda0.run(Unknown Source:8)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at com.wix.detox.adapters.server.ActionsExecutor._init_$lambda-0(DetoxActionsDispatcher.kt:50)
        at com.wix.detox.adapters.server.ActionsExecutor.$r8$lambda$Hi5vyewqQiQqk57AkJy_cHqNGKY(Unknown Source:0)
        at com.wix.detox.adapters.server.ActionsExecutor$$ExternalSyntheticLambda1.run(Unknown Source:4)
        at java.lang.Thread.run(Thread.java:920)
  
  Check device logs for full details!

Device logs

Device logs
10-23 10:14:40.890 30580 30685 D Detox   : class com.wix.detox.espresso.DetoxMatcher, matcherForTestId, [dashboardScrollView, false]
10-23 10:14:40.893 30580 30685 D Detox   : class com.wix.detox.espresso.DetoxAction, scrollToEdge, [4]
10-23 10:14:40.896 30580 30685 D Detox   : class com.wix.detox.espresso.EspressoDetox, perform, [(view.getTag() is "dashboardScrollView" and view has effective visibility <VISIBLE>), com.wix.detox.espresso.DetoxAction$2@899faf9]
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: Exception
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: java.lang.NoSuchMethodException: No such accessible method: perform() on class: com.wix.detox.espresso.EspressoDetox
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at org.apache.commons.lang3.reflect.MethodUtils.invokeStaticMethod(MethodUtils.java:439)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at org.apache.commons.lang3.reflect.MethodUtils.invokeStaticMethod(MethodUtils.java:405)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at com.wix.invoke.types.ClassTarget.execute(ClassTarget.java:23)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at com.wix.invoke.types.Target.invoke(Target.java:59)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at com.wix.invoke.MethodInvocation.invoke(MethodInvocation.java:35)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at com.wix.invoke.MethodInvocation.invoke(MethodInvocation.java:26)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at com.wix.invoke.MethodInvocation.invoke(MethodInvocation.java:20)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at com.wix.detox.adapters.server.InvokeActionHandler.handle(DetoxActionHandlers.kt:54)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at com.wix.detox.adapters.server.ActionsExecutor.executeAction$lambda-2$lambda-1(DetoxActionsDispatcher.kt:64)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at com.wix.detox.adapters.server.ActionsExecutor.$r8$lambda$nk3cF8ntnfFqbJOcVqd04vjb5nY(Unknown Source:0)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at com.wix.detox.adapters.server.ActionsExecutor$$ExternalSyntheticLambda0.run(Unknown Source:8)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at android.os.Handler.handleCallback(Handler.java:938)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at android.os.Handler.dispatchMessage(Handler.java:99)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at android.os.Looper.loopOnce(Looper.java:226)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at android.os.Looper.loop(Looper.java:313)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at com.wix.detox.adapters.server.ActionsExecutor._init_$lambda-0(DetoxActionsDispatcher.kt:50)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at com.wix.detox.adapters.server.ActionsExecutor.$r8$lambda$Hi5vyewqQiQqk57AkJy_cHqNGKY(Unknown Source:0)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at com.wix.detox.adapters.server.ActionsExecutor$$ExternalSyntheticLambda1.run(Unknown Source:4)
10-23 10:14:40.899 30580 30685 E DetoxActionHandlers: 	at java.lang.Thread.run(Thread.java:920)
10-23 10:14:40.901 30580 30685 I DetoxWSClient: Sending out action 'error' (ID #5)
10-23 10:14:40.906 30580 30685 I DetoxDispatcher: Done with action 'invoke'

More data, please!

No response

About this issue

  • Original URL
  • State: open
  • Created 8 months ago
  • Comments: 26

Most upvoted comments

Hey @Seraphiyra When can we expect a resolution for this issue? It’s impacting our ability to run tests on API levels 33 and 34, which is a major hurdle for us right now. Any update on the timeline for fixing this would be greatly appreciated!

Having same problem. Tests work fine on iOS, but on Android swipe gestures don’t work (taps might not work either, but my app’s first screen needs to be swiped away first to try that). They don’t fail either, detox thinks it has done them and continues the script, and then some later action fails because it didn’t.

Using detox 20.13.5. Tried 20.13.0 and 20.13.2-smoke.0 with no success. Tried downgrading API level from 34 to 32 (as suggested in #2787 (comment)) with no success either. Running with node v18, react 18.2.0, react native 0.72.0 (new arch not enabled), jest 29.7.0.

Any suggestions to go around this? I don’t mind having to downgrade API level or detox/jest versions.

Thanks in advance for any help!

Hey @ianspektor 👋 just thought I’d let you know that it turns out simply downgrading from 33 -> 32 wasn’t the solution for me. We were previously using emulators with Google API, however we switched over to using the Google Play API (and went to 32) then it worked.

May have had something to do with one of our dependencies requiring Google Play APIs to work🤷‍♀️

However, it seems odd to me as we didn’t need them before 🤔

Also doesn’t make sense, as there didn’t seems to be any errors relating to anything like that in our trace logs that would specifically only impact swipe actions.

As you mentioned, it was as if Detox thought it had successfully completed the swipe action and carrys on with the next action, only falling over when something wasn’t where we expected later.

There was a bit too many moving parts to be able troubleshoot this one for sure in my project as I think it may have been a compound effect. We were upgrading React Native from 0.69 -> 0.72.5. Then during that the yarn.lock file was regenerated and increased all the dependencies versions. This bumped us from Detox 20.0.03 -> 20.13.0

We had been holding off upgrading it recently because we were waiting for https://github.com/wix/Detox/issues/3762 Which luckily was released not long after. It then allowed us to also upgrade the API version, which we had been stuck at 31, because of the aforementioned issue.

So it could be that something else in the RN upgrade/yarn.lock file changes caused our issues with now needing to use Google Play APIs for swipe actions to work but we didn’t see it until we were finally able to upgrade Detox and also upgrade the API.

Thought I’d mention this on the off chance it helps you 😅

Not during build process, but when running detox test --configuration android.emu.debug Might be worth doing as 0.70.x and 0.71.x are mentioned on the docs as the officially supported versions.

Managed to get it to work. I updated my Kotlin version in build.gradle as per https://wix.github.io/Detox/docs/introduction/project-setup to 1.9.0 to match my system and rebuilt the app with detox build --configuration android.emu.debug