Espresso Tests Hangs after fragment replace called

840 views Asked by At

Espresso tests hangs in infinite loop and never ends and no error.... Navigated from fragment to fragment without any animation. Espresso not able to identify any views in the current fragment and hangs on...

found below logs whenever fragment launched and visible to user.

W/View: requestLayout() improperly called by my.app.packege.CustomTextView and D/OpenGLRenderer: DisplayEventReceiver 0xb89c2080 requestNextVsync D/OpenGLRenderer: DisplayEventReceiver 0xb89c2080 latestVsyncEvent 20573087565730.... logging infinitely in the same screen opened.

if activity (contains the fragment) launched using Activity rule, getting below exception.Tried almost all stackoverflow solutions for below exception, but not succeeded.

`java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=my.app.package.OnBoardingActivity } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1501794260664 and now the last time the queue went idle was: 1501794260664. If these numbers are the same your activity might be hogging the event queue.

Anybody faced issue like this? Let me know your suggestions.

Thanks

1

There are 1 answers

1
PK Gupta On

Please enable "Show surface updates" in developer option. Check the flow manually and see if screen flashes continuously at any point. Looks like there is a problem in CuatomView which is invalidating and requesting layout continuously. Please see if you can use IdlingResource, ConditionWatcher or normal thread sleep on main thread to get over this problem.