Home » Eclipse Projects » Remote Application Platform (RAP) » RAP - qooxdoo: Set selection value of combo box via javascript(Fire 'selection changed' event via JavaScript)
RAP - qooxdoo: Set selection value of combo box via javascript [message #662888] |
Fri, 01 April 2011 11:44 |
Christian A Messages: 13 Registered: March 2011 |
Junior Member |
|
|
Hi all,
I try to test the RAP user interface using selenium and the qooxdoo user-extensions. In most situations the standard selenium commands in conjunction with qooxdoo extensions works very well. But i have a strange problem in accessing and editing the selection of a combo box.
Because selenium sets the combo box value quite unreliable, i wrote some javascript based extension functions to do that.
With the code shown below i can successful change the selection of the combo box. But the new value will not be synchronized with the server. When i safe the changes and reload them, the old value is still displayed. It seems that no change
event is fired, which causes the server to safe the new value.
In the qooxdoo 0.73 implementation used in RAP, a very poor event mechanism is implemented. A function like 'fireEvent' (which is defined in the current version) is not available.
Has anybody an idea, how i can fix it?
Thx for your replies.
Selenium.prototype.doSetComboBoxValue = function(locator, value){
var uwindow = this.browserbot.getUserWindow();
var wmanager = uwindow.org.eclipse.swt.WidgetManager.getInstance();
var cmbBox = wmanager.findWidgetById(locator);
cmbBox.setValue(value);
}
[Updated on: Fri, 01 April 2011 11:46] Report message to a moderator
|
|
| |
Re: RAP - qooxdoo: Set selection value of combo box via javascript [message #663270 is a reply to message #663190] |
Mon, 04 April 2011 13:43 |
Christian A Messages: 13 Registered: March 2011 |
Junior Member |
|
|
Hi Tim,
thanks for your advice.
With the 'select' command i got the combo box running.
Now i have a similar issue to solve for check boxes and radio buttons.
I tried the 'dispatchEvent' command for a check box with the following code snippet:
evt = new qx.event.type.ChangeEvent("selectionChanged", value, oldValue);
checkBox.dispatchEvent(evt, true);
The call of 'dispatchEvent' causes the following exception:
[[error] Unexpected Exception: message -> $0 is undefined, fileName -> http://127.0.0.1:10080/default?custom_service_handler=org.ec lipse.rwt.internal.service.JSLibraryServiceHandler&hash= H1511568866, lineNumber -> 24, stack -> ((void 0),true) @http://127.0.0.1:10080/default?custom_service_handler=org.e clipse.rwt.internal.service.JSLibraryServiceHandler&hash =H1511568866:24 SJOWContentBoundary()@:0 , name -> TypeError
It seems that a predefined event type String or a constant has to be passed as first parameter.
But i can't find any documentation where this event type parameter is explained in detail. In the qooxdoo 0.74 API reference only a
'type name of the event' is mentioned. Do you know a location where i can find a useful documentation or API reference?
Greetings,
Christian
|
|
|
Re: RAP - qooxdoo: Set selection value of combo box via javascript [message #663291 is a reply to message #663270] |
Mon, 04 April 2011 14:39 |
Tim Buschtoens Messages: 396 Registered: July 2009 |
Senior Member |
|
|
Hi.
Well, first of all, for buttons "execute()" should simulate a mouse
click i think. There often exist no real, client-side "selection" (or
other swt-like) events, client-widgets mostly process dom-events. The
"selection" event for button gets created on the server only. Faking
dom-events is also possible, but not trivial.
As for API documentation: There is an API-Viewer for qooxdoo. But you
either have to use the existing one for qooxdoo 0.7.4, which won't
reflect our additions and changes to the API, or generate a new one for
the RAP-version of qooxdoo. I recommand just reading the source-code.
All events that exist for a class are either noted in the "events" map,
or, in case of change events, in the property definition.
Greetings,
Tim
|
|
|
Re: RAP - qooxdoo: Set selection value of combo box via javascript [message #664058 is a reply to message #663291] |
Thu, 07 April 2011 10:54 |
Christian A Messages: 13 Registered: March 2011 |
Junior Member |
|
|
Hi Tim,
our test infrastructure prototype is now working fine for basic widgets like
text field, text area, check box, radio button, combo box, list (multiselect)
and spinner (setting, increment and decrement value). Table selection could
be handled through the 'qx' click command, which is delivered with the
selenium 'user.extension' file of qooxdoo. It is also possible to read the value
of most widget types using custom 'user.extension' java script functions. For
the localization of the UI elements we use a mixture of custom id's, xPath
expressions and additional localization information like the position of an
item in a list or table. The test infrastructure provides test developers with a
Java API, that prevents them from dealing with xPath. Test cases could be
written (and executed with Selenium-RC) the same way like JUnit tests are
developed. To include test data dynamically, we wrote a simple function, that
can be used to import data from excel sheets.
We now care about basic widgets like check boxes or text fields that are
included in editable table cells. The key issue is whether widgets that are
embedded in a table cell editor could be accessed the same way like
widgets that are located outside a editable table cell. If this is possible and a
localization (e.g. by custom id or table row and column number) could be
implemented, we can reuse the existing user extensions. Otherwise we
have to find another solution.
Best Greetings,
Christian
[Updated on: Thu, 07 April 2011 10:55] Report message to a moderator
|
|
| | |
Goto Forum:
Current Time: Thu Sep 26 01:45:33 GMT 2024
Powered by FUDForum. Page generated in 0.05153 seconds
|