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

Android + Espresso + Volley: How stub http response when test UI and no network?
How test value that it not show
How to write tests for deep links in Android?
Android, Espresso: How test that fifth list item has string “row#5”?
Android, Espresso, ListView: Test that item text = “some_text” and text color is Color.Red?
AndroidInjector and Espresso
no events are recorded in Espresso Test Recorder
Android, Espresso: How check property of list item?
Android, Espresso, onData(), how find row with boolean column?
How to test View in MVP+Dagger 2 in Android
Android, Espresso, ListView: How scroll to item and check this item?
Android, multiDexEnabled = true --> not start Espresso tests (NoClassDefFoundError)
Android, Espresso. How check is soft keyboard is under view?
How to validate whether opened correct activity - Espresso
Espresso Test Failed: Wanted to match 1 intents. Actually matched 0 intents
How test onData() column value is not null?

Categories

HOME
xpath
events
protocol-buffers
android-studio
list
gaming
opencv-python
softlayer
compilation
bing-search
malware
drag-and-drop
haxe
wagtail
cisco
spring-jpa
amazon-elb
dhcp
sql-injection
squid
android-contacts
exe
spring-shell
activeadmin
dashdb
sharedpreferences
connection-refused
mime-types
device
pyopencl
pubxml
webviewclient
spreadsheetgear
bitbake
audit
infopath2010
steam-web-api
reporting
db2-luw
dreamfactory
pdfminer
mars-simulator
iscroll
grails3.2.0
hdiv
angular-datatables
distributed-caching
music21
hibernate-ogm
karabiner
sigsegv
1010
zend-server
msg
jpda
visual-studio-monaco
msbuild-4.0
powerpoint-2013
codecharge
currency-exchange-rates
lovefield
json-spirit
enaml
explain
camus
baseadapter
juttle
iodocs
oracle-adf-mobile
loginview
libgcc
osascript
nodeload
cidr
hotswap
spring-social-linkedin
autonumber
django-settings
yii-booster
sql-view
insertonsubmit
disjoint-union
jacob
flv
aero
arel
email-verification
xcode4.5
litespeed
delphi-prism
qt-mobility
qcar-sdk
multiple-users
reliability
firephp
service-factory
bindable-linq

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App