Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » TabbedPropertyList
TabbedPropertyList [message #27294] Thu, 12 March 2009 17:48 Go to next message
Bhooshan Mogal is currently offline Bhooshan MogalFriend
Messages: 16
Registered: July 2009
Junior Member
Hi all,

I am using SWTBot to automate the GUI testing for one of our eclipse-based
products. So far it has been working fine. But I am not able to recognize
a TabbedPropertyList. It is similar to the Tabbed Property List that can
be seen in the properties view in eclipse sometimes.

Can anybody help me write some code to identify this widget?

The Property Tabs in my case show up in the interactive editor view in
eclipse.

Thanks,
Bhooshan
Re: TabbedPropertyList [message #27750 is a reply to message #27294] Thu, 12 March 2009 19:35 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Bhooshan,

You could look at how SWTBotButton is implemented for a very simple example.

I've not seen how Tabbed Property Lists are implemented, but I feel it's
probably similar to SWTBotTabItem.

Someone on the list would be able to help you better if you're willing
to contribute a patch back.

-- Ketan

On 12/3/09 23:18, Bhooshan Mogal wrote:
> Hi all,
>
> I am using SWTBot to automate the GUI testing for one of our
> eclipse-based products. So far it has been working fine. But I am not
> able to recognize a TabbedPropertyList. It is similar to the Tabbed
> Property List that can be seen in the properties view in eclipse sometimes.
> Can anybody help me write some code to identify this widget?
>
> The Property Tabs in my case show up in the interactive editor view in
> eclipse.
>
> Thanks,
> Bhooshan
>
Re: TabbedPropertyList [message #27810 is a reply to message #27750] Thu, 12 March 2009 23:20 Go to previous messageGo to next message
Bhooshan Mogal is currently offline Bhooshan MogalFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Ketan,

Thanks a lot for your reply. I would definitely like any more help that I
could get to create a custom swtbot widget. I would be more than willing
to supply the code if I can get it to work.
I had one more question regarding this...
If I make a custom widget that is not supported by swtbot, what are the
steps to make a class that can find the widget and click on it?
Once I know this, I can start producing classes for objects that I dont
see support for, like the Tabbed Property List.

Again, I would love to contribute to swtbot.

Thanks,
Bhooshan.
Re: TabbedPropertyList [message #27928 is a reply to message #27810] Tue, 17 March 2009 00:06 Go to previous messageGo to next message
Bhooshan Mogal is currently offline Bhooshan MogalFriend
Messages: 16
Registered: July 2009
Junior Member
Hi all,

So, I am still trying to get at the custom widgets inside my eclipse
editor. There is also a text box within the tabs I am trying to access
(screen shot here:
http://i661.photobucket.com/albums/uu338/bhustya123/editor.j pg). My logic
was that if I can access the textbox, then I can ask the widget for its
parent, then from the parent, be able to get all the children (including
the tab widgets).

Here was my code:

SWTBotText t = bot.textWithLabel("Database name:");
Text tt = t.widget;
Composite c = tt.getParent();

However, I can't get at the composite object because of a strange
exception "*wrong thread*" please see screenshot:
http://i661.photobucket.com/albums/uu338/bhustya123/wrongthr ead.jpg

My ultimate goal is to create support for widgets that dont exist by
default in swtbot.. I searched for posts about this, but was not able to
get past that exception.

Thanks,
Bhooshan
Re: TabbedPropertyList [message #28393 is a reply to message #27928] Wed, 18 March 2009 01:42 Go to previous messageGo to next message
Ketan Patel is currently offline Ketan PatelFriend
Messages: 68
Registered: July 2009
Member
wrong thread is because you are trying to access SWT things outside UI
thread. You have to execute it in UI thread.

To help with property tabs, here his how you can get started:

//get the view from the bot
SWTBotView view = bot.view("Properties");
//if it can be found, then show it.
if(null != view){
view.show();
}

//get all the tabs in the properties panel
//get all
org.eclipse.ui.internal.views.properties.tabbed.view.TabbedP ropertyList.ListElement
Matcher matcher = widgetOfType(ListElement.class);
WaitForWidgetInParent waitForWidget = waitForWidget(matcher,
view.getWidget());
waitUntilWidgetAppears(waitForWidget);
//get all found elements.
List tabs = waitForWidget.getWidgets();
Re: TabbedPropertyList [message #637482 is a reply to message #28393] Fri, 05 November 2010 17:43 Go to previous message
Udo Walker is currently offline Udo WalkerFriend
Messages: 81
Registered: July 2009
Member
Hi,

I had the same problem today. I didn't know how to test a tabbed
property sheet. I tried your suggestion but did not find the methods and
classes in the latest release (2.0.0.595) so I tried myself to find a way.

I used the "EclipseSpy View" from the SWTBot SDK and I found out that
there is no way to select a tab by name. But I can select a tab by its
index.

This is my solution:

private void selectTab(int index, SWTBotView view) {
Composite parent = (Composite) view.getWidget();
ControlFinder cf = new ControlFinder();

Matcher<Composite> matcher = new
IsInstanceOf<Composite>(Composite.class);

List<Composite> findControls = cf.findControls(parent, matcher,true);
List<Composite> tabs = new ArrayList<Composite>();
for (int i = 0; i < findControls.size(); i++) {
Composite c = findControls.get(i);
String className = SWTUtils.toString(c);
if (className.startsWith("TabbedPropertyList$ListElement")) {
tabs.add(c);
}
}

Composite foundTab = tabs.get(index);
CompositeControl mw = new CompositeControl(foundTab, matcher);
mw.click();
}

private static class CompositeControl extends
AbstractSWTBotControl<Composite> {

public CompositeControl(Composite w, SelfDescribing description)
throws WidgetNotFoundException {
super(w);
}

/**
* Click on the button.
*/
public CompositeControl click() {
log.debug(MessageFormat.format("Clicking on {0}",
SWTUtils.getText(widget))); //$NON-NLS-1$
waitForEnabled();
notify(SWT.MouseEnter);
notify(SWT.MouseMove);
notify(SWT.Activate);
notify(SWT.FocusIn);
notify(SWT.MouseDown);
notify(SWT.MouseUp);
notify(SWT.Selection);
notify(SWT.MouseHover);
notify(SWT.MouseMove);
notify(SWT.MouseExit);
notify(SWT.Deactivate);
notify(SWT.FocusOut);
log.debug(MessageFormat.format("Clicked on {0}",
SWTUtils.getText(widget))); //$NON-NLS-1$
return this;
}
}

The method click() of the class CompositeControl is copied from
SWTBotButton.

I hope this helps. Should I open a bug for a feature request?

With regards,
Udo

Am 18.03.2009 02:42, schrieb Ketan Patel:
> wrong thread is because you are trying to access SWT things outside UI
> thread. You have to execute it in UI thread.
>
> To help with property tabs, here his how you can get started:
>
> //get the view from the bot
> SWTBotView view = bot.view("Properties");
> //if it can be found, then show it. if(null != view){
> view.show();
> }
>
> //get all the tabs in the properties panel //get all
> org.eclipse.ui.internal.views.properties.tabbed.view.TabbedP ropertyList.ListElement
>
> Matcher matcher = widgetOfType(ListElement.class);
> WaitForWidgetInParent waitForWidget = waitForWidget(matcher,
> view.getWidget());
> waitUntilWidgetAppears(waitForWidget);
> //get all found elements.
> List tabs = waitForWidget.getWidgets();
>
Previous Topic:Need help configuring my target platform for SWTBot
Next Topic:Help me With SWTGefEditor
Goto Forum:
  


Current Time: Fri Apr 19 00:41:21 GMT 2024

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

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

Back to the top