View Full Version : GXT and Selenium

20 Jul 2009, 6:22 AM
Its possible realize test using selenium?
If find one issue.. I can report in help forum?

or the suggest its for dont use because GXT dont work with Selenium..

When I worked with ExtJS 2.0 (I know that extJs its differente GXT) isnt possible realize this type of test..


21 Jul 2009, 4:11 AM
when a radio group or a checkbox group its marked as invalid.. add one style "tolding" that this field its invalid like the other fields (textfield, datefield....)

21 Jul 2009, 4:12 AM
and when call the method clearInvalid.. remove this style..

21 Jul 2009, 7:41 PM
I have approximately 45 Selenium tests testing areas of my client. I started to write a blog on the topic in June (http://syrupsucker.blogspot.com/2009/06/gxt-20-and-selenium.html) to starts to cover some of the topics and ways around GXT querkiness. I highly suggest using a good HTML editor like Firebug to try and understand the DOM created and use XPaths which focus in on your element (without using ids).

Do not bother making record/playback tests because every code change will wack them out.

Finally, create solvents/patterns (whatever you want to call it) for functional areas of the product so you can create a Domain Specific language. My Selenium "tests" only call APIs against my solvents and do not deal with any XPaths, etc. These are all contained in the solvents. Between going from M1 to M2, M3 and the RC1, RC2 and now 2.0 I had to make some minor changes (like the DOM path for buttons changed) but overall it was really easy to zero in on a failed Xpath. As well, this allowed me to verify the functionality worked before upgrading the library (I ran the tests) so when it failed afterward it meant (a) a bug in GXT (there are none right!) or (b) an XPath change.

It is time consuming though - but I have some helpful hints on my blog. Hopefully I'll write something in a few weeks to cover more information. The only issue I have had (and I did post a question about it) is I have a TreePanel where when the user clicks on the value text it fires off a request to filter the result table. I have verified with both IE and Firefox that the event sequence is mouseDown,mouseUp,click - and I can get the selenium player to "highlight" the row like it was selected, but for the life of me I can not figure out how to get GXT to recognize the event!!! I think I've spent 6 hours on this over the past few weeks....


28 Jul 2009, 6:00 PM
I had trouble with events - I think that GXT adds events after the html is created, therefore isElementPresent returns true, but clicks are not recognised.

The solution (for me) was to wait till the tree panel has the onclick set:

public static void waitForElementOnClickAvailable(Selenium selenium, String id, int timeout)
selenium.waitForCondition( "selenium.browserbot.getCurrentWindow().document.getElementById('" + id + "').onclick != null", Integer.toString(timeout));
This also makes clicking on tree items much more reliable (I was getting failures if the test ran too fast).