UITests check download progress
<p>I'm using UITests for check download progress.</p>

<p>My code in swift:</p>

<pre><code>let activityIndicator = app.activityIndicators.elementBoundByIndex(0)

while activityIndicator.exists == true {          
    sleep(1)
}
</code></pre>

<p>But when the download process is finished and activityIndicator goes from the screen, application still returns true and does not come out of the method while.</p>