RobotiumTech / robotium

Android UI Testing
http://www.robotium.org
Apache License 2.0
2.86k stars 786 forks source link

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

Closed renas closed 9 years ago

renas commented 9 years ago

From bi...@jana.com on February 19, 2015 10:36:37

What steps will reproduce the problem? 1. Create a test with waitForView(int id, int minimumNumberOfMatches, int timeout)

  1. Set minimumNumberOfMatches to 0 (any number of matches)
  2. 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: http://code.google.com/p/robotium/issues/detail?id=660

renas commented 9 years ago

From renasr...@gmail.com on March 03, 2015 13:19:19

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).

Status: Invalid
Owner: renasr...@gmail.com

renas commented 9 years ago

From bi...@jana.com on March 04, 2015 07:23:21

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.

renas commented 9 years ago

From bi...@jana.com on March 04, 2015 07:50:44

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!

renas commented 9 years ago

From renasr...@gmail.com on March 04, 2015 09:19:33

Great. Thanks for letting me know.