Go Back   SmartClient Forums > Smart GWT Technical Q&A
Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 14th Dec 2008, 02:33
taxaw taxaw is offline
Registered Developer
 
Join Date: May 2008
Posts: 29
Default Selenium

Hi,
Can selenium testing tools be used with SmartClient/GWT ? With gwt-ext, i used to set the id of widget in order to have direct access to them from selenium command (locator).
Is it possible to set id for all widget present in SmartClient/GWT ?
Thanks.
Reply With Quote
  #2  
Old 16th Dec 2008, 06:19
taxaw taxaw is offline
Registered Developer
 
Join Date: May 2008
Posts: 29
Default up

SetId like with gwt-ext ?
Reply With Quote
  #3  
Old 30th Dec 2008, 06:05
hanno hanno is offline
Registered Developer
 
Join Date: Nov 2008
Posts: 2
Default

++

GWT widgets provide the method "ensureDebugId" which seems not to work with SmartGWT.

Is there a chance of making the method workable with one of the next SmartGWT releases?

Thanks!
Reply With Quote
  #4  
Old 30th Dec 2008, 07:56
sjivan sjivan is offline
Registered Developer
 
Join Date: May 2008
Posts: 1,296
Default

Is anyone here familiar with Selenium at the code level? (or is willing to do a little digging). Basically in order to support Selenium, the function for
ID --> DOM lookup in Selenium needs to be overridden with a simple SmartClient specific function.

Tools like Selenium IDE also support customization by pointing to a user defined JS file.

My bandwidth is a little limited due to other tasks so if anyone can take the lead on this it would be great. Post here or email for details. Else I'll get to it in the order of priority relative to other tasks..

Thanks,
Sanjiv
Reply With Quote
  #5  
Old 30th Dec 2008, 08:42
mike.art1 mike.art1 is offline
Registered Developer
 
Join Date: May 2008
Posts: 156
Default

Should be easy. From what I've read you need to add the SC ID function to user-extensions.js

Something along the lines of

Code:
/** * Finds a SmartClient element based on the id * @param id SmartClient element id */ PageBot.prototype.SCid = function(id, inDocument) { return inDocument.getElementById(id); //change this to the custom function }
Reply With Quote
  #6  
Old 16th Feb 2009, 07:44
uberto uberto is offline
Registered Developer
 
Join Date: Jan 2009
Posts: 28
Default

Quote:
Originally Posted by mike.art1
Should be easy. From what I've read you need to add the SC ID function to user-extensions.js

Something along the lines of

Code:
/** * Finds a SmartClient element based on the id * @param id SmartClient element id */ PageBot.prototype.SCid = function(id, inDocument) { return inDocument.getElementById(id); //change this to the custom function }

I just did some experiments today.
Apparently the problem is not the id but the trigger of events.
That is I can (apparently) properly record all my actions, but when I rerun the tests while I'm seeing the fields correctly filled, my "clicks" are not working.

Did someone find a solution?
Using a 1000 bucks / mo. software is a no way, possibilities are somehow running tests in javascript or using some macro plugin and doing the checks manually.
Reply With Quote
  #7  
Old 17th Feb 2009, 01:08
uberto uberto is offline
Registered Developer
 
Join Date: Jan 2009
Posts: 28
Default

See also this:
http://clearspace.openqa.org/message/56726

given that this is a pretty important requirement for us, do you would accept some patches to make gwt firebug friendly?
I was thinking along the lines of putting a parameter somewhere to listen "soft" clicks from firebug.
Not sure to understand well but maybe putting an optional (via the parameter) javascript onClick() listener on every canvas that fire a proper smartGwt click event.

I'm looking at the Canvas.setupClickEvent() code
Reply With Quote
  #8  
Old 17th Feb 2009, 05:05
uberto uberto is offline
Registered Developer
 
Join Date: Jan 2009
Posts: 28
Default

I found a workaround (for buttons) to be able to test with Selenium:

make sure to assign ID to your buttons;
yourButton.setID("AddUserBtn");

then in selenium replace the XPath from the recorder (that use temporary id) with something like:
//div[@eventproxy="AddUserBtn"]/table/tbody/tr/td

and then replace click event with KeyPress using blank as Value.

now it works fine.
Reply With Quote
  #9  
Old 17th Feb 2009, 10:53
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 13,637
Default

Just a note that part of the underlying problem is that Selenium currently plays back a simplified event stream (click but not mouseup/mousedown). With other tools that do this, it's often possible to get a working record and playback by doing everything via the keyboard only when recording the test case.
Reply With Quote
  #10  
Old 18th Feb 2009, 07:08
taxaw taxaw is offline
Registered Developer
 
Join Date: May 2008
Posts: 29
Default The problem is not about recording and replaying

Isomorphic , The real problem is not about having a way to record actions and replay them. It's about having the possibility to write by hands selenium commands (Mouse down/Mouse Up are part of it) in order to simulate all end users actions.
Uberto found a way to click a button through selenium commands, and to identify uniquelly a button by calling the setID method.
The question is :
Is there a setID method for all SmartGWT widgets objects ?
If yes it is possible to test SmartGWT with Selenium (not by recording and replaying but by writing the selenium commands directly) .
For ext/ Gwt-ext, i've found a framework based on selenium which help greatly to write functional tests. Every Ext widget has its own way to be accessed : http://code.google.com/p/kdev-wtf/

Sory for my english.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


©2006 Isomorphic Software   ·   Terms of use