hellofenghao / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

WaitForView using resource id doesn't return until timeout is reached, even when a match is found #660

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a test with waitForView(int id, int minimumNumberOfMatches, int 
timeout)
2. Set minimumNumberOfMatches to 0 (any number of matches)
3. Notice that even when it finds a match, Robotium waits the whole timeout 
before returning

What is the expected output? What do you see instead?
I expect that if it's looking for any matched, it would return immediately 
after finding one.

What version of the product are you using? On what operating system?
Robotium 5.3.1
Android API Level 21

Please provide any additional information below.

Original issue reported on code.google.com by bi...@jana.com on 19 Feb 2015 at 6:36

GoogleCodeExporter commented 9 years ago
According to our tests its working fine. Probably you are waiting for a View 
that doesn't show up. If you log the result returned by waitForView you will 
see it is false (if timeout is reached). 

Original comment by renasr...@gmail.com on 3 Mar 2015 at 9:19

GoogleCodeExporter commented 9 years ago
This is happening when waitForView returns true. I will get some example code 
and log together today to demonstrate. To get around this I wrote a loop that 
progressively increases timeouts, but I'd rather it just work.

Original comment by bi...@jana.com on 4 Mar 2015 at 3:23

GoogleCodeExporter commented 9 years ago
Just did a simple example and it's not happening! 

The scenario I was seeing this happening was when the tests target activity was 
replaced with a new one (code checks if you're logged in and if not redirects 
you to a login activity). Thinking about that, it makes some sense that it 
would be confused and I think this is probably outside the normal use case. 
Would take some time for me to provide an example of this without just 
exporting my whole android project. I feel a lot better about this now and feel 
comfortable with the resolution. Thanks!

Original comment by bi...@jana.com on 4 Mar 2015 at 3:50

GoogleCodeExporter commented 9 years ago
Great. Thanks for letting me know.

Original comment by renasr...@gmail.com on 4 Mar 2015 at 5:19