I am using espresso for ui testing of an android app. It has feature of logging in. While logging in, if user enters wrong username or password, a toast appears saying "Incorrect username or password". I want that text for validation. I am writing the tests in android test folder.
I am new to android app testing. Need help!
In order to get the text/message of a Toast using Espresso testing framework, you can use onView() method to check the Toast message view and then try the withText() method to obtain the text of the corresponding view.
Hope this was helpful for you!