title: How does espresso time idler behave?
body: <p>I am using above technique mentioned in the <a href="http://blog.sqisland.com/2015/06/espresso-elapsed-time.html" rel="nofollow noreferrer">blog</a> , however I have noticed that it doesn't wait for required 15 seconds that I am trying to set. My question here, if all the backend task is completed before 15 seconds, does espresso identifies it and starts the next consecutive operations? Any leads on this is appreciated. </p>
  
  <pre><code>    public class ElapsedTimeIdlingResource implements IdlingResource {
    private final long startTime;
    private final long waitingTime;
    private ResourceCallback resourceCallback;
  
    public ElapsedTimeIdlingResource(long waitingTime) {
      this.startTime = System.currentTimeMillis();
      this.waitingTime = waitingTime;
    }
  
    @Override
    public String getName() {
      return ElapsedTimeIdlingResource.class.getName() + ":" + waitingTime;
    }
  
    @Override
    public boolean isIdleNow() {
      long elapsed = System.currentTimeMillis() - startTime;
      boolean idle = (elapsed &gt;= waitingTime);
      if (idle) {
        resourceCallback.onTransitionToIdle();
      }
      return idle;
    }
  
    @Override
    public void registerIdleTransitionCallback(
        ResourceCallback resourceCallback) {
      this.resourceCallback = resourceCallback;
    }
      }
  
  ==
  
  long waitingTime = DateUtils.MINUTE_IN_MILLIS / 4;
  
  IdlingPolicies.setMasterPolicyTimeout(
      waitingTime * 2, TimeUnit.MILLISECONDS);
  IdlingPolicies.setIdlingResourceTimeout(
      waitingTime * 2, TimeUnit.MILLISECONDS);
  
  IdlingResource idlingResource 
      = new ElapsedTimeIdlingResource(waitingTime);
  Espresso.registerIdlingResources(idlingResource);
  </code></pre>