android-espresso


How to validate whether opened correct activity - Espresso


I created android UI test with espresso and done Button click and opening an Activity. Now I want to validate whether opened correct activity or not.
Use espresso-intents to validate that.
The usage is:
intended(hasComponent(NewActivity.class.getName()));
You can read this thread for more details on that:
Espresso - check which Activity is opened using intent on button press?
You want get the instance of activity rule which you have register and compare it with the activity which you want.
// Define activity rule
#Rule
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>
MainActivity.class);
// compare activity rule activity with the activity you want to check.
Assert.assertEquals(mActivityRule.getActivity(), MainActivity.class);

Related Links

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
Testing Snackbar with Espresso

Categories

HOME
events
android-espresso
memory
activemq
mongoid
jersey-2.0
qooxdoo
facebook-android-sdk
repair
clone
capistrano
phpmqtt
scheduler
tup
wine
lda
android-externalstorage
fullcalendar-scheduler
cuba-platform
distributed-computing
squid
synthesis
android-contacts
mixpanel
hidden
cpu-usage
spring-shell
maven-surefire-plugin
rxjs5
eclipse-emf
quartz.net
react-dnd
introspection
cellular-network
crud
macromedia
tsung
credit-card
mapnik
windows2012
steam-web-api
lxml
winrm
creation
textmate2
netstat
code-rally
forms-authentication
uivisualeffectview
android-n
suds
newtons-method
moinmoin
karabiner
gestures
winston
android-sharing
android-mediarecorder
patternlab.io
business-rules
petsc
elastic4s
streamwriter
nclam
nsrunloop
svnserve
gcloud-node
conan
fragmentstatepageradapter
xcopy
mnesia
extend
sqlbase
hmisc
domino-designer-eclipse
google-gdk
algebraixlib
kotlin-android-extensions
prism-4
password-recovery
utf8-decode
ecos
csslint
windows-taskbar
typesafe-stack
pbkdf2
revmob
.net-remoting
chartfx
multiscaleimage
fitch-proofs
qtextbrowser
rtd
regression-testing
oracle-pro-c
downcasting

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