Cant select contextMenu from own plugin [message #42938] |
Fri, 10 July 2009 18:28 |
No real name Messages: 61 Registered: July 2009 |
Member |
|
|
Hi,
I want to test a plugin-project. This project adds a popupmenu to the
(any) src-folder.
Unfortunatly, I cant select it. My code:
@Test
public void simpleClassTest()
{
SWTBotView packExp = bot.viewByTitle("Package Explorer");
SWTBot packBot = packExp.bot();
SWTBotTree tree = packBot.tree().select("ObjTeamsProject");
SWTBotTreeItem prjTreeItem = tree.expandNode("ObjTeamsProject");
SWTBotTreeItem srcTree = prjTreeItem.select("src");
srcTree.setFocus();//test
srcTree.select();//test
srcTree.click();//test
srcTree.expand(); //test
bot.sleep(10000);
SWTBotMenu menu = srcTree.contextMenu("Obtero");
Assert.assertTrue(true);
}
The project and the src-folder exist (I use my own workspace and I dont
clean it).
The JUnit error is:
org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout after:
5000 ms.: Could not find context menu with text: Obtero at ...
Additional infos:
1)
As I watch the test perform, I can see that the project gets highlighted
(i.e. focused). But the src-folder will only get focues for a partion of a
second and then the project will be focused again.
2)
The menu-item exists. While "bot.sleep(10000)" perfoms, I right-clicked
the src-folder and saw that it is there.
3)
It works with the "normal" menu-items. I tried it with "New" or "Team".
4)
It appears to use the contextmenu of the project and not the one of the
src-folder. I get this impression because:
While "bot.sleep(10000)" perfomed, I right-clicked on the src-folder. When
"bot.sleep(10000)" finished, the standard-context-menu appeared (when
SWTBot apparently tries to find the menu-item "Obtero"). If I now
right-click on the src-folder, while SWTBot tries to find the menu-item
"Obtero", it works! So obviously SWTBot is using the wrong context item. I
am suspecting that the reason is, that I can not focus the src-folder (you
see all the "//test" commented lines where I am trying to focus it).
So is it a bug, or am I doing something wrong?
thank you
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03250 seconds