MenuItemLocator unable to find shell

336 views Asked by At

I'm using WindowTester to automate testing of an Eclipse RCP application. When I try to automate menu interaction like this:

IUIContext ui = getUI();
ui.click(new MenuItemLocator("Window/Show View/My View"));

I get an exception.

com.windowtester.runtime.WidgetNotFoundException: No menubar found for active shell

The menubar exists, of course. It is created by Eclipse. I contribute to it via an extension point under org.eclipse.ui.commands.

How can I automate interaction with these menu items?

1

There are 1 answers

0
Michael Carman On BEST ANSWER

The test thread is getting ahead of the UI thread. The menubar doesn't yet exist when the MenuItemLocator looks for it. Add a delay to ensure that the application has finished initializing before starting the test.

ui.wait(new ShellLocator("Application Title").isVisible());