2

I had an issue to run my ui test

@Test
fun firstUi() {
    onView(withId(R.id.home_profile_tab)).perform(click())
    onView(withId(R.id.enter)).perform(click())
    onView(withId(R.id.tvCountryCode)).check(matches(withText("+964")))
}

This test run and passed

But the issue is, after running test and reaching to first line, the firs perform(click)) executed after around 90 seconds, and it is almost constant and every time it takes 90 seconds

But after that (90sec) other lines executed and test completed around 4 seconds and passed successfully

Base on android documentation:

Each time your test invokes onView(), Espresso waits to perform the corresponding UI action or assertion until the following synchronization conditions are met:

The message queue is empty.

There are no instances of AsyncTask currently executing a task.

All developer-defined idling resources are idle.

So how and where can I investigate more to detect to root cause of issue???

Or what I'm doing wrong???

hamid_c
  • 849
  • 3
  • 11
  • 29

1 Answers1

1

With the help of this post I found what was my issue

I live in iran and most of services because on sanctions are banned here

So I looked in Frames, so I found that some AsyncTask are exist for some sdk, that are trying to send request to their server, but because of ban they couldn't

So they keep retrying, maybe after 90sec without a successful request call they give up, and Espresso requirements meet to continue running tests

My Solution was using VPN, so sdk can successfully make request to their servers

hamid_c
  • 849
  • 3
  • 11
  • 29