Search code examples
automated-testsunity-game-engineios-ui-automationmonkeytalk

Using the javascript generated by MonkeyTalk with EAGLView


I have the following monkeytalk file as a proof of concept, which taps the correct screen regions:

EAGLView * Drag 40 60 40 60
EAGLView * Drag 269 274 36 68

this runs fine and when I try to export it to a javascript file I get the following:

load("libs/PoC.js");


PoC.connect.prototype.run = function() {

    this.app.eAGLView().drag("40", "60", "40", "60");
    this.app.eAGLView().drag("269", "274", "36", "68");
};

however for this I get:

result: ERROR : sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function eAGLView. (connect.js#6) in connect.js 

I don't suppose anyone can help me get access to the EAGLView from javascript? I want to drive monkeytalk from a test framework which I have already developed a lot of tests for, and which has javascript support, so I'd really like to get this working...


Solution

  • This is a problem because the javascript does not have functions for any non-standard objects. The solution is to change the class (EAGLView, in this case) to whatever it inherits from (probably View, in this case).

    So to get this example working, you could use:

    this.app.view("MonkeyID").drag();

    However, this will require that the MonkeyID be unique - you can find out more about getting a unique MonkeyID here