Using espresso, we click a Login button which launches an external website (Chrome Custom Tab) where you can login and then it redirects back to our android application.
Is there a way in Espresso to:
1) Verify the correct URL is being launched
2) Access the elements on the website so that I can enter the login information and continue to login
When I try viewing it in the Espresso Launch Navigator, nothing shows up for the page, and if I try to record, it doesn't pick up on me entering anything on the page.
This is what I have so far (it is in Kotlin (not Java)):
And here is the error that gets displayed:
It launches my application, select the login button, opens the website but then it isn't able to access the elements.
I also tried:
Update: This is using Chrome Custom Tabs (not a Web View) so Espresso Web is not working.
Update:
You can't use Espresso for testing Chrome Custom Tabs. Espresso works when testing your own app.
For testing the Chrome tabs you could use UI Automator but you probably don't want to do that.
A unit test would be enough here. You just need to make sure the URL passed to the Chrome custom tabs library is the correct one. You are making sure YOUR code works fine. What happens next is handled by the library and the tests belong there.
Here you are testing a simple web page. Why would you like the additional overhead of starting an emulator? Maybe Selenium or whatever is cool for web would work here (not a web dev)?
You can use Espresso Web
Here is an example test:
I was able to resolve this issue using both Espresso and UI Automator. You are able to combine the two. The selection of the login button I used Espresso (and the rest of the app, I will use Espresso). To handle the Chrome Custom tab for logging in, I used UIAutomator: