Hi Daniel, I really like the Simulator contrib. We're already using it to good effect, and plan to expand our use of it further. Here are the things that I've changed so far.
All of this is based on the version from URL: https://qooxdoo-contrib.svn.sourceforge.net/svnroot/qooxdoo-contrib/trunk/qooxdoo-contrib/Simulator/trunk/tool/selenium/user_extension/user-extensions-qooxdoo.js Revision: 18322 I've changed some logging messages. With our application we use arrays of objects, and when you do things like array.join('/') on arrays of objects, it will recurse through not only the top level objects inside the array, but also down into the objects themselves. This was causing selenium to blow up on any step that included the log messages: @@ -1064,7 +1233,9 @@ { // basically we tail recurse, but catch exceptions try { - LOG.debug("Qxh Locator: tail-recursing with root: "+el+"(fixed step: '"+step+"'), path: "+npath.join('/')); + LOG.debug("Qxh Locator: found step (" + step + "), moving on to (" + + npath[0] + ")" ); + //LOG.debug("Qxh Locator: tail-recursing with root: "+el+"(fixed step: '"+step+"')"); var res = this._searchQxObjectByQxHierarchy(el, npath); } catch(e) I added some extra log messages, just to watch what was going on: @@ -1104,10 +1275,12 @@ for (member in root) { if (member == step) { + LOG.debug("Qxh Locator: _getQxElementFromStep1 returning object");^M return root[member]; } } + LOG.debug("Qxh Locator: _getQxElementFromStep1 returning null");^M return null; }; Here's the bit that I added to handle splitpanes. Its in the PageBot.prototype._getQxNodeDescendants() function. I had originally tried to use a locator syntax like .../qx.ui.splitpane.Pane/*/object.I.want, but it turns out that the splitpane has an attribute that points to the parent object of the split pane. So any time I would try this type of syntax, I would get looped back up the object tree and it would either find something that I didn't want, or it would loop recursively. So, I used the internal _getChildren() method on the splitpane. _getChildren()[2] is the left panel, and _getChildren()[3] is the right panel. I know that this is probably exposing too much of the internal construction of the splitpane itself, but it works. The update that I added allows the child[N] syntax to work with splitpanes by also checking to see if _getChildren() exists, and using it: @@ -1343,6 +1516,13 @@ descArr = descArr.concat(c); } + else if (node._getChildren) { + c = node._getChildren(); + LOG.debug("getQxNodeDescendants: using _getChildren() to retrieve descendants"); + // +" (got: "+ (c.length? c.length: 0)+")"); + descArr = descArr.concat(c); + } + // use JS object members else { And finally just another logging message change because our object tree was causing this debug message about "node" to expand recursively the object that it hit, and it would cause selenium to return the error: too much recursion and fail the step @@ -1364,7 +1544,7 @@ } } - LOG.debug("getQxNodeDescendants: returning for node : "+node+" immediate children: "+descArr1.length); + LOG.debug("getQxNodeDescendants: returning for node immediate children: "+descArr1.length); return descArr1; }; // _getQxNodeDescendants() @@ -1479,3 +1659,4 @@ } }; Sincerely, Mr. Hericus [email protected] http://www.hericus.com/ Daniel Wagner wrote: > Hi Mr Hericus, > > good to see someone actively using the Simulator contrib :) > I'm curious, what did you have to change to make the child locator > work with splitpanes? If you could post your patch, I'd integrate it > into the contrib. Are you using trunk or 0.1? > > Regards, > Daniel > > Mr. Hericus schrieb: >> Hi Cecilla, >> >> Here are some sample locator strings from our application. You can >> see a working version of the app to compare against these here: >> http://www.hericus.com/demo.html >> >> Our Application class has 2 main structures that we use to navigate >> everything, a pageButtons array, and a pageStack array. All of our >> locators start from the "app:" prefix, and then follow down either >> the pageButtons array or pageStack array. >> >> This is how we switch between different workspaces. Use qxClick with >> any string like this: >> "qxh=app:pageButtons/[...@label=\"Builds\"]" >> "qxh=app:pageButtons/[...@label=\"Bugs\"]" >> >> Once you are in a workspace, you can activate the "New" menu in the >> first splitpane by using this type of navigation: >> "qxh=app:pageStack/[...@name='" + workspace + >> "']/qx.ui.splitpane.Pane/child[2]/qx.ui.toolbar.ToolBar/child[0]/[...@label='New']" >> >> >> >> Note that navigating a splitpane in the existing simulator doesn't >> work. I had to patch the code in order to allow the child[N] syntax >> to work correctly for splitpanes. >> >> Once you've clicked on the new menu, then click again to select a >> named option under it: >> "qxh=app:pageStack/[...@name='" + workspace + >> "']/qx.ui.splitpane.Pane/child[2]/qx.ui.toolbar.ToolBar/child[0]/[...@label='New']/[...@menu]/[...@label='" >> >> + name + "']" >> >> We make extensive use of TabViews. Here's one that allows you to see >> if a tab view has shown up or not. Use the standard selenium >> isElementPresent() function, with a locator like: >> m_qx.isElementPresent("qxh=app:pageStack/[...@name='" + workspace + >> "']/qx.ui.splitpane.Pane/child[2]/qx.ui.tabview.TabView/[...@label='" + >> tabTitle + "']"); >> >> If you want to click on a tabview button to activate a specific tab, >> use something like this: >> "qxh=app:pageStack/[...@name='" + workspace + >> "']/qx.ui.splitpane.Pane/child[2]/qx.ui.tabview.TabView/[...@label='" + >> tabTitle + "']/[...@__childcontrols]/[...@label='" + tabTitle + "']" >> >> Most of our tab pages hold other types of content (as you would >> expect). Here's one where we are accessing the table attribute on a >> tab page: >> "qxh=app:pageStack/[...@name='" + workspace + >> "']/qx.ui.splitpane.Pane/child[2]/qx.ui.tabview.TabView/[...@label='" + >> tabTitle + "']/child[0]/[...@table]" >> >> I hope that helps to get you started. Feel free to ask questions >> about the above, as the syntax can get interesting :-) >> >> Sincerely, >> >> Mr Hericus >> [email protected] >> http://www.hericus.com/ >> >> Daniel Wagner wrote: >>> Hi, >>> >>> the qxh locators work with the objects of the qooxdoo application, >>> not DOM objects. >>> >>> The qxh locator steps are explained in the wiki[1], but to answer >>> your question, yes, you can locate qooxdoo objects using their class >>> names or any of their properties. Check out the qooxdoo application >>> in the Simulator contrib and the corresponding simulation script >>> (tool/selenium/simulation/custom/simulation.js) for some examples. >>> >>> However, you can only check for one condition per step, so you >>> couldn't search for your TextField using both visibility and its >>> label text. >>> >>> Feel free to ask if you have any further questions, although I'm >>> afraid I've never really used the Simulator for qooxdoo 0.7-based apps. >>> >>> Regards, >>> Daniel >>> >>> [1]http://qooxdoo.org/contrib/project/simulator/selenium-user-extension >>> >>> Cecilla Müller schrieb: >>> >>>> Hi, >>>> >>>> I'm using Selenium with the 0.1 version of the qooxdoo user >>>> extension to test a RAP application. I would like to use the qxh >>>> locator, but I just don't understand how to use it properly. The >>>> examples I find use only the properties "label" and "page" e.g. >>>> testing http://demo.qooxdoo.org/0.7.2/showcase/index.html#Tab. What >>>> kind of properties are these? Using Firebug I can't find a property >>>> "label" in the DOM for example. If these are names of the classes, >>>> how do I refer to a textField (qx.ui.form.TextField)? Can I locate >>>> a TextField which has to be visible an whose ID starts with "Test"? >>>> >>>> Thanks for any hint. >>>> >>>> Regards, >>>> >>>> Fabian >>>> ____________________________________________________________________ >>>> Neu: WEB.DE FreeDSL Komplettanschluss mit DSL 6.000 Flatrate und >>>> Telefonanschluss für 17,95 Euro/mtl.!* http://produkte.web.de/go/02/ >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> >>>> >>>> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT >>>> is a gathering of tech-side developers & brand creativity >>>> professionals. Meet >>>> the minds behind Google Creative Lab, Visual Complexity, >>>> Processing, & iPhoneDevCamp asthey present alongside digital >>>> heavyweights like Barbarian >>>> Group, R/GA, & Big Spaceship. http://www.creativitycat.com >>>> _______________________________________________ >>>> qooxdoo-devel mailing list >>>> [email protected] >>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel >>>> >>>> >>>> >>> >>> ------------------------------------------------------------------------------ >>> >>> >>> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT >>> is a gathering of tech-side developers & brand creativity >>> professionals. Meet >>> the minds behind Google Creative Lab, Visual Complexity, Processing, >>> & iPhoneDevCamp asthey present alongside digital heavyweights like >>> Barbarian >>> Group, R/GA, & Big Spaceship. http://www.creativitycat.com >>> _______________________________________________ >>> qooxdoo-devel mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel >>> >>> >> >> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------------ >> >> >> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT >> is a gathering of tech-side developers & brand creativity >> professionals. Meet >> the minds behind Google Creative Lab, Visual Complexity, Processing, >> & iPhoneDevCamp as they present alongside digital heavyweights like >> Barbarian Group, R/GA, & Big Spaceship. >> http://p.sf.net/sfu/creativitycat-com >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> qooxdoo-devel mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
