Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detox Android incompatible with RN >= 50 #608

Closed
guyca opened this issue Mar 6, 2018 · 24 comments
Closed

Detox Android incompatible with RN >= 50 #608

guyca opened this issue Mar 6, 2018 · 24 comments

Comments

@guyca
Copy link

guyca commented Mar 6, 2018

Detox idling resources are not compatible with changes made in RN 50:

onMessage: {"messageId":3,"type":"error","params":{"error":"Wait for [com.wix.detox.espresso.ReactNativeUIModuleIdlingResource] to become idle timed out"}}

Encountered this while testing uses cases in RNN involving reload (By pressing R R)

@rotemmiz
Copy link
Member

rotemmiz commented Mar 12, 2018

Detox Android idling resources are not compatible with changes made in RN 50, we are working on finding a solution for that. In the meantime, Detox Android does not support RN >=50 !

@rotemmiz rotemmiz changed the title ReactNativeUIModuleIdlingResource incompatible with RN >= 51 Detox Android incompatible with RN >= 51 Mar 12, 2018
@aricgemco
Copy link

Just to confirm.

  • Detox for Android is not compatible with RN>=51

  • react-native-navigation is only compatible with RN>=51

So currently we cannot use RNN and Detox for Android?

@ksmahesh
Copy link

Hey @guyca @rotemmiz
I was using detox for react native 50.3 and it worked really well. So thanks!

I do have some questions regarding whats mentioned here on this issue:

  1. When support is added for RN >=51 will it support RN 54? Or is the support added only to 51?
  2. Is there any ETA on when this support for higher version will be available? Even if its a alpha/beta release?

@rotemmiz rotemmiz changed the title Detox Android incompatible with RN >= 51 Detox Android incompatible with RN >= 50 Mar 18, 2018
@rotemmiz
Copy link
Member

rotemmiz commented Mar 18, 2018

I went over 0.49-stable - 0.50-stable diff, and found a few possible culprits.

Implement lazy discovery for ViewManagers.
facebook/react-native@da30b04

Move destroy threads in catalystinstance off the UI thread
facebook/react-native@cf2ef84
(Espresso syncs with AsyncTasks by default)

@simonracz
Copy link
Contributor

FYI, I can work on this full time from Tuesday.

@ericketts
Copy link

ericketts commented Mar 19, 2018

I seem to be experiencing 2 separate issues on my app using RN 0.54.2 (and react-native-navigation 1.1.0), where neither are the issue from the OP (I can make this a different ticket if that's more helpful):

  • The app installs, the isReady event fires, and the app never responds with a ready event, leading to the detox client hanging
  • The app installs, isReady fires, ready fires, but the view hierarchy doesn't load correctly before the tests run, leading to erroneously failed tests with a No views in the hirarchy found matching.

If those two issues are avoided, the tests run and pass without a hitch (and the iOS side of things works perfectly).

Edit: In the first failure case, I see ReactNativeSupport failing to get the reactContext after a minute of waiting.

@simonracz
Copy link
Contributor

@ericketts Thanks for your comment. I also suspect we accumulated more than one issue.

@jmikulka
Copy link

jmikulka commented Apr 3, 2018

Hi @simonracz, any updates or ETA on this one?

@rotemmiz
Copy link
Member

rotemmiz commented Apr 3, 2018

#652 Fixes the sync issues in the test project for RN50 and RN51. It will be released ASAP after review+merge.
This is not a bullet proof solution as we still struggle with synchronization of react native initialization, but it should be good enough for now.

@jmikulka
Copy link

jmikulka commented Apr 4, 2018

@rotemmiz great news, thanks a lot!

@henrikra
Copy link
Contributor

henrikra commented Apr 12, 2018

I am using these dependencies:
React Native 0.52.2
react-native-navigation 1.1.377
Detox 7.3.3

I am experiencing same kind of stuff that Detox just hangs on real Android device. And in the end Jest just timeouts.

Can you guys see from the logs what is the problem? Is the problem React Native 0.52.2?

detox verb ws onOpen [object Object]
detox verb ws send: {"type":"login","params":{"sessionId":"test","role":"tester"},"messageId":0}
detox verb ws onMessage: {"type":"loginSuccess","params":{"sessionId":"test","role":"tester"},"messageId":0}
detox verb ws  
detox verb 1: /root/android-sdk-linux/platform-tools/adb  devices 
detox verb 1: stdout: List of devices attached
detox verb 1: stdout: 079d54280337db7a	device
detox verb 1: stdout: 
detox verb 1: stdout: 
detox verb 2: /root/android-sdk-linux/platform-tools/adb -s 079d54280337db7a shell input keyevent 82 
detox verb 3: /root/android-sdk-linux/platform-tools/adb -s 079d54280337db7a uninstall com.myApp.ride.dev 
detox verb 3: stdout: Failure [DELETE_FAILED_INTERNAL_ERROR]
detox verb 3: stdout: 
detox verb 4: /root/android-sdk-linux/platform-tools/adb -s 079d54280337db7a uninstall com.myApp.ride.dev.test 
detox verb 4: stdout: Failure [DELETE_FAILED_INTERNAL_ERROR]
detox verb 4: stdout: 
detox verb 5: /root/android-sdk-linux/platform-tools/adb -s 079d54280337db7a shell getprop ro.build.version.sdk 
detox verb 5: stdout: 21
detox verb 5: stdout: 
detox verb 6: /root/android-sdk-linux/platform-tools/adb -s 079d54280337db7a install -rg /test/android/app/build/outputs/apk/myAppdevrelease/app-myAppdevrelease.apk 
detox verb 6: stdout: 	pkg: /data/local/tmp/app-myAppdevrelease.apk
detox verb 6: stdout: Success
detox verb 6: stdout: 
detox verb 6: stderr: 3765 KB/s (20729024 bytes in 5.375s)
detox verb 6: stderr: 
detox verb 7: /root/android-sdk-linux/platform-tools/adb -s 079d54280337db7a shell getprop ro.build.version.sdk 
detox verb 7: stdout: 21
detox verb 7: stdout: 
detox verb 8: /root/android-sdk-linux/platform-tools/adb -s 079d54280337db7a install -rg /test/android/app/build/outputs/apk/androidTest/myAppdevrelease/app-myAppdevrelease-androidTest.apk 
detox verb 8: stdout: 	pkg: /data/local/tmp/app-myAppdevrelease-androidTest.apk
detox verb 8: stdout: Success
detox verb 8: stdout: 
detox verb 8: stderr: 3606 KB/s (3040979 bytes in 0.823s)
detox verb 8: stderr: 
detox verb 9: /root/android-sdk-linux/platform-tools/adb -s 079d54280337db7a shell am force-stop com.myApp.ride.dev 
detox verb /root/android-sdk-linux/platform-tools/adb -s 079d54280337db7a shell am instrument -w -r -e detoxServer ws://localhost:8099 -e detoxSessionId test -e debug false com.myApp.ride.dev.test/android.support.test.runner.AndroidJUnitRunner 
detox verb Instrumentation spawned, childProcess.pid:  442
detox verb ws send: {"type":"isReady","params":{},"messageId":-1000}
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: numtests=1
detox verb Instrumentation stdout:  
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: stream=
detox verb Instrumentation stdout:  com.myApp.ride.DetoxTest:
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: test=runDetoxTests
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: class=com.myApp.ride.DetoxTest
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: current=1
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS_CODE: 1
detox verb Instrumentation stdout:  
FAIL e2e/Login.spec.js (240.954s)
  Login
    ✕ login (4ms)

  ● Login › login

    Timeout - Async callback was not invoked within the 240000ms timeout specified by jest.setTimeout.
      
      at ../node_modules/jest-jasmine2/build/queue_runner.js:68:21
      at Timeout.callback [as _onTimeout] (../node_modules/jsdom/lib/jsdom/browser/Window.js:628:19)

  ● Login › login

    ReferenceError: device is not defined

      1 | describe('Login', () => {
      2 |   beforeEach(async () => {
    > 3 |     await device.reloadReactNative();
      4 |   });
      5 | 
      6 |   it('login', async () => {
      
      at Object.beforeEach (Login.spec.js:3:5)

*** between just jest logging all tests which will fail ***

Test Suites: 1 failed, 1 total
Tests:       2 failed, 2 total
Snapshots:   0 total
Time:        241.491s
Ran all test suites matching /e2e/i with tests matching "^((?!:ios:).)*$".
detox verb instrumentationProcess terminated due to receipt of signal SIGTERM 
child_process.js:644
    throw err;
    ^

Error: Command failed: node_modules/.bin/jest e2e --config=e2e/config.json --runInBand --testNamePattern='^((?!:ios:).)*$'
    at checkExecSyncError (child_process.js:601:13)
    at Object.execSync (child_process.js:641:13)
    at runJest (/test/node_modules/detox/local-cli/detox-test.js:110:6)
    at run (/test/node_modules/detox/local-cli/detox-test.js:67:7)
    at Object.<anonymous> (/test/node_modules/detox/local-cli/detox-test.js:54:1)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
detox-server-log
detox-server info 17:17:43: server listening on localhost:8099...
detox-server wss 17:17:45: role=tester login (sessionId=test)
detox-server wss 17:17:45: role=tester action=loginSuccess (sessionId=test)
detox-server wss 17:18:14: role=tester action=isReady (sessionId=test)
detox-server wss 17:18:14: role=testee not connected, cannot fw action (sessionId=test)
detox-server wss 17:21:45: role=tester disconnect (sessionId=test)
Success
Success
Test has been run Thu Apr 12 17:21:48 UTC 2018, exit status: '1'
INFO: (jni/minicap/minicap.cpp:197) Received SIGTERM, stopping
INFO: (jni/minicap/minicap.cpp:516) Closing client connection
INFO: (external/MY_minicap/src/minicap_21.cpp:284) Destroying virtual display

@agent-0028
Copy link

Hey folks! Having great fun trying to get Detox to work with latest react-native on Android. (Caveat: I am NOT an Android dev, so new to the whole Gradle build eco-system)

My use case is very limited, so hoping that subtle bugs won't stop me from using detox.

However, currently can't even get things to compile after following a combination of the instructions below to add detox.

https://github.com/wix/detox/blob/master/docs/Introduction.Android.md
https://github.com/wix/detox/blob/master/docs/More.AndroidSupportStatus.md

React Native: 0.55.2
Detox: 7.3.3

What is the current status of things? Is there a chance of getting this running with latest react-native?

Other example projects I should look at?

If anyone actually cares to dig into this, my WIP spike code is here:
https://github.com/agent-0028/react-native-sandbox/tree/adding-detox-for-android

Most recent commit messages explain more...

@esusslin
Copy link

Hey folks! Having a little difficultly configuring this myself:

React Native: 0.54.2
Detox: 7.3.3

Has there been any progress with this compatibility? Any helpful workarounds?

@CapitanRedBeard
Copy link

@simonracz Any update on the state of this PR?

@KostasKostogloy
Copy link

What's the status of android e2e tests? I can see that you've disabled them for wix/detox on your travis config. Is it possible to run android e2e tests on travisCI at all now?

@rotemmiz
Copy link
Member

This comment states that it works now. There is an inherit issue in RN itself which won't let us sync with reloading in a full proof way. That's the reason the issue was not closed yet.

To avoid confusion I am now closing this issue since we already support RN50-51 on Android in Detox 7.3.3.

Disabled tests on TravisCI has nothing to do with this issue. Since Travis can't run x86 emulators, Detox suite still can't run on them. We are in the process of moving to our own CI solution, then we will enable the test suite. In the meantime, every release/Android contribution requires manual run of the test suite.

@henrikra
Copy link
Contributor

But React Native is already at 0.55 version and Detox doesn't support Rn 0.52 and up? 😢

@DVLNarayana
Copy link

@simonracz detox 7.3.4 is supporting RN 0.55.3 can you please update the status?

@lalka-workco
Copy link
Contributor

The documentation links to this ticket, and this ticket is closed but the issue is not fixed for RN >=52. Can we get a new ticket or re-open this one?

The documentation indicated it doesn't work with RN>=50 so that might need to be updated as well.

@markhu
Copy link

markhu commented Jun 4, 2018

The ChangeLog https://github.com/wix/detox/blob/master/CHANGELOG.md#734-2018-04-25 claims to have fixed this (#608) as of Wix Detox version 7.3.4 in April 2018.

@JeremyEllingham
Copy link

Having this problem as well, tried a bunch of different RN and Detox versions.

I can't get RN 0.55.3, 0.51.0 or 0.50.3 working with either Detox 7.3.4 or 7.4.0.

Could not find method minReactNative44Implementation() for arguments [com.squareup.okhttp3:okhttp:3.4.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Really want this to work as Detox looks like a great library and RN testing options are very lacking. Hopefully the community interest means this issue gets prioritised, thanks for all your work.

@simonracz
Copy link
Contributor

Hi @SicutDominus ,

Based on the gradle error message, I think you are still on old gradle version in your RN project. Detox 7.0> supports only gradle 3.0.
Please take a look here : https://github.com/wix/detox/blob/master/docs/Introduction.Android.md#setup

Hope this helps.

@markhu
Copy link

markhu commented Jun 25, 2018

Status as of June 2018:

  • Detox Android is stuck back at React Native v0.51, i.e. since December 2017.
  • Detox iOS works for React Native v0.55 (current as of June, 2018)

References:

@wix wix locked and limited conversation to collaborators Jul 23, 2018
@rotemmiz
Copy link
Member

The issue is closed and fixed, and the official doc re supported versions is here: https://github.com/wix/detox/blob/master/README.md#supported-react-native-versions

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests