Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Detox test caes fails when app is built using React native version 0.81.4 and new architecture enabled  #4842

@milansar

Description

@milansar

Did you test using the latest Detox?

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

Did your test fail and you're not sure why?

  • I have read the troubleshooting guide and it didn't help me.

What happened?

I updated my app to React native version 0.81.4 and detox to 20.42.0 with new architecture enabled as some project dependency like reanimate require new architecture , after upgrade all test cases failed which were working without problem with React native version 0.79.x and detox to 20.40.2.

It seems from log and some research with chatGPT the way detox try to find networkIdling no longer work with latest version of React native , null pointer exceptions is generated at java.lang.NullPointerException
at com.wix.detox.reactnative.idlingresources.network.NetworkIdlingResource.(NetworkIdlingResource.kt:24)

When I use following launchArgs , exception is gone and my test works partially by using random wait time as my test no longer has knowledge of on going network calls

launchArgs: { detoxEnableSynchronization: 0 }

What was the expected behaviour?

incase latest React native SDK has changed the way network Idling is identified then , Detox should updated it so test cases can run after upgrading to react native version 0.81+

Help us reproduce this issue!

No response

In what environment did this happen?

Detox version: 20.42.0
React Native version: 0.81.4
Has Fabric (React Native's new rendering system) enabled: (yes/no) Yes
Node version: 22.13.1
Device model: Android Emulator
Android version: Android 16 (Baklava)
Test-runner (select one): jest

Detox logs

Detox logs
There was 1 failure:
1) runDetoxTests(com.jitendra.ashutec.myapp.DetoxTest)
java.lang.NullPointerException
        at com.wix.detox.reactnative.idlingresources.network.NetworkIdlingResource.<init>(NetworkIdlingResource.kt:24)
        at com.wix.detox.reactnative.idlingresources.factory.FabricDetoxIdlingResourceFactoryStrategy$create$2.invokeSuspend(FabricDetoxIdlingResourceFactoryStrategy.kt:25)
        at com.wix.detox.reactnative.idlingresources.factory.FabricDetoxIdlingResourceFactoryStrategy$create$2.invoke(Unknown Source:8)
        at com.wix.detox.reactnative.idlingresources.factory.FabricDetoxIdlingResourceFactoryStrategy$create$2.invoke(Unknown Source:4)
        at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:42)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:164)
        at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
        at com.wix.detox.reactnative.idlingresources.factory.FabricDetoxIdlingResourceFactoryStrategy.create(FabricDetoxIdlingResourceFactoryStrategy.kt:18)
        at com.wix.detox.reactnative.idlingresources.factory.DetoxIdlingResourceFactory$create$2.invokeSuspend(DetoxIdlingResourceFactory.kt:18)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
        at android.os.Handler.handleCallback(Handler.java:995)
        at android.os.Handler.dispatchMessage(Handler.java:103)
        at android.os.Looper.loopOnce(Looper.java:248)
        at android.os.Looper.loop(Looper.java:338)
        at android.app.ActivityThread.main(ActivityThread.java:9067)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)

Device logs

Device logs
paste your device.log here!

More data, please!

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions