stepstone-tech / android-material-stepper

This library allows to use Material steppers inside Android applications.
Apache License 2.0
1.78k stars 261 forks source link

Instrumentation tests for API 24 and lower stucking on clickNext() and failing with timeout #241

Closed jluiz20 closed 6 years ago

jluiz20 commented 6 years ago

Hi.

First of all, congratulations on the great library.

I am running the following test:

@Test public void test_step02_onNext() { //given activityRule.getActivity().runOnUiThread(() -> { viewArgumentCaptor = ArgumentCaptor.forClass(TurnVehicleOnContract.View.class); verify(presenter).onViewResume(viewArgumentCaptor.capture()); }); //when onView(withId(R.id.stepperLayout)).perform(clickTabAtPosition(1)); onView(withId(R.id.stepperLayout)).perform(clickNext()); //then checkCurrentStepIs(2); clearInvocations(presenter); }

It runs ok on API level 25 but when I run on 24 or lower it fails. I have debugged and it stucks on the line of clickNext() action. onView(withId(R.id.stepperLayout)).perform(clickNext()); .

Visually it goes to the next step but for some reason in the code it does not proceed to the next line of code.

This is the version I am using implementation 'com.stepstone.stepper:material-stepper:4.3.1' androidTestImplementation('com.stepstone.stepper:espresso-material-stepper:4.3.1', { exclude group: 'com.android.support.test.espresso' })

Here is the log for reference `android.support.test.espresso.AppNotIdleException: Looped for 3586 iterations over 60 SECONDS. The following Idle Conditions failed .

at dalvik.system.VMStack.getThreadStackTrace(Native Method) at java.lang.Thread.getStackTrace(Thread.java:1566) at android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:90) at android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:52) at android.support.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:312) at android.support.test.espresso.ViewInteraction.desugaredPerform(ViewInteraction.java:167) at android.support.test.espresso.ViewInteraction.perform(ViewInteraction.java:110) at br.com.dreamteam.androidobdreader.presentation.connection.fragments.st02TurnVehicleOn.TurnVehicleOnFragmentTest.test_step02_onNext(TurnVehicleOnFragmentTest.java:116) at java.lang.reflect.Method.invoke(Native Method) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at android.support.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80) at org.mockito.internal.junit.JUnitRule$1.evaluateSafely(JUnitRule.java:63) at org.mockito.internal.junit.JUnitRule$1.evaluate(JUnitRule.java:43) at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932) `

zawadz88 commented 6 years ago

Hi @jluiz20, It's hard to determine by just looking at the stack trace and without seeing the rest of your code :( Are you able to reproduce the same behavior in the sample app from this library? Also, are the animations disabled on both devices?

jluiz20 commented 6 years ago

I found the problem.

Even with the animations disabled on the emulator there was one indeterminate ProgressBar on the step that was opening that was messing with everything. So, my bad.

Sorry for bothering you. You may close the issue. Congrats for the library, Cheers!

zawadz88 commented 6 years ago

I'm very happy someone is using espresso-material-stepper as I wasn't sure whether it's worth the effort to expose it as a public module. Glad I did :)