wix / Detox

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

React Native latest version (current 0.56) support #821

Closed heuism closed 6 years ago

heuism commented 6 years ago

Hi guys,

I have just a quick question about the plan to support latest RN version (current is 0.56).

I can see in the Readme file. there is the limit in the React Native version for Detox support. I am wondering why the support for both iOS and Android is not the same? So to develop and test for both platforms should the project stay under 0.51?

And I am asking for the future plan of updating the project to React Native 0.56 for Firebase issue with the versioning. And when it goes up, it would lose the support from Detox.

Thanks for your support. Best wishes.

todorone commented 6 years ago

@heuism Detox works on RN 0.56 on iOS. No clue about Android though...

vonovak commented 6 years ago

one user reported that they have detox working on android with RN 0.55.4 https://github.com/wix/detox/pull/773#issuecomment-404250381

neerajkumar-lad commented 6 years ago

https://stackoverflow.com/questions/51305555/could-not-find-method-missingdimensionstrategy-for-arguments-minreactnative

LeoNatan commented 6 years ago

Internally, Wix uses 0.51 currently. So we have to support that as the baseline. Is there something in particular that is not supported with 0.56? iOS or Android? Or is it just the docs not updated to state that it is supported?

LeoNatan commented 6 years ago

Ah, I see Android is trailing behind.

@rotemmiz @noomorph Isn't it time to start looking into supporting modern RN? Wix will soon be looking to upgrade the RN and Detox shouldn't be the one to bottleneck them.

merunga commented 6 years ago

Hi guys, I've trying to get detox to work with RN 0.56 with android and jest in Linux, with no luck.

detox test fails with RN 0.56 in Linux with this message:

Plugin 0 specified in "/.../node_modules/babel-preset-react-native/index.js" provided an invalid property of "default" (While processing preset: "/.../node_modules/babel-preset-react-native/index.js")

You can check this issue that I think is related.

Here's a fork of the solution proposed in that issue, but with detox already configured. yarn test works but detox test throws the Plugin 0 specified in... message.

Is this setup supposed to work? Suggestions?

avigoldstein commented 6 years ago

I'm experiencing the same issue as @merunga on RN 0.56 with iOS simulator and babel-jest on macOS. My detox builds succeed but I am unable to run tests.

After reading through these two related issues: https://github.com/facebook/react-native/issues/19859 https://github.com/facebook/react-native/issues/18962

I think the reason for the issue is that react native 0.56 requires Babel 7 (meaning it also requires babel-preset-react-native of version 5.0.1 or later), but detox still uses Babel 6 (and therefore babel-preset-react-native v4.0.0). I've tried using peer dependencies but those were also unsuccessful.

merunga commented 6 years ago

@avigoldstein I'm running my unit test with jest, but ended up using mocha to run e2e tests with detox.

noomorph commented 6 years ago

@merunga thanks for the report and the fork. I cannot promise I'll look really soon, there's another important thing on the agenda (https://github.com/wix/detox/issues/831). As soon as I release a fix for it, I'll try to look at it.

lapto commented 6 years ago

@avigoldstein Running Detox on iOS with jest and RN 0.56.0 works for me after : Adding "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js" in the jest config file for running detox. And making sure that the project "react-test-render" version is the same as the one used by react-native ( for RN 0.56.0 -> 16.4.1).

merunga commented 6 years ago

@lapto thanks for your hint!

@noomorph I managed to get detox with jest running using this e2e/config.json file:

{
  "rootDir": "../",
  "setupTestFrameworkScriptFile": "./e2e/init.js",
  "preset": "react-native",
  "transform": {
    "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
  }
}

and this conf in package.json

{
  ...
  "detox": {
    "test-runner": "jest",
    "runner-config": "e2e/config.json",
    "configurations": {
      "android.emu.debug": {
       ...
      }
    }
  }
  ...
}

It's updated in the fork.

YoshiYo commented 6 years ago

@lapto @merunga Thanks you, it works with yours solutions ! The problem is fixed for me with all this configuration :

react-native init project
cd project
npm install detox --save-dev
detox init -r jest

And follow the next changes in :

in package.json

"jest": {
    "preset": "react-native",
    "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
  },

and

"detox": {
    "test-runner": "jest",
    "runner-config": "e2e/config.json",
    "configurations": {
      "ios.sim.debug": ...
    }
  }

in e2e/config.json

{
    "rootDir": "../",
    "setupTestFrameworkScriptFile": "./e2e/init.js",
    "preset": "react-native",
    "transform": {
      "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
    }
}

Don't forget to add you own simulator with the official doc.

I hope it will help some of you 🛠😇 I will follow the fork.

Salakar commented 6 years ago

Am running detox 8.1.1 here on RN 0.56.0 with mocha - all working apart from one thing, which seems to be related to detox (works fine in another app on same RN versions and packages except without detox);

Issue

Calling reload when running debug build variant causes an app crash on Android - crashes on reload through dev menu or programmatically via reloadReactNative.

image

Rough guess is it looks like it's trying to handle a native exception and log it - but the exception is null which causes the StringBuilder crash.

Full Log

08-06 04:58:27.453 23237-23357/com.testing D/SoLoader: Loaded: libyoga.so
08-06 04:58:27.453 23237-23358/com.testing I/DetoxManager: DetoxServerUrl : ws://10.0.2.2:65289
    DetoxSessionId : 901b54e4-2309-15cd-d677-73a08aad83d1
08-06 04:58:27.458 23237-23237/com.testing D/Detox: Got reactContext directly
08-06 04:58:27.459 23237-23358/com.testing I/Detox: Removing Espresso IdlingResources for React Native.
08-06 04:58:27.460 23237-23358/com.testing I/Detox: Setting up Espresso Idling Resources for React Native.
08-06 04:58:30.266 23237-23237/com.testing I/Detox: mqt_js looper is busy
08-06 04:58:30.267 23237-23237/com.testing E/unknown:ReactNative: Got DOWN touch before receiving UP or CANCEL from last gesture
08-06 04:58:30.268 23237-23237/com.testing I/Choreographer: Skipped 165 frames!  The application may be doing too much work on its main thread.
08-06 04:58:30.292 23237-23357/com.testing I/WebViewFactory: Loading com.android.chrome version 61.0.3163.98 (code 316409812)
08-06 04:58:30.315 23237-23357/com.testing I/zygote: The ClassLoaderContext is a special shared library.
08-06 04:58:30.357 23237-23357/com.testing I/cr_LibraryLoader: Time to load native libraries: 6 ms (timestamps 4308-4314)
08-06 04:58:30.387 23237-23357/com.testing I/chromium: [INFO:library_loader_hooks.cc(136)] Chromium logging enabled: level = 0, default verbosity = 0
08-06 04:58:30.387 23237-23340/com.testing D/EGL_emulation: eglMakeCurrent: 0x9fa86380: ver 3 0 (tinfo 0x9fa83e90)
08-06 04:58:30.387 23237-23357/com.testing I/cr_LibraryLoader: Expected native library version number "61.0.3163.98", actual native library version number "61.0.3163.98"
08-06 04:58:30.411 23237-23242/com.testing I/zygote: Do full code cache collection, code=121KB, data=108KB
08-06 04:58:30.412 23237-23242/com.testing I/zygote: After code cache collection, code=113KB, data=79KB
08-06 04:58:30.445 23237-23340/com.testing D/EGL_emulation: eglMakeCurrent: 0x9fa86380: ver 3 0 (tinfo 0x9fa83e90)
08-06 04:58:30.461 23237-23340/com.testing D/EGL_emulation: eglMakeCurrent: 0x9fa86380: ver 3 0 (tinfo 0x9fa83e90)
08-06 04:58:31.202 23237-23242/com.testing I/zygote: Do partial code cache collection, code=118KB, data=68KB
    After code cache collection, code=118KB, data=68KB
    Increasing code cache capacity to 512KB
08-06 04:58:31.374 23237-23358/com.testing I/WebSocketClient: At connectToServer
08-06 04:58:31.379 23237-23366/com.testing I/WebSocketClient: At onOpen
    At sendAction
08-06 04:58:31.380 23237-23366/com.testing D/WebSocketClient: Detox Action Sent: login
08-06 04:58:31.380 23237-23366/com.testing I/WebSocketClient: At sendAction
08-06 04:58:31.380 23237-23366/com.testing D/WebSocketClient: Detox Action Sent: ready
08-06 04:58:31.383 23237-23366/com.testing I/WebSocketClient: At onMessage
    At receiveAction
08-06 04:58:31.383 23237-23366/com.testing D/WebSocketClient: Detox Action Received: loginSuccess
08-06 04:58:31.383 23237-23366/com.testing I/DetoxManager: onAction: type: loginSuccess params: {"role":"testee","sessionId":"901b54e4-2309-15cd-d677-73a08aad83d1"}
08-06 04:58:31.397 23237-23369/com.testing I/zygote: The ClassLoaderContext is a special shared library.
    The ClassLoaderContext is a special shared library.
08-06 04:58:31.405 23237-23369/com.testing W/linker: "/data/app/com.google.android.gms-snSwP40RH-ElA87AWEUTyw==/base.apk!/lib/x86/libconscrypt_gmscore_jni.so" unused DT entry: type 0xf arg 0x119
08-06 04:58:31.407 23237-23369/com.testing V/NativeCrypto: Registering com/google/android/gms/org/conscrypt/NativeCrypto's 283 native methods...
08-06 04:58:31.425 23237-23369/com.testing I/ProviderInstaller: Installed default security provider GmsCore_OpenSSL
08-06 04:58:31.427 23237-23357/com.testing D/RNFirebaseFunctions: function:call:input:runTest:{}
08-06 04:58:32.191 23237-23265/com.testing V/FA: Inactivity, disconnecting from the service
08-06 04:58:32.327 23237-23237/com.testing D/ReactNative: ReactInstanceManager.onReloadWithJSDebugger()
08-06 04:58:32.328 23237-23237/com.testing D/ReactNative: ReactInstanceManager.recreateReactContextInBackground()
    ReactInstanceManager.runCreateReactContextOnNewThread()
    ReactInstanceManager.tearDownReactContext()
08-06 04:58:32.331 23237-23237/com.testing D/ReactNative: CatalystInstanceImpl.destroy() start
08-06 04:58:32.331 23237-23237/com.testing W/unknown:ReactNative: Packager connection already open, nooping.
08-06 04:58:32.333 23237-23357/com.testing E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
    Process: com.testing, PID: 23237
    java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
        at java.lang.StringBuilder.<init>(StringBuilder.java:113)
        at com.facebook.react.devsupport.DevSupportManagerImpl$JSExceptionLogger.log(DevSupportManagerImpl.java:291)
        at com.facebook.react.devsupport.DevSupportManagerImpl.handleException(DevSupportManagerImpl.java:275)
        at com.facebook.react.bridge.CatalystInstanceImpl.onNativeException(CatalystInstanceImpl.java:525)
        at com.facebook.react.bridge.CatalystInstanceImpl.access$1000(CatalystInstanceImpl.java:39)
        at com.facebook.react.bridge.CatalystInstanceImpl$NativeExceptionHandler.handleException(CatalystInstanceImpl.java:541)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
        at android.os.Looper.loop(Looper.java:164)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
        at java.lang.Thread.run(Thread.java:764)
08-06 04:58:32.344 23237-23340/com.testing D/EGL_emulation: eglMakeCurrent: 0x9fa86380: ver 3 0 (tinfo 0x9fa83e90)
08-06 04:58:32.355 23237-23383/com.testing D/ReactNative: ReactInstanceManager.createReactContext()
08-06 04:58:32.356 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupViewManager
08-06 04:58:32.357 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupShadowNode
    Could not find generated setter for class com.facebook.react.views.art.ARTShapeViewManager
    Could not find generated setter for class com.facebook.react.views.art.ARTShapeShadowNode
08-06 04:58:32.358 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTTextViewManager
    Could not find generated setter for class com.facebook.react.views.art.ARTTextShadowNode
    Could not find generated setter for class com.facebook.react.views.checkbox.ReactCheckBoxManager
08-06 04:58:32.359 23237-23237/com.testing W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.
08-06 04:58:32.360 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
08-06 04:58:32.363 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDialogPickerManager
08-06 04:58:32.364 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
08-06 04:58:32.365 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDropdownPickerManager
08-06 04:58:32.366 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
08-06 04:58:32.368 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager
    Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
08-06 04:58:32.369 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
08-06 04:58:32.369 23237-23340/com.testing D/EGL_emulation: eglMakeCurrent: 0x9fa86380: ver 3 0 (tinfo 0x9fa83e90)
08-06 04:58:32.369 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
08-06 04:58:32.372 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager
08-06 04:58:32.373 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager$ReactSliderShadowNode
08-06 04:58:32.374 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
    Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
08-06 04:58:32.375 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.toolbar.ReactToolbarManager
08-06 04:58:32.376 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.webview.ReactWebViewManager
08-06 04:58:32.377 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
08-06 04:58:32.378 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewManager
    Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewShadowNode
08-06 04:58:32.379 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
08-06 04:58:32.380 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode
08-06 04:58:32.381 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
08-06 04:58:32.385 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
08-06 04:58:32.386 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode
08-06 04:58:32.387 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
    Could not find generated setter for class com.facebook.react.views.text.ReactRawTextShadowNode
08-06 04:58:32.388 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
08-06 04:58:32.397 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode
08-06 04:58:32.399 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
08-06 04:58:32.401 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode
08-06 04:58:32.402 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
08-06 04:58:32.404 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.viewpager.ReactViewPagerManager
    Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
08-06 04:58:32.406 23237-23383/com.testing W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextShadowNode
    Could not find generated setter for class io.invertase.firebase.admob.RNFirebaseAdMobBanner
    Could not find generated setter for class io.invertase.firebase.admob.RNFirebaseAdMobNativeExpress
08-06 04:58:32.409 23237-23383/com.testing D/RNFirebaseAdMob: New instance
08-06 04:58:32.409 23237-23383/com.testing D/RNFirebaseAnalytics: New instance
08-06 04:58:32.409 23237-23383/com.testing D/RNFirebaseAuth: RNFirebaseAuth:initialized
08-06 04:58:32.409 23237-23383/com.testing D/RNFirebaseRemoteConfig: New instance
08-06 04:58:32.409 23237-23383/com.testing D/RNFirebaseCrashlytics: New instance
08-06 04:58:32.409 23237-23383/com.testing D/RNFirebaseFunctions: New instance
08-06 04:58:32.409 23237-23383/com.testing D/RNFirebaseInstanceId: New instance
08-06 04:58:32.410 23237-23383/com.testing D/RNFirebasePerformance: New instance
08-06 04:58:32.410 23237-23383/com.testing D/RNFirebaseStorage: New instance
08-06 04:58:32.410 23237-23383/com.testing D/ReactNative: Initializing React Xplat Bridge.
08-06 04:58:32.413 23237-23383/com.testing D/ReactNative: Initializing React Xplat Bridge before initializeBridge
08-06 04:58:32.416 23237-23383/com.testing D/ReactNative: Initializing React Xplat Bridge after initializeBridge
    CatalystInstanceImpl.runJSBundle()
08-06 04:58:32.418 23237-23399/com.testing D/ReactNative: ReactInstanceManager.setupReactContext()
    CatalystInstanceImpl.initialize()
08-06 04:58:32.420 23237-23237/com.testing W/unknown:ReactNative: Packager connection already open, nooping.
08-06 04:58:32.421 23237-23399/com.testing D/ReactNative: ReactInstanceManager.attachRootViewToInstance()
08-06 04:58:32.538 23237-23265/com.testing D/FA: Event not sent since app measurement is disabled
08-06 04:58:32.556 23237-23266/com.testing W/CrashlyticsCore: Cannot send reports. Settings are unavailable.
08-06 04:58:32.557 23237-23357/com.testing I/Process: Sending signal. PID: 23237 SIG: 9
kevinresol commented 6 years ago

With RN 0.56 on Android it is stuck at the empty screen before RN renders anything. Seems like there some infinite loop going on because I can't even properly kill it (it seems to stay running, unkillable)

MJ0826 commented 6 years ago

Hi, I am not able to run the test on iOS, with RN 56 and jest, it hangs and gets timed out every time, below is the configuration I am using -

In pacjage.json

"detox": { "test-runner": "jest", "runner-config": "e2e/config.json", "specs": "e2e", "configurations": { "ios.sim.debug": { "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/ExampleApp.app", "build": "xcodebuild -workspace ios/ExampleApp.xcworkspace -scheme ExampleApp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build", "type": "ios.simulator", "name": "iPhone 7" } } }

and In config.json

{ "rootDir": "../", "setupTestFrameworkScriptFile": "./e2e/init.js", "testEnvironment": "node", "preset": "react-native", "transform": { "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js" } }

I am not able to find out the actual cause behind this, can someone please help ?

Thanks

kfroemming-cb commented 6 years ago

@MJ0826 I am seeing something similar, can you provide logs with detox test --debug-synchronization 1000. This way we can look and see if we are having a similar issue. Mine is particular to when Detox runs with Jest, and an individual file such as Filename.spec.js has more than 1 describe or it block. Try running a test with just 1 describe that contains an it. Maybe we are seeing the same thing.

noomorph commented 6 years ago

Please update the version of Detox to 9 to continue this discussion being relevant. The 9 officially supports RN 0.56 on Android, so the bug reports must be specific to the latest version. Thanks in advance.

tannera commented 6 years ago

Any news on 0.57.3 support?

LeoNatan commented 6 years ago

@tannera Android or iOS? Are you seeing something specific which doesn't work?

tannera commented 6 years ago

@LeoNatan No, I just read the Docs that specify support up to <=0.56

LeoNatan commented 6 years ago

Please test your project, and open a new issue if there is a problem.

LeoNatan commented 6 years ago

I am closing this issue as to prevent further confusion.