Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Clicking Source, Design tabs for XML files(Clicking Source, Design tabs for XML files)
Clicking Source, Design tabs for XML files [message #1111030] Tue, 17 September 2013 13:12 Go to next message
John Stashkevetch is currently offline John Stashkevetch
Messages: 1
Registered: September 2013
Junior Member
Hello,

I've been trying to find a way to get a handle on the 'Source' and 'Design' tabs in the active editor.

SWTBot test recorder does not seem to be aware of this behavior and I haven't been able to find any information about this.

Does anyone have an idea whether this behavior is automatable?

Thanks!
Re: Clicking Source, Design tabs for XML files [message #1111472 is a reply to message #1111030] Wed, 18 September 2013 05:05 Go to previous messageGo to next message
Benjamin Ratiarisolo is currently offline Benjamin Ratiarisolo
Messages: 14
Registered: January 2010
Location: Paris, France
Junior Member
Hi John,

You could try something like:

   // ...
   SWTWorkbenchBot bot = ...;
   Matcher<IEditorReference> withPartName = withPartName("test.xml");
   WaitForEditor waitForEditor = waitForEditor(withPartName);
   bot.waitUntilWidgetAppears(waitForEditor);
   SWTBotMultiPageEditor swtBotEditor = new SWTBotMultiPageEditor(waitForEditor.get(0), bot);
   SWTBotCTabItem swtBotCTabItem = editor.activatePage("Source");
   // Now your 'Source' editor tab should have the focus
   // You should be able to test its content as usual
   // ...


I test quite a lot of multi-page editors with a similar code.

Cheers,


--
Benjamin Ratiarisolo
IBM ODM Decision Server Rules - Software Developer
IBM Software - France Lab
Re: Clicking Source, Design tabs for XML files [message #1111476 is a reply to message #1111030] Wed, 18 September 2013 05:05 Go to previous message
Mickael Istria is currently offline Mickael Istria
Messages: 745
Registered: July 2009
Location: Grenoble, France
Senior Member
I'm not 100% sure, but it seems to me that a tabbed editor is actually a
single editor which contains a CTabFolder (or a TabFolder) as primary
widget.

So something like this should work:
SWTBotEditor editor = bot.editor("test.xml");
editor.show();
editor.setFocus();
editor.cTabItem("Source").click();
// Or editor.tabItem("Source").click();

The generator is still young and misses some rule to support several
widgets, including TabItem and CTabItem. Feel free to contribute them as
explained in
http://wiki.eclipse.org/SWTBot/Recorder#Adding_and_contributing_a_rule .
It's not difficult to add a rule and contribute, so don't hesitate !
--
Mickael Istria
My job: http://www.jboss.org/tools
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Previous Topic:Finding difficult to select an context menu
Next Topic:hanging on new SWTWorkbenchBot()
Goto Forum:
  


Current Time: Thu Aug 28 21:37:55 EDT 2014

Powered by FUDForum. Page generated in 0.01550 seconds