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
Original issue reported on code.google.com by
K76...@gmail.com
on 15 Jan 2014 at 8:56