-
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
Detox fails unless Android emulator is running prior to test execution - Exceeded timeout of 300000ms while handling jest-circus "setup" event #3342
Comments
@BrentWardOx happy to hear that setting up the first test went well!
Also, let's switch this to stack overflow. |
We use the issue tracker exclusively for bug reports and feature requests. This issue appears to be a general usage or support question. Instead, please ask a question on Stack Overflow with the Feel free to post your Stack Overflow question here for more visibility! We'll take a look at it. Refer to this discussion for more information about our policy on issues. |
@d4vidi Thanks for the suggestion! I ran the
^ This command launches the emulator in a background process, starts a while loop which waits for the emulator to be available, and then executes my tests once the emulator is ready. Works like a charm. I followed the Detox Setup Guide carefully and ran into this issue with a pretty basic React Native app, so there's a high chance someone else will run into this same issue. Posting the solution here. Hope this helps! |
That's okay but not ideal. Technically, it's better to have Detox manage your test device allocation. |
I am running into a similar issue, but only with a release build. In debug mode detox starts the emulator, pushes the build and all the tests pass. Similarly to the OP, if I start the emulator in advance, the app installs and the tests pass. |
Seems to be the case only with google play images. The issue is not reproducible with AOSP (API 28 for example). @BrentWardOx you don't mention the flavor of the android image in your issue, so in case you used googled images, give AOSP images a try. |
@dklymenk Thanks for the suggestion! I was using an emulator with Android API 32 (Google APIs), which was a Google Play Image. However, I created a new emulator using Android 12.0 (Android Open Source Project, API 31) and my results are the same: running My results are also the same whether I build for |
@BrentWardOx Give API28 a try. I found that anything above that has that issue. |
@dklymenk Yep, that works! Switching my Emulator to target AOSP API 28 works great. Thank you! |
Yep. AOSP images FTW. |
I'm encountering this issue as well using AOSP API 32. The detox init ends up timing out in the same scenario (app not launched prior to detox test), therefore the tests fail. Despite the workaround of launching the emulator manually, I'd suggest this to be re-evaluated as a potential bug (instead of a question), and the issue re-opened. |
There is definitely a bug here. Should not be closed. |
Yeah, I've been experiencing this very same error for months now,
At least once a day I get this error on CI running tests on a release build on iOS with two workers. I'm using detox 19.7.1 |
Getting the same error. API 32 and Detox 19.7.1 |
Same here, AOSP API 32 and Detox 19.8.4. |
I can confirm that downgrading to an AOSP API 28 emulator works as a temporary fix. |
Got the error with API 32 and Detox 19.7.1. Anything update? |
Noted. Let's follow-up on the discussion in the dedicated issue (#3560). |
@d4vidi It seems to be correlated with the
The following test fails with I would post this in the new thread you linked, but that seems dedicated to the issue as it pertains to Android API 32. This seems to be a concurrency issue/race condition that tends to only present in the very resource constrained environment like the virtual containers in CI. EDIT: |
@zacharyweidenbach Please have a look at #3518 |
That does not resemble the error that I'm seeing. I have also bumped detox to ^19.10.0, which should include Mike Hardy's fix, and the result is still the same. I actually suspect that in CI, Detox has trouble creating the other simulators and starting them. Jest-Circus cannot finish the setup because Detox can never complete the handshake with the new simulators in time. I'm going to try running |
Detox's ability to create a new simulator instance in CI before running the test seems to be the issue, or at least somewhere near the bullseye of the issue. The
This step reliably fails for all three tests with the timeout error:
If there is a more elegant way to preemptively create the simulator devices for the number of workers I intend to use (usually only 3 because github actions macOS containers run on boxes with only 3 cores), I can do that instead as a workaround until I find a better solution. |
@zacharyweidenbach Thanks for sharing those insights! We seem to have drifted far away from the issue's topic. Could you please report your CI logs (running with |
@capezzbr @MoOx @rikur @gabrieldonadel @zacharyweidenbach @ghitier @jd20 @dklymenk @BrentWardOx @sangliquidus I've released a fix for this issue in the latest detox version (20.0.3) - please try it and see if this issue is now solved for you |
What happened?
I followed the Detox setup guide for a simple React Native test app I am working on. I managed to setup an Android Emulator which is compatible with Detox, and my first test works great!
The only issue is that my Android Emulator must be running before I execute my
detox test
command. Otherwise, runningdetox test
launches my Android Emulator and hangs. The error message isExceeded timeout of 300000ms while handling jest-circus "setup" event
.What was the expected behaviour?
Running
detox test
for an Emulator config should:Was it tested on latest Detox?
Did your test throw out a timeout?
Help us reproduce this issue!
detox test
for the Android Emulator config while the Emulator is not activeIn what environment did this happen?
Detox version: 19.6.5
React Native version: 0.66.3
Node version: 16.13.0
Device model: Pixel 5 (emulator)
Android version: API 32
Test-runner: jest-circus
Detox logs
Detox logs
Device logs
Device logs
More data, please!
I've tried creating a number of Android Emulators on various devices and APIs to see if the issue persists. This issue persists on Android Emulators for each of the Pixel models (1-5) and for the last several APIs (28-32).
Also, adding
--retries 2
to the end of my test script does not alleviate the issue. The process still times out on the first attempt and hangs without retrying.The text was updated successfully, but these errors were encountered: