Chris,

Let me elaborate a bit on what Jim wrote:

Jim Hunter wrote:
> Yes, don't work on the generated HTML, work with the qooxdoo controls.
> If you have a button, call the execute method of the button. For some
> controls you may need to create an event for execute and inside that
> event call the click method (assuming you defined an event listener
> for click).

Widgets derived from qx.ui.core.Widget inherit the 'execute()' method.
Calling this method on an instance is the same as a user clicking the
widget (or 'tabbing' to it and hitting the Return key).

A major challenge here is to get at the specific instance you want to
call this method with at runtime. As qooxdoo creates a top-level
namespace in the interpreter, accessing this namespace is easy: qx.
Getting at your running app is not so trivial. With

    qx.ui.core.ClientDocument.getInstance()

you will get the top-most object representing your running app, created
by qooxdoo. All "living" objects of your qooxdoo app are beneath this
root. With 'getChildren()' you can retreive an array of the top-level
objects you have actually created in your code (e.g. the top-level
application class, iframes, tooltips, other objects added with
'obj.addToDocument()', etc.).

    qx.ui.core.ClientDocument.getInstance().getChildren()

The point here is to know which of those children represents your
application class, since this is usually the class through which you can
retreive all the other widgets of your application. One way to get this
is to iterate through the array and test for your top-level app class
with the 'instanceof' operator, e.g 'if (children[i] instanceof
custom.Application)' (using the class name of the skeleton app). This
will give you the proper index.

    qx.ui.core.ClientDocument.getInstance().getChildren()[2]

Now having retreived your top-level app class, you should be able to get
to all the sub-widgets you created in your app. Many people attach
widgets to the top-level object like 'this.mybutton = new
qx.ui.toolbar.MenuButton(...);'. This will then allow you to invoke the
'execute()' method on it:

   
qx.ui.core.ClientDocument.getInstance().getChildren()[2].mybutton.execute()

You might also want to check the details at
http://qooxdoo.org/documentation/0.7/debugging#interactive_shell_idioms
(which I believe apply to your test code as well).

I'm not sure whether this looks like an ideal solution to you, since it
forces you to write very qooxdoo specific code in your test app. But as
Jim pointed out it also allows you to deal with the objects you are
familiar with from your app, rather than wading through the amounts of
'div's that are created by the qooxdoo runtime to render it. That should
provide a bit of comfort ... ;-)

As an alternative, if you want to stick with your 'div' based approach,
mind that qooxdoo links suitable DOM nodes to qooxdoo widgets, which
they implement. If you got the right DOM node, checking its 'qx_Widget'
member gives you the qooxdoo widget instance, which you can then inspect
(e.g. with instanceof) and call methods on. This should have the same
effect as the above.

I'm also interested in which test tool you are using, so keep us posted.

HTH,
=Thomas

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to