android-espresso


Scroll the screen to bottom without scrollview and without ID and without firstChild android-espresso automation


I want to scroll to bottom of current screen displayed, but
Application don't have any ScrollView. Application have HorizontalScrollView but it is out of context.
Using onView, TableLayout with ID in the screen. But it throws error with matches multiple views in the hierarchy.
Using onView, by getting firstChild() but still it throws error with cannot perform operation, Error performing 'scroll to' on view 'with first child view of type parentMatcher'.
Tried onData(hasToString(startsWith(). But it throws error with matches multiple views in the hierarchy.
Tried other ways like getting current Monitor and Activity but still didn't work.
OK, what I can suggest, based on scanty information in your question:
Easy approach (but not fully correct) - just swipe up int the GridView to go to its bottom:
onView(withId(R.id.GridView_Id)).perform(swipeUp());
Easy approach:
onData(instanceOf(Object_in_the_ROW.class))
.inAdapterView(withId(R.id.GridView_Id))
.atPosition(2) //position # can very if you have header or not
.check(matches(isDisplayed()))
.perform(click()); //or any other action, or no action
Approach I prefer:
onData(withROWText("unique_text_in_ROW3"))
.inAdapterView(withId(R.id.GridView_Id))
.check(matches(isDisplayed()))
.perform(click());
where withRowText() is the custom matcher to match specific text in the ROW3, something like:
public static Matcher<Object> withRowText(String expectedText) {
Checks.checkNotNull(expectedText);
return withRowText(equalTo(expectedText));
}
public static Matcher<Object> withRowText(final Matcher<String> itemTextMatcher) {
Checks.checkNotNull(itemTextMatcher);
return new BoundedMatcher<Object, ROWObject>(ROWObject.class) {
#Override
public boolean matchesSafely(ROWObject rowObject) {
return itemTextMatcher.matches(rowObject.text);
}
#Override
public void describeTo(Description description) {
description.appendText("with rowObject: ");
itemTextMatcher.describeTo(description);
}
};
}
BTW, "GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid."

Related Links

Espresso Test Failed: Wanted to match 1 intents. Actually matched 0 intents
How test onData() column value is not null?
Android, Espresso: Is one view is under another view?
Espresso: How fast show new activity?
Android, Espresso: Show/Hide view depends of item content
Android. Unit test. Check is text is show in correct language
Cucumber Espresso and Android : How to use view matchers to find the particular view using resource id?
how to re-run failed tests using AndroidJunit4?
Espresso: typeText - not work in cyrilic
Espresso test - not recognize ad
Espresso: How do i assert if a particular activity is launched when i click on a item using espresso
Android, Espresso: How check if tag value contains some string?
I want to scroll on recycler view till the element appears on screen, it may make network calls after each 10 elements.
Mock server requests Android Espresso UI Testing
Espresso mockWebServer response does not intercept http calls
Android Instrumentation pull test results/files from device

Categories

HOME
xcode8.1
systemd
dry
filesize
iverilog
yql
tcp
liferay-7
fogbugz
share
position
firebase-dynamic-links
anchor
stack-overflow
solution
yeoman-generator-angular
documentum
smartgwt
trace32
sql-injection
squid
temperature
nose
psql
fido-u2f
qa
mod-wsgi
hdmi
android-cardview
uilocalnotification
copy-protection
location-services
private-key
microsoft-certifications
advanced-filter
nest
markov-chains
gnu-classpath
macports
android-n
newtons-method
secure-coding
dagger
permission-denied
jenkins-slave
spongycastle
spring.net
openerp-6
bilinear-interpolation
dojo-build
static-methods
meld
android-async-http
vimperator
openmrs
ioctl
wepay
lovefield
in-app-billing
largenumber
mousehover
http.client
blockquote
algebraixlib
scala-macros
python-c-extension
html-escape-characters
baseadapter
phonegap-facebook-plugin
cakephp-2.2
xml-signature
visual-c++-2012
nodeload
cpu-time
django-sites
progress-db
node.js-stream
void-pointers
delphi-xe4
session-0-isolation
cgrectmake
gitx
telerik-ajax
trialware
microblogging
differentiation
hungarian-notation
ios-4.2
bindable-linq

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App