Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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,
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
Eclipse UserFriend
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: Tue Jul 08 17:26:46 EDT 2025

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

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

Back to the top