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

Android Instrumentation pull test results/files from device
Espresso hangs the UI and the System kills the application
Espresso test with phone asleep
Unable to run espresso test
How to force Espresso wait for Eventbus posts?
Espresso Web + Chrome cust tab
Espresso 2 - How to Test Multiple Activities?
Android Espresso test to check syncness between ViewPager's fragments and TabViews
Is there a way to automate API calls using Espresso?
Android Espresso - Single list with same items (AmbiguousViewMatcherException)
Do Matchers extending hamcrest.BaseMatcher have to be consistent
testing http connection on google cloud test lab devices
Espresso Test Recorder has detached from the device VM
Espresso - Using google espresso how to send email from Gmail app
Unable to perform PressBack in Espresso Test
espresso : Idling resource for many situations to wait

Categories

HOME
qt
macos-sierra
class
applescript
qc
subdomain
kivy
biztalk
vsts-build
jersey-2.0
openflow
cisco
sharepoint-online
roku
phpstorm-2017.1
spring-amqp
complexity-theory
c#-7.0
l20n
jaspersoft-studio
jitsi
pe
coreldraw
qa
window-managers
python-appium
ruby-daemons
spring-annotations
basic-authentication
dotcms
source-insight
knights-tour
om-next
quickcheck
payeezy
polyml
jslint
cargo
identify
data-uri
viewcontroller
dbcc
web-inspector
apache-toree
destroy
swift2.3
android-webservice
case-when
kendo-editor
mifos
rational-performance-test
data-management
maven-release-plugin
piping
yii2-model
powerpoint-2013
strpos
maximize
frame-grab
okta-api
nastran
sqlbase
featuretoggle
supercomputers
360-degrees
embeddedwebserver
phpredis
flow-js
wicket-1.5
qt5.4
jini
air-native-extension
nosql-aggregation
eclim
boinc
iirf
jquery-transit
dynamic-rdlc-generation
tfs-sdk
user-forums
xalan
towers-of-hanoi
cakeyframeanimation
wiktionary
data-dump
fork-join
airprint
active-record-query
principles
resharper-5.0
dm
google-translator-toolkit
bucket
projectpier
community-server
parentid

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