Giter Site home page Giter Site logo

Comments (10)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
Hi,

Can you please give some more details? Are you trying to invoke clickOnView() 
with the same parameter many times? Do you use a goBack() between the clicks 
etc etc.

Original comment by [email protected] on 15 Nov 2010 at 1:10

from robotium.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
I use following code to invoke it
public void testActivity(ActivityInstrumentationTestCase2<?> test,
            Instrumentation ins, Activity ac) {
        solo = new Solo(ins, ac);
        Random random = new Random(1234);
        int i = 0;
        ArrayList<View> views=null;
        Activity currentActivity = solo.getCurrentActivity();
        Activity previousActivity=currentActivity;
        while (i++ < 1000) {
            Log.i(ACTESTER,""+i);
            /*
             * We must use getViews() each time to get new list of views
             * because views on a single Activity may be updated
             */
            views=solo.getViews(); 
            if (currentActivity.hasWindowFocus()) {
                View v = views.get(random.nextInt(views.size()));
                if (v.isEnabled()&&v.isShown() ) {
                    Log.i(ACTESTER, "click "+v.toString());
                    try{
                        solo.clickOnView(v);
                        //TouchUtils.clickView(test, v);
                    }catch (Exception e) {
                        Log.i(ACTESTER,e.toString());
                    }
                    Log.i(ACTESTER, "finished click "+v.toString());
                }
            }else{
                currentActivity=solo.getCurrentActivity();
                if(currentActivity==previousActivity){
                    //some dialog pop up
                    solo.goBack();
                    Log.i(ACTESTER,"Go back");
                }else{
                    //a new Activity is created on top of the task stack
                    previousActivity=currentActivity;
                    Log.i(ACTESTER, "Change Activity to "+currentActivity);
                }
            }
        }
    }

Original comment by [email protected] on 15 Nov 2010 at 1:13

from robotium.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
It happens when the code runs hundreds of times.

Original comment by [email protected] on 15 Nov 2010 at 1:15

from robotium.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
This does not occur when you use TouchUtils instead?

Original comment by [email protected] on 15 Nov 2010 at 1:32

from robotium.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
I mean the exact same test case but instead of solo.clickOnView using 
TouchUtils.clickView(). How does that work?

Original comment by [email protected] on 15 Nov 2010 at 1:33

from robotium.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
TouchUtils is OK.

Original comment by [email protected] on 15 Nov 2010 at 1:34

from robotium.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
Replacing the call to solo.clickOnView() with TouchUtils.clickView() in the
code I provided and that is the way I used TouchUtils.clickView().

Original comment by [email protected] on 15 Nov 2010 at 1:41

from robotium.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
What happens is the following:

if(!view.isShown())
Assert.assertTrue("View is not visible and can therefore not be clicked!", 
false);

Basically it asks the view if it is shown. And that is after it has waited for 
5 seconds. So the view is telling Robotium that it is not shown (says so for 5 
seconds). Therefore Robotium fails it as it will not be able to click it (it 
thinks that it is not shown).

Original comment by [email protected] on 15 Nov 2010 at 2:26

from robotium.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
Thanks for this issue. This method will be rewritten in the next release.

Original comment by [email protected] on 15 Nov 2010 at 3:47

  • Changed state: Accepted

from robotium.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
This issue has been resolved in Robotium 2.0

Original comment by [email protected] on 7 Dec 2010 at 7:38

  • Changed state: Verified

from robotium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.