V
V
Valery Osipov2015-12-04 12:44:43
Android
Valery Osipov, 2015-12-04 12:44:43

How to wait for another activity to open?

I want to make UI tests for an android application - clicking on the necessary buttons, checking that everything is displayed normally and the API methods used have not broken.
On the login screen, I do performClick on the "Login" button, wait for waitForIdleSync (), check that the MainActivity has opened.
When you click on the button, the ProgressBar opens, which spins while authorization requests, getting settings, and others are performed in the background. After all requests are completed, the ProgressBar closes and the desired activity opens.
The problem is that idle comes right after the opening of the ProgressBar. And how to wait for the opening of the desired activity?
So far I see only the option of creating a callback in the authorization activity setOnRequestsDoneListener, I wanted to know if there are any better ideas

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Perelygin, 2015-12-04
@orcDamnar

well, that's all right. you launch a dialog, and the activity that launched it enters IDLE. You, apparently, start AsynkTask, and in onPostExecute you start MainActivity? here is how after that also it is necessary to check... that is ProgressBar.dismis; waitForIdleSync(); startActivity();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question