stephenwang1011 / robotium

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

waitForView() waits for given timeout even if view is shown #275

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create new Android test project
2. Use waitForView(View view, int timeout, boolean scroll) for a view which 
loads in a fair time, say 15-20 seconds (ex. search results for contents 
fetched from internet)
3. Set the timeout considerably long (2-3 minutes)
4. Verify that the method actually waits for given timeout even though the view 
is loaded much earlier.

What is the expected output? What do you see instead?
Expected: The method should return when it finds the view available on activity.

Actual: The method waits for given timeout even after view is loaded.

What version of the product are you using? On what operating system?
Robotium v3.2.1
Android SDK r18
ADT plugin 18
Eclipse Indigo
Android tablet 4.0.3

Please provide any additional information below.

Original issue reported on code.google.com by sbaduk...@gmail.com on 31 May 2012 at 1:29

GoogleCodeExporter commented 9 years ago
I am not able to reproduce your issue. What happens if you do the following:

for(View view : solo.getCurrentViews()){
            boolean foundView = solo.waitForView(view, 40000, false);
            Log.d("Robotium", "found view: " + foundView);

        } 

Original comment by renasr...@gmail.com on 1 Jun 2012 at 12:34

GoogleCodeExporter commented 9 years ago
Hi Renas,

I tried above code and found that it consumes the timeout for the views which 
are returned as false. Whereas, it returns immediately for the views which are 
found as true.

But I can see that the intended view is present on current activity.
So, why doesn't solo find the view?

Suppose there is a Loading screen with Loding.java activity. Once we say 
solo.getCurrentViews(),
1. Does solo get all the views on Loading screen?
2. If activity changes before next iteration, does the list get updated with 
views on next screen, say Home screen with Home.java activity? It appears from 
the loop that the list does get updated with views on whatever the screen is 
loaded while the method solo.getCurrentViews() was called.
3. Does it get nested views? For example a view inside a relative layout. I can 
see that it gets relative layout as a view but not the buttons inside the 
layout as view.

Original comment by sbaduk...@gmail.com on 4 Jun 2012 at 11:47

GoogleCodeExporter commented 9 years ago
Does the intenden view belong to the same process as the other views found by 
Robotium? If yes, would it be possible for you to send a sample app that 
exhibits this problem?

1. It gets all the views as long as they belong to the same process as the 
application under test.

2. The views are taken from the platform. As long as Android is showing them 
(and they belong to the same process), then they are available to Robotium. The 
view handling mechanism is not at all connected to getCurrentActivity(). They 
are independent of each other.

3. Yes all views shown should be returned. 

Original comment by renasr...@gmail.com on 4 Jun 2012 at 12:14

GoogleCodeExporter commented 9 years ago

Original comment by renasr...@gmail.com on 11 Jun 2012 at 4:10