Comments (7)
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 [email protected]
on 7 Mar 2014 at 4:33
from android-test-kit.
Please, fix the issue. My tests fail randomly
Original comment by [email protected]
on 23 Jul 2014 at 3:00
from android-test-kit.
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 [email protected]
on 19 Sep 2014 at 2:22
from android-test-kit.
[deleted comment]
from android-test-kit.
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 [email protected]
on 19 Sep 2014 at 2:29
from android-test-kit.
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 [email protected]
on 5 May 2015 at 4:29
from android-test-kit.
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 [email protected]
on 19 May 2015 at 9:11
from android-test-kit.
Related Issues (20)
- Using onData with an overlaid View won't properly click on items
- Getting DexException when running assembleDebugAndroidTest goal second time HOT 6
- Enhancement: FlakyTest for JUnit4/Espresso HOT 2
- MonitoringInstrumentation leaking activity instances through ExecutorService HOT 3
- withText doesn't find views with textAllCaps attribute used HOT 1
- using onData in RecyclerView HOT 4
- Espresso-contrib cannot inflate RecyclerView with IllegalStateException (Unable to find LayoutManager) HOT 5
- Provide API to list tests that will be run
- Add API for adding RunListeners to AndroidJUnitRunner
- getGlobalVisibleRect works differently on API 22
- longClick() becomes Click()
- Accessibility checks fail tests on pre-Lollipop emulators
- pressBack() doesn't call onBackPressed().
- Migration from googlecode?
- Webview support always times out on first test on devices pre Android 4.4 HOT 2
- Having Guava and espresso-web as androidTest dependencies does not compile
- Swipe action on a view pager fails in Espresso tests on Emulator
- NoMatchingViewException leaks Activity
- onData check for non-selectable list headers doesn't work on API 22
- Espresso won't find View when included with androidTestCompile
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-test-kit.