Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Asserting component enability
Asserting component enability [message #67317] Wed, 26 December 2007 11:08 Go to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi,

Firstly, Merry Christmas to RAP Team.

I need to assert menu enability but I've found no way of doing this using
Selenium since I don't know what attribute to check.
Using Firebug I found that the difference between enabled & disabled menu
is only on the RGB attribute of the resultant div element, but Selenium
does not provide a way to check this attribute.

Any help would be greatly appreciated.

Best Regards,

Setya
Re: Asserting component enability [message #67386 is a reply to message #67317] Fri, 28 December 2007 13:19 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 237
Registered: July 2009
Senior Member
Hi Setya,

the generated html of the page (the html elements in the dom) are only
for presentation of the UI. This means that it doesn't need to know more
than the rgb value. One idea is to ask the RAP WidgetManager to give you
the widget associated with the id of the div (see UITest stuff new in
RAP CVS) together with WidgetManager#findWidgetById. This will return
the widget instance itself (a qooxdoo class instance) where you can
check the enablement of the menu item. I think you can package this as a
selenium extension to have a wrapper which does this kind if stuff (see
RAP UI Test page - that approach uses also an own selenium extension).

Greets
Benny

Setya wrote:
> Hi,
>
> Firstly, Merry Christmas to RAP Team.
>
> I need to assert menu enability but I've found no way of doing this
> using Selenium since I don't know what attribute to check. Using Firebug
> I found that the difference between enabled & disabled menu is only on
> the RGB attribute of the resultant div element, but Selenium does not
> provide a way to check this attribute.
>
> Any help would be greatly appreciated.
>
> Best Regards,
>
> Setya
>
Re: Asserting component enability [message #67686 is a reply to message #67386] Wed, 02 January 2008 06:04 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Benny,

Thank you very much for your suggestion.

> One idea is to ask the RAP WidgetManager to give you
> the widget associated with the id of the div (see UITest stuff new in
> RAP CVS) together with WidgetManager#findWidgetById. This will return
> the widget instance itself (a qooxdoo class instance) where you can
> check the enablement of the menu item.
>I think you can package this as a
> selenium extension to have a wrapper which does this kind if stuff (see
> RAP UI Test page - that approach uses also an own selenium extension).

My questions:

1. If I put some widgets in my app I can assign their id's using setData,
but how do you assign id to components rendered by RAP, like menus,
coolbar buttons, views, editors, etc ?
2. I've toyed around with Selenium extension, but I didn't know that I can
return a qooxdoo class instance. Could you elaborate more on this ?

Regards,

Setya
Re: Asserting component enability [message #68125 is a reply to message #67686] Thu, 03 January 2008 10:24 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi,

> 1. If I put some widgets in my app I can assign their id's using setData,
> but how do you assign id to components rendered by RAP, like menus,
> coolbar buttons, views, editors, etc ?

I have found out that RAP by default generated the id's for some of the
div elements.

> 2. I've toyed around with Selenium extension, but I didn't know that I can
> return a qooxdoo class instance. Could you elaborate more on this ?

How can I get a reference to WidgetManager from user-extensions.js ?

Regards,

Setya
Re: Asserting component enability [message #68698 is a reply to message #68125] Thu, 03 January 2008 11:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Hi Setya,

see my comments inline.

Cheers,
Rüdiger

Setya wrote:
> Hi,
>
>> 1. If I put some widgets in my app I can assign their id's using
>> setData, but how do you assign id to components rendered by RAP, like
>> menus, coolbar buttons, views, editors, etc ?
>
> I have found out that RAP by default generated the id's for some of the
> div elements.

If UI tests are enabled, RAP assigns the widget-id to the outermost DOM
element that represents the widget on the client-side.

>
>> 2. I've toyed around with Selenium extension, but I didn't know that I
>> can return a qooxdoo class instance. Could you elaborate more on this ?
>
> How can I get a reference to WidgetManager from user-extensions.js ?

The client-side WidgetManager can be used like this:
var wm = org.eclipse.swt.WidgetManager.getInstance()
// obtain reference to qooxdoo widget
var widget = wm.findWidgetById( "<my-widget-id>" );
// obtain id for widget
var widgetId = wm.findIdByWidget( widget );

Please be aware that this is no API (yet) and thus may change without
further notice.

>
> Regards,
>
> Setya
>
Re: Asserting component enability [message #68759 is a reply to message #68698] Thu, 03 January 2008 11:53 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi Rüdiger,

Thanks for your example.

> The client-side WidgetManager can be used like this:
> var wm = org.eclipse.swt.WidgetManager.getInstance()
> // obtain reference to qooxdoo widget
> var widget = wm.findWidgetById( "<my-widget-id>" );
> // obtain id for widget
> var widgetId = wm.findIdByWidget( widget );

I put your example above in my Selenium's user-extension.js :

Selenium.prototype.getWidgetExists = function(locator)
{
var wm = org.eclipse.swt.WidgetManager.getInstance();
// obtain reference to qooxdoo widget
var widget = wm.findWidgetById(locator);
// obtain id for widget
var widgetId = wm.findIdByWidget( widget );

return widget != null;
}

but Selenium always throws message 'org is not defined'.

It seems that Selenium is unable to find WidgetManager.

Regards,

Setya
Re: Asserting component enability [message #68780 is a reply to message #68759] Thu, 03 January 2008 12:22 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi,

I've got it working.

I got example from :

http://forums.openqa.org/thread.jspa?messageID=31862&#31 862

Here's my new code:

Selenium.prototype.getWidgetExists = function(locator)
{
var wm =
this.browserbot.getCurrentWindow().org.eclipse.swt.WidgetMan ager.getInstance();
// obtain reference to qooxdoo widget
var widget = wm.findWidgetById(locator);
// obtain id for widget
var widgetId = wm.findIdByWidget( widget );

return widget != null;
}

Thanks & Regards,

Setya
Re: Asserting component enability [message #69289 is a reply to message #68698] Wed, 09 January 2008 03:24 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Rüdiger,

> If UI tests are enabled, RAP assigns the widget-id to the outermost DOM
> element that represents the widget on the client-side.

Given your explanation above, is it possible to assign id to children
widgets ? For instance, for Table widget I'd like to assign id to each
TableItem, this way I can use their id's instead of XPath to tell Selenium
to click the rendered element.

Regards,

Setya
Re: Asserting component enability [message #69522 is a reply to message #69289] Wed, 09 January 2008 18:26 Go to previous message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Setya,

as said, the current implementation only assigns an id to the outermost
DOM element.
Regarding the Table, TableItems are not directly represented by DOM
elements. This was done for performance reasons. Tests showed that even
a table with only 80-90 items, and each item having its own DOM element,
became almost unusable. Therefore, currently, the client-side TableItem
is only a data object that is rendered inside the Tables client area as
soon as it becomes visible.

Cheers,
Rüdiger

Setya wrote:
> Rüdiger,
>
>> If UI tests are enabled, RAP assigns the widget-id to the outermost
>> DOM element that represents the widget on the client-side.
>
> Given your explanation above, is it possible to assign id to children
> widgets ? For instance, for Table widget I'd like to assign id to each
> TableItem, this way I can use their id's instead of XPath to tell
> Selenium to click the rendered element.
>
> Regards,
>
> Setya
>
Previous Topic:Some questions about RAP limitations
Next Topic:Unable to create perspective
Goto Forum:
  


Current Time: Sat Apr 27 01:21:27 GMT 2024

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

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

Back to the top