Git Product home page Git Product logo

Comments (7)

jonathanpenn avatar jonathanpenn commented on May 22, 2024

Hmm. I'm not able to reproduce this. The script runs fine against all the apps I have, even in the Retina 4-inch simulator.

If you create a blank project from one of the iOS Xcode templates, does the same error occur for you? What version of Xcode are you running?

from ui-auto-monkey.

elfenlaid avatar elfenlaid commented on May 22, 2024

I'm running 4.5 Xcode version.
With a blank project everything runs perfect and I tried to simulate situation with custom alert dialog which show some results.

Here's code https://gist.github.com/3968790 . I'm using a "Single view" project template here.

from ui-auto-monkey.

jonathanpenn avatar jonathanpenn commented on May 22, 2024

Okay, I tried a version of what you sent me and I still can't reproduce the problem. Since I didn't have access to your MPViewController and it's xib file, I just used a plain old UIViewController in my fork of your gist:

https://gist.github.com/3969536

I'm wondering if there's something in your MPViewController that's triggering this problem. Can you try changing your app delegate to use just a plain old view controller like my gist and try again? I want to first figure out if it's your machine or your custom view controller. If the problem goes away using a generic view controller, then that might help us isolate what's happening a little better.

from ui-auto-monkey.

elfenlaid avatar elfenlaid commented on May 22, 2024

My bad, I forgot to remove project prefix. MPViewController is standart uiviewcontroller that comes with "Single view" project template.

It's a little bit hard to reproduce issue anyway, you need to run script couple of times. But in my case exception appears basically in every script iteration (in best case script manage to pass ~600 events)

May be it's possible to surround tap call with some try/catche block?

from ui-auto-monkey.

jonathanpenn avatar jonathanpenn commented on May 22, 2024

Ah, I see. I'm able to reproduce it now. Not very frequently, though.

So, I'm not really sure, but on a whim I padded the x and y random coordinate generation with one pixel and it seemed to fix it. Running several times got all the way through to 1000 events.

Can you pull down the latest, or make the changes in this commit and then see if that solves it for you?

88cddfb

from ui-auto-monkey.

elfenlaid avatar elfenlaid commented on May 22, 2024

Indeed, tapWithOptions failed with bound coordinate like 320 for X. We can extend logging and wait for result or just directly invoke tap tapWithOptions with invalid params.

tapEvent: function() {
    var tapPoint = { x: this.randomX(), y: this.randomY() };
    try {
        this.target().tapWithOptions(
          tapPoint,
          {
            tapCount: this.randomTapCount(),
            touchCount: this.randomTouchCount(),
            duration: this.randomTapDuration()
        }
        );
    } 
    catch (error) {
        UIALogger.logError(error + " " + tapPoint.x + " " + tapPoint.y);
    }
}

We can remove + 1 here, cause automator accept (0,0) tap point:
return Math.floor(Math.random() * 10000) % range + 1;

Or add - 1 like you did:
this.target().rect().size.height - 1; & this.target().rect().size.width - 1

So, issue is solved.

And You rock! :) Thanks for maintenance

from ui-auto-monkey.

jonathanpenn avatar jonathanpenn commented on May 22, 2024

You're welcome! Thanks for helping me fix this. :)

from ui-auto-monkey.

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.