Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Unable to change perspective using SWTbot and Juno
Unable to change perspective using SWTbot and Juno [message #962777] Mon, 29 October 2012 10:19 Go to next message
Anitha Mising name is currently offline Anitha Mising nameFriend
Messages: 28
Registered: February 2010
Junior Member
I have a huge set of test cases developed on Eclipse Indigo whose first constraint is to change the Eclipse perspective. Below is the code for the same.

SWTBotView view = bot.viewByTitle("Welcome");
if (view.isActive()) {
view.close();
}

// Change the perspective via the Open Perspective dialog
bot.menu("Window").menu("Open Perspective").menu("Other...").click();
SWTBotShell shell = bot.shell("Open Perspective");
shell.activate();

However the test case when running on Eclipse Juno (4.2) fails with the following error:

org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException: Could not find widget.
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetAppears(SWTBotFactory.java:348)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.menu(SWTBotFactory.java:257)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.menu(SWTBotFactory.java:208)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.menu(SWTBotFactory.java:198)
at ... 41 more

The exact line is while it is trying to access the menu. Do let me know if there is any change i need to make, to make the test case work for Juno.

Thanks in advance.
Re: Unable to change perspective using SWTbot and Juno [message #967339 is a reply to message #962777] Thu, 01 November 2012 17:44 Go to previous messageGo to next message
A. Ganser is currently offline A. GanserFriend
Messages: 1
Registered: July 2009
Junior Member
Guess, this won't make you happy: https://bugs.eclipse.org/bugs/show_bug.cgi?id=385527

How about this: you use the perspective ID? E.g. for opening resource perspective you try :
bot.perspectiveById("org.eclipse.ui.resourcePerspective").activate();
Or a bit nicer:
SWTBotPerspective botPerspective = bot
.perspectiveById("org.eclipse.ui.resourcePerspective");
assertNotNull(botPerspective);
botPerspective.activate();
Re: Unable to change perspective using SWTbot and Juno [message #975999 is a reply to message #967339] Thu, 08 November 2012 08:33 Go to previous messageGo to next message
Anitha Mising name is currently offline Anitha Mising nameFriend
Messages: 28
Registered: February 2010
Junior Member
Thanks. The fix you suggested worked.
Re: Unable to change perspective using SWTbot and Juno [message #981363 is a reply to message #962777] Mon, 12 November 2012 11:00 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

On 10/29/2012 11:19 AM, Anitha Mising name wrote:
> The exact line is while it is trying to access the menu. Do let me know
> if there is any change i need to make, to make the test case work for Juno.

Which menu?
Is this menu actually here? Eclipse 4.2 has some refactoring in the
Welcome menu IIRC, so maybe you're simply missing the plugin responsible
of displaying it.

Do you use Linux? Do you have a working window manager on the DISPLAY
you're using? I saw some issues like this one before because of usage of
twm or other bad window managers...
--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Re: Unable to change perspective using SWTbot and Juno [message #981369 is a reply to message #967339] Mon, 12 November 2012 11:03 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

On 11/01/2012 07:05 PM, A. Ganser wrote:
> Guess, this won't make you happy:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=385527

This issue with perspectives has not been reported so far. So please
report it as precisely as you can if you think it's a bug because of
Eclipse 4.2.
--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Re: Unable to change perspective using SWTbot and Juno [message #987816 is a reply to message #981363] Wed, 28 November 2012 09:31 Go to previous messageGo to next message
Anitha Mising name is currently offline Anitha Mising nameFriend
Messages: 28
Registered: February 2010
Junior Member
> On 10/29/2012 11:19 AM, Anitha Mising name wrote:
>> The exact line is while it is trying to access the menu. Do let me know
>> if there is any change i need to make, to make the test case work for Juno.

> Which menu?
It's the basic Windows menu that is used to access perspectives as in the case of code below. This menu comes with Eclipse Juno 4.2.
bot.menu("Window")

> Is this menu actually here? Eclipse 4.2 has some refactoring in the
> Welcome menu IIRC, so maybe you're simply missing the plugin responsible
> of displaying it.
All the plugins are available.

> Do you use Linux? Do you have a working window manager on the DISPLAY
> you're using? I saw some issues like this one before because of usage of
> twm or other bad window managers...

No, i am Windows user. Also i found hitting this issue again when i tried to create some projects and build using 'Build All' option. I am unable to access the menu 'Project'.
bot.menu("Project").menu("Build All").click();
Even this throws the same WidgetNotFoundException.

[Updated on: Wed, 28 November 2012 09:33]

Report message to a moderator

Re: Unable to change perspective using SWTbot and Juno [message #988819 is a reply to message #987816] Mon, 03 December 2012 10:45 Go to previous message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

On 11/28/2012 10:31 AM, Anitha Y wrote:
> bot.menu("Window")
> bot.menu("Project").menu("Build All").click();
> Even this throws the same WidgetNotFoundException.

Are you sure those menus are actually present in your test environment.
If you start the IDE with the exact same plugins as in tests, but
without running SWTBot, can you see them?

--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Previous Topic:Accessing the menu of a palette tool that creates more than one figure
Next Topic:Widgets on CTabItem
Goto Forum:
  


Current Time: Fri Mar 29 09:23:42 GMT 2024

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

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

Back to the top