Open GoogleCodeExporter opened 9 years ago
I see this intermittently as well. It takes away some of the reliability of the
tests, unfortunately. The best I've come up with was to create a custom
ViewAction as the rollback that what does is basically wait for
android.R.integer.config_longAnimTime. Although this makes the problem go away
I don't really want to do this kind of hacking.
Original comment by GoncaloS...@gmail.com
on 7 Mar 2014 at 4:33
Please, fix the issue. My tests fail randomly
Original comment by Ryabov.G...@gmail.com
on 23 Jul 2014 at 3:00
Yup I am experiencing this problem as well. I have a case that I can reproduce
100% of the time using the Nexus 4 or Samsung Nexus
Create a share intent and then try and perform a click on the dialog that is
shown. The long click is performed and so this opens up the settings page for
that particular app. This line has the problem
onView(withText("Gmail")).perform(click());
Original comment by s...@waymate.de
on 19 Sep 2014 at 2:22
[deleted comment]
Can you try using the click method which accepts a RollBack action incase it
turns into a longClick?
onView(withText("Gmail")).perform(click(Espresso.pressBack()));
-----From ViewActions.java -----
/**
* Returns an action that performs a single click on the view.
*
* If the click takes longer than the 'long press' duration (which is possible) the provided
* rollback action is invoked on the view and a click is attempted again.
*
* This is only necessary if the view being clicked on has some different behaviour for long press
* versus a normal tap.
*
* For example - if a long press on a particular view element opens a popup menu -
* ViewActions.pressBack() may be an acceptable rollback action.
*
* <br>
* View constraints:
* <ul>
* <li>must be displayed on screen</li>
* <li>any constraints of the rollbackAction</li>
* <ul>
*/
public static ViewAction click(ViewAction rollbackAction) {
checkNotNull(rollbackAction);
return new GeneralClickAction(Tap.SINGLE, GeneralLocation.CENTER, Press.FINGER,
rollbackAction);
}
Original comment by yashodha...@gmail.com
on 19 Sep 2014 at 2:29
We've been using doubleClick instead of click when Espresso decides to
longPress. It's a good way to get a faster click to avoid triggering a
longPress. However, if your app is already using double click actions, this may
not be a good solution.
Original comment by james.pu...@mindbodyonline.com
on 5 May 2015 at 4:29
I think the click action that takes a rollback action is probably the best
solution most of the time, but it might not be enough for all scenarios. I
wrote a custom view action for scenarios where a rollback action didn't resolve
my problems. It's definitely not the "Espresso" way, but flaky tests need to
be resolved and this has worked for me:
https://gist.github.com/jabKnowsNothing/fe34673419500dcc6fc9.
Original comment by jabKnows...@gmail.com
on 19 May 2015 at 9:11
Hi guys,
I've got the same problem. I try to perform click() and I got this error in
logcat:
08-21 18:27:13.700 558-558/com.touchpo.android I/ViewInteraction﹕
Performing 'single click' action on view with string from resource id:
<2131165452>[introContinue] value: Continue
08-21 18:27:13.730 558-558/com.touchpo.android D/LifecycleMonitor﹕
Lifecycle status change: com.touchpo.android.Activities.IntroActivity@40e72aa8
in: PAUSED
08-21 18:27:13.730 558-598/com.touchpo.android I/TestRunner﹕ failed:
activationTest(com.touchpo.android.Activities.IntroActivityTest)
08-21 18:27:13.730 558-598/com.touchpo.android I/TestRunner﹕ ----- begin
exception -----
08-21 18:27:13.750 558-598/com.touchpo.android I/TestRunner﹕
android.support.test.espresso.PerformException: Error performing 'single click'
on view 'with string from resource id: <2131165452>[introContinue] value:
Continue'.
at android.support.test.espresso.PerformException$Builder.build(PerformException.java:83)
at android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:70)
at android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:53)
at android.support.test.espresso.ViewInteraction.runSynchronouslyOnUiThread(ViewInteraction.java:184)
at android.support.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:115)
at android.support.test.espresso.ViewInteraction.perform(ViewInteraction.java:87)
at com.touchpo.android.Activities.IntroActivityTest.activationTest(IntroActivityTest.java:49)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
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.statement.UiThreadStatement.evaluate(UiThreadStatement.java:55)
at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:257)
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:54)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:228)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1661)
Caused by: android.support.test.espresso.PerformException: Error performing 'Send down montion event' on view 'unknown'.
at android.support.test.espresso.PerformException$Builder.build(PerformException.java:83)
at android.support.test.espresso.action.MotionEvents.sendDown(MotionEvents.java:104)
at android.support.test.espresso.action.Tap.sendSingleTap(Tap.java:133)
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(GeneralClickAction.java:98)
at android.support.test.espresso.ViewInteraction$1.run(ViewInteraction.java:144)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.Activi
08-21 18:27:13.750 558-598/com.touchpo.android I/TestRunner﹕ ----- end
exception -----
08-21 18:27:13.770 558-598/com.touchpo.android I/TestRunner﹕ finished:
activationTest(com.touchpo.android.Activities.IntroActivityTest)
08-21 18:27:13.780 558-558/com.touchpo.android
I/MonitoringInstrumentation﹕ Activities that are still in CREATED to STOPPED:
1
Original comment by martin.k...@dotykacka.cz
on 21 Aug 2015 at 4:30
Original issue reported on code.google.com by
K76...@gmail.com
on 15 Jan 2014 at 8:56