-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Running tests on Android gets stuck in the "before all" hook #395
Comments
@simonracz can you please elaborate on your comment |
Which of the PIDs in the device log is your app ? is it |
@rotemmiz thanks for the comment! Following the tries - I tried to make it work with an android release apk:
The logs from the running
and in the adb logcat I still get some errors (some are from a 3rd party library we're using - pushwoosh - which might use hybrid):
And after a while the app crashes.... |
Does it work without Detox, in release or in debug ? This log doesn't seem to include any traces of Detox code in it. You attached a log with multiple crashes, most notable one is from pushwoosh's stack
not sure what's going on there. The screenshot shows an app that its main thread is too busy to respond to user interactions (called ANR). This is not a crash... |
Both of the APK work correctly in the emulator when I just copy paste it there. Regarding the logs - I copied only the error lines from the log - there are a few hundreds of lines there (including detox..). |
Hey @ilonashub , Please run the following command, while the target simulator is booted up, and share it's output with me:
Please also share the output of:
Also, please share the whole Thanks, |
Hey @simonracz, sorry for the delay... here are the outputs:
|
Hey @ilonashub , I went through the logs. The instrumentation is built and started correctly. I see that detox starts normally. The issue is always an ANR in Pushwoosh :
I see other Pushwoosh related errors in the log, but if as you said, the app works without detox, then they might conflict with each other somehow. I have no idea yet how. My last idea is, could you please take a look at this? And run the test with the following command:
Thanks, |
Thanks for the quick response! When I ran The output for
and after a few minutes I start to see mocha's timeouts... |
Any progress here? I have exactly the same problem. |
Hey @KubaGL , could you please attach a complete log too? |
Sorry but I switched to other tool, so I don't have a code with detox anymore. |
Any updates on this? I have the same issue. |
Same issue, and here is the adb logcat: |
I had similar issue when running it on Android Device. Turns out I had to manually run @Milesyan based on your logs, I guess you might have same issue. I can create PR that would always run |
In my case problem was in |
@skv-headless thanks! It is just the case. I removed the import of react-native-device-info and everything works fine! |
@skv-headless I've pinpointed the problem of constants.put("userAgent", WebSettings.getDefaultUserAgent(this.reactContext)); This line make detox hang forever. If I comment it out, the detox test runs fine. |
Does the app crash? |
Here's the complete logcat output: https://pastebin.com/LGK4zhYC @blumendorf made a repository to reproduce this problem: I'm running detox this way:
and it runs fine unless |
I can confirm @machour's findings, I have the same issue and the culprit is the |
I too am blocked on the same issue. Introducing |
It took me a day to come to the same conclusion, but yea - it's RNDeviceInfo. The second I remove it from mainApplication.java and the tests start on android. doing @machour's change also fixes the issue. Is this something that detox can go around or should we look for ways to fix this in RNDEviceInfo? I don't see anything out of the ordinary that deviceInfo does. https://developer.android.com/reference/android/webkit/WebSettings |
Any update on this as @ilonashub . i am getting the same behaviour here. the app launches but gets stuck and no tests are performed. Everything works fine when i use the emulator. btw i already did
The log that is displayed by
|
My problem also is due to I temporary fix it by stubbing @Test
public void runDetoxTests() throws InterruptedException {
Context reactContext = InstrumentationRegistry.getTargetContext().getApplicationContext();
WebSettings webSettings = spy(WebSettings.class);
doReturn("getDefaultUserAgentMock").when(webSettings).getDefaultUserAgent(reactContext);
Detox.runTests(mActivityRule);
} |
I am currently experiencing the exact issue @krazykira is facing. Any update on this? |
@ghsdh3409 's answer fixed it for me. I had to put: These are imports: import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.webkit.WebSettings;
import static org.mockito.Mockito.*; And at the end, I have put @ghsdh3409 's code in (For those lazy like me, so that you don't have to look for your correct imports yourself :) ) |
thanks @ghsdh3409 @kormang - tests are finally launching on android! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
The issue has been closed for inactivity. |
Description
hey, I am having an issue with running detox on Android. We got it working in iOS and now wanted to add Android tests as well.
We use RN 0.49.
When I run detox on Android - I get a white screen, and in the console I get stuck in the "before all" hook:
Steps to Reproduce
After following all the steps in the Android guide (and fixing some versions issues, and fixes from the troubleshooting), I tried to run the text:
detox test --configuration android.emu.debug -l verbose
, and got the following logs:Detox, Node, Device, Xcode and macOS Versions
Device and verbose Detox logs
from the adb logcat I could see a few errors - which I think are unrelated to the issue (for example pushwoosh error shouldn't prevent the app to be up I think. So I added some of the logs with warnings/errors here.
The text was updated successfully, but these errors were encountered: