6

By default espresso waits for the progress bar from my activity to finish loading before executing the next instructions.

I would like to force Espresso not to wait for it and execute the rest of instructions as the progress dialog is loading.

Any hits as to where I should look for that?

After some investigations I assume I must make use of the IdlingResource class.

Adrian Olar
  • 2,883
  • 4
  • 35
  • 63

1 Answers1

2

Check this answer:

The default timeout that Espresso will wait for all registered resources to become idle is one minute.

You can change this using the IdlingPolicies class to set an explicit timeout:

IdlingPolicies.setIdlingResourceTimeout(1, TimeUnit.HOURS);

From: Espresso how to wait for some time(1 hour)?

Instead of 1 hour try to set for example 1 second (I don't know if 0 is allowed).

You can also create a custom Idling Resource like it is explained here: Espresso: Thread.sleep( );

Hope it help

Community
  • 1
  • 1
piotrek1543
  • 19,130
  • 7
  • 81
  • 94
  • 1
    Hi, thanks for your answrer. Just tried to add a custom idling resource timeout of 1 second but it doesn't seem to have any effect. Could you perhaps be a little bit more specific as to where this piece of code needs to be added? I tried adding it directly into the test. – Adrian Olar Jan 12 '16 at 07:49
  • Just check the first link above - here you would find full code with this exactly line – piotrek1543 Jan 12 '16 at 07:57
  • 1
    Just did that. The code works but the wait occurs only after the progress bar finishes. What I want is to ignore the progress bar and wait for a custom amount of time... – Adrian Olar Jan 12 '16 at 08:04
  • Check this: https://github.com/FutureProcessing/AndroidEspressoIdlingResourcePlayground and ask an author how to do it - he would better know how to solve it – piotrek1543 Jan 12 '16 at 08:24