Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Christian A is currently offline Christian AFriend
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 #663190 is a reply to message #662888] Mon, 04 April 2011 09:12 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Hi Christian.

> 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.

It's called dispatchEvent, or createDispatchEvent, depending on what you
need. You'll find those in qx.core.Target.

> Has anybody an idea, how i can fix it?
>
> cmbBox.setValue(value);

This will only set the content of the combos textfield, not the selected
item. Try cmbBox.select( int ).

Greetings,
Tim
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 Go to previous messageGo to next message
Christian A is currently offline Christian AFriend
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 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
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 Go to previous messageGo to next message
Christian A is currently offline Christian AFriend
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

Re: RAP - qooxdoo: Set selection value of combo box via javascript [message #717114 is a reply to message #664058] Fri, 19 August 2011 10:58 Go to previous messageGo to next message
mrbazsee is currently offline mrbazseeFriend
Messages: 6
Registered: August 2011
Junior Member
Hi Christian,

I am working on a GUI test "framework" which will be able to test both RCP and RAP GUIs (and later can be extended). I found RAP to be a bit tricky though... Managing basic widgets seems to be ok but I couldn't find a solution to edit table cells.
As I see you've created a test infrastructure which handles RAP GUI. Is it possible to find this framework somewhere to get ideas from it? If not than can you tell me which way should I go to find a solution for that problem?

Best regards,
Balazs
icon7.gif  Re: RAP - qooxdoo: Set selection value of combo box via javascript [message #1231310 is a reply to message #717114] Tue, 14 January 2014 10:19 Go to previous message
g h is currently offline g hFriend
Messages: 1
Registered: January 2014
Junior Member
I have now similar issue to solve.
@Christian: Could you please tell if you have already a solution for your problem?
@Balázs: Is it possible to see your RAP GUI testing framework?

Thanks for hints!
George
Previous Topic:Javascript-Error with 1.4.0M6
Next Topic:%Text not translated after language change
Goto Forum:
  


Current Time: Thu Apr 25 13:13:49 GMT 2024

Powered by FUDForum. Page generated in 0.03811 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top