lundi 8 juin 2020

AndroidX test - How to wait for screen load while running JVM test using Roboelectric

I am using AndroidX test APIs to write UI test cases in "test" folder to run Roboelectric tests. I have a LauncherActivity (splash screen with a network call) and then LoginActivity will be shown after API success.

In this case, I am launching LauncherActivity and checking for LoginActivity UI elements in my test case. I am getting Id not found exception when trying to access LoginActivity UI elements in my test case. I am using some delay API to load the screen after launching LauncherActivity

The same test case is running successfully if I run from "androidTest" folder.

Not finding a way how to wait for screen to load (with API call response) and UI elements are shown when writing Roboelectric test cases in the "test" folder.

Any help appreciated.

Aucun commentaire:

Enregistrer un commentaire