Has anyone had any success with using Detox in a detached Expokit app?
- I created a boilerplate app with expo-cli --version: 2.10.1 on node --version: v8.15.0.
- I followed steps relevant to Expo blog post about Detox
- I followed the instructions in the Detox docs except for “Create Android Test Class” which I needed to change to be under host.exp.exponent or otherwise I got errors about “symbol cannot be found” for MainActivity.
Detox was able to successfully build the app, but when I run the tests with detox test -c android.emu.debug
the app crashes, with the following error in logcat:
02-12 10:16:58.954 5299 5381 E AndroidRuntime: java.lang.ClassCastException: host.exp.exponent.MainApplication cannot be cast to com.facebook.react.ReactApplication
02-12 10:16:58.954 5299 5381 E AndroidRuntime: at com.wix.detox.ReactNativeSupport.getInstanceManager(ReactNativeSupport.java:63)
02-12 10:16:58.954 5299 5381 E AndroidRuntime: at com.wix.detox.ReactNativeSupport.waitForReactNativeLoad(ReactNativeSupport.java:117)
02-12 10:16:58.954 5299 5381 E AndroidRuntime: at com.wix.detox.ReactNativeCompat.waitForReactNativeLoad(ReactNativeCompat.java:33)
02-12 10:16:58.954 5299 5381 E AndroidRuntime: at com.wix.detox.DetoxManager.initReactNativeIfNeeded(DetoxManager.java:226)
02-12 10:16:58.954 5299 5381 E AndroidRuntime: at com.wix.detox.DetoxManager.start(DetoxManager.java:74)
02-12 10:16:58.954 5299 5381 E AndroidRuntime: at com.wix.detox.Detox$1$1.run(Detox.java:133)
02-12 10:16:58.954 5299 5381 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:790)
02-12 10:16:58.954 5299 5381 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
02-12 10:16:58.954 5299 5381 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164)
02-12 10:16:58.954 5299 5381 E AndroidRuntime: at com.wix.detox.Detox$1.run(Detox.java:136)
02-12 10:16:58.954 5299 5381 E AndroidRuntime: at java.lang.Thread.run(Thread.java:764)
I don’t know any Java, so I’m not sure where to go from here. The test app does not have any changes from the boilerplate ejected expokit app: