anistn / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

Test failing on Lollipop when performing a click on a view whose parent layout has an indeterminate progress bar #141

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Import the attached sample project
2. Ensure indeterminate is set to true on the ProgressBar in activity_main.xml
3. Run Application Test

What is the expected output? What do you see instead?
Expected output is the tests to pass. The .perform(click()) call hangs on 
Lollipop. It will eventually crash with the following stacktrace:
android.support.test.espresso.PerformException: Error performing 'single click' 
on view 'with id: com.example.espressobug:id/button'.
at 
android.support.test.espresso.PerformException$Builder.build(PerformException.ja
va:83)
at 
android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(De
faultFailureHandler.java:70)
at 
android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHa
ndler.java:53)
at 
android.support.test.espresso.ViewInteraction.runSynchronouslyOnUiThread(ViewInt
eraction.java:185)
at 
android.support.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:115
)
at 
android.support.test.espresso.ViewInteraction.perform(ViewInteraction.java:87)
at 
com.example.espressobug.ApplicationTest.testProgressBar(ApplicationTest.java:42)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java
:45)
at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:
15)
at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:4
2)
at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20
)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68
)
at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47
)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
at 
android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:2
70)
at 
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1837)
Caused by: android.support.test.espresso.AppNotIdleException: Looped for 3589 
iterations over 60 SECONDS. The following Idle Conditions failed .
at 
android.support.test.espresso.IdlingPolicy.handleTimeout(IdlingPolicy.java:61)
at 
android.support.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.j
ava:471)
at 
android.support.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.j
ava:402)
at 
android.support.test.espresso.base.UiControllerImpl.injectMotionEvent(UiControll
erImpl.java:226)
at 
android.support.test.espresso.action.MotionEvents.sendUp(MotionEvents.java:135)
at 
android.support.test.espresso.action.MotionEvents.sendUp(MotionEvents.java:118)
at android.support.test.espresso.action.Tap.sendSingleTap(Tap.java:135)
at android.support.test.espresso.action.Tap.access$100(Tap.java:35)
at android.support.test.espresso.action.Tap$1.sendTap(Tap.java:40)
at 
android.support.test.espresso.action.GeneralClickAction.perform(GeneralClickActi
on.java:98)
at android.support.test.espresso.ViewInteraction$1.run(ViewInteraction.java:144)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 

What version of the product are you using? On what operating system?
Test hangs on Nexus 4 running 5.0.1. Test passes on Galaxy Nexus running 4.3.

Please provide any additional information below.
Disabling the animations on the device has no impact. Nor does disabling them 
programatically. Setting indeterminate to false on the ProgressBar makes the 
tests succeed. 

Original issue reported on code.google.com by m...@smpete.com on 7 Apr 2015 at 8:05

GoogleCodeExporter commented 9 years ago
Attaching sample project

Original comment by m...@smpete.com on 7 Apr 2015 at 8:08

Attachments:

GoogleCodeExporter commented 9 years ago
That's more or less by design - Espresso attempts to synchronize with your app 
by making sure that there's nothing pending in the UI thread message queue 
(this condition usually means that UI is about to get updated and generally 
it's a good idea for the test to wait). If you have something that constantly 
keeps the UI thread busy (like this progress bar), Espresso will wait for it to 
stop and eventually time out.

If you can disabled the progress bar for testing, that would be the way to go.

Original comment by vale...@google.com on 9 Apr 2015 at 11:57