ui.contextClick problem

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

ui.contextClick problem

Postby anaderol » Wed Nov 17, 2010 11:45 pm

Hello.
I have a problem with the contextClick() command.
If record a test using WindowTester and then I playback that test sometimes it works like it should and sometimes I get the following message:

SWTShowMenuOperation waiting for idle 1
SWTShowMenuOperation waiting for idle 2
SWTShowMenuOperation waiting for idle 3
SWTShowMenuOperation waiting for idle 4
SWTShowMenuOperation waiting for idle 5
................................................
SWTShowMenuOperation waiting for idle 400
SWTShowMenuOperation waiting for idle 401
Failed to select menu item
menu item path: New/File
exception: com.windowtester.runtime.swt.internal.widgets.SWTUIException: Exception occurred on the SWT UI Thread
attempt 1 of 3

Can someone help me, please?
Thank you.
anaderol
 
Posts: 8
Joined: Mon Nov 15, 2010 6:22 am

Re: ui.contextClick problem

Postby keertip » Thu Nov 18, 2010 9:26 am

What type of application are you running - SWT, Eclipse or RCP? Are you running your tests as a JUnit or JUnit plugin test?
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am

Re: ui.contextClick problem

Postby anaderol » Thu Nov 18, 2010 9:45 am

The application is RCP and I'm running my test as a JUnit plugin test.
anaderol
 
Posts: 8
Joined: Mon Nov 15, 2010 6:22 am

Re: ui.contextClick problem

Postby keertip » Fri Nov 19, 2010 8:23 am

Could you post a screen shot at the time of failure and the test code - at least where is fails and before/after. That would be helpful.
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am

Re: ui.contextClick problem

Postby anaderol » Fri Nov 26, 2010 1:46 am

Hi. Sorry for my delay.

My test is:
public class DeleteFunctionTest extends UITestCaseSWT
{
protected void setUp() throws Exception
{
super.setUp();
IUIContext ui = getUI();
ui.ensureThat(new WorkbenchLocator().hasFocus());
ui.ensureThat(ViewLocator.forName("Welcome").isClosed());
}

public void testDeleteFunction throws Exception
{
IUIContext ui = getUI();
ui.click(2, new TreeItemLocator("Hello World C Project Function", new ViewLocator(
"org.eclipse.ui.navigator.ProjectExplorer")));
ui.click(2, new TreeItemLocator("Hello World C Project Function/src", new ViewLocator(
"org.eclipse.ui.navigator.ProjectExplorer")));
ui.click(2, new TreeItemLocator("Hello World C Project Function/src/Hello World22.c",
new ViewLocator("org.eclipse.ui.navigator.ProjectExplorer")));
ui.click(new TreeItemLocator("int main(void) ", new ViewLocator(
"org.eclipse.ui.views.ContentOutline")));
ui.contextClick(new TreeItemLocator("int main(void) ", new ViewLocator(
"org.eclipse.ui.views.ContentOutline")), "Create contraction");
}
}

When it gets to line ui.contextClick(new TreeItemLocator("int main(void) ", new ViewLocator(
"org.eclipse.ui.views.ContentOutline")), "Create contraction");
the mouse remains blocked on the element clicked and this message is displayed in eclipse console:

SWTShowMenuOperation waiting for idle 1
SWTShowMenuOperation waiting for idle 2
SWTShowMenuOperation waiting for idle 3
SWTShowMenuOperation waiting for idle 4
SWTShowMenuOperation waiting for idle 5
................................................
SWTShowMenuOperation waiting for idle 400
SWTShowMenuOperation waiting for idle 401
Failed to select menu item
menu item path: Create contraction
exception: com.windowtester.runtime.swt.internal.widgets.SWTUIException: Exception occurred on the SWT UI Thread
attempt 1 of 3
anaderol
 
Posts: 8
Joined: Mon Nov 15, 2010 6:22 am

Re: ui.contextClick problem

Postby keertip » Wed Dec 01, 2010 9:43 am

We do not see this problem at our end. The test code is a bit different since this is java project and not c, but we are able to do context click in the outline view.

Code: Select all
      ui.click(2, new TreeItemLocator("HelloWorld", new ViewLocator(
           "org.eclipse.jdt.ui.PackageExplorer")));
      ui.click(2, new TreeItemLocator("HelloWorld/src", new ViewLocator(
           "org.eclipse.jdt.ui.PackageExplorer")));
      ui.click(2, new TreeItemLocator("HelloWorld/src/(default package)/HelloWorld.java",
            new ViewLocator("org.eclipse.jdt.ui.PackageExplorer")));
      ui.click(new TreeItemLocator("HelloWorld/main(String[]) : void",
            new ViewLocator("org.eclipse.ui.views.ContentOutline")));
      ui.contextClick(new TreeItemLocator("HelloWorld/main(String[]) : void",
            new ViewLocator("org.eclipse.ui.views.ContentOutline")),
            "Open Type Hierarchy");


Could you try a different menu item in the context click and see if that works?
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am

Re: ui.contextClick problem

Postby anaderol » Thu Dec 02, 2010 11:06 pm

I tried, but I get the same message.
If I click outside the window of the application when this message appears "SWTShowMenuOperation waiting for idle 1...." and then return to it, and press SHIFT + F10 on that item to display the context menu, sometimes the test passes.The problem is that the context menu does not appears but window tester tries to click on it.
I forget to say that context menu worked before adding GEF package.
anaderol
 
Posts: 8
Joined: Mon Nov 15, 2010 6:22 am

Re: ui.contextClick problem

Postby keertip » Fri Dec 03, 2010 9:24 am

"I forget to say that context menu worked before adding GEF package."

Could you elaborate on this? Does your application use GEF?
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am

Re: ui.contextClick problem

Postby anaderol » Sun Dec 05, 2010 10:26 pm

Yes. For example when I click on an Palette Item window tester generates the following class :
Code: Select all
private static class FlowPageLocator extends FigureClassLocator
   {
      private static final long serialVersionUID = 1L;

      public FlowPageLocator()
      {
         super("org.eclipse.draw2d.text.FlowPage");
      }
   }


and then calls it like this:
Code: Select all
ui.click(new LRLocator(1, new FlowPageLocator()));


There is a list with more than one Palette Items and I clicked the first one in this example.
Sometimes the class is not generated but it is called in the test.
I tried to use com.windowtester.runtime.gef.locator Class PaletteItemLocator, but I got WIDGET NOT FOUND exception.
anaderol
 
Posts: 8
Joined: Mon Nov 15, 2010 6:22 am

Re: ui.contextClick problem

Postby keertip » Mon Dec 06, 2010 8:46 am

Back to the context click problem, was the context click in outline view working before you added gef support?
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am

Re: ui.contextClick problem

Postby anaderol » Tue Dec 07, 2010 3:58 am

Yes.
anaderol
 
Posts: 8
Joined: Mon Nov 15, 2010 6:22 am

Re: ui.contextClick problem

Postby keertip » Wed Dec 08, 2010 8:20 am

Could you recreate this problem by removing the gef dependency and then adding it? Also, do post these steps so that we can recreate it at our end.
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am

Re: ui.contextClick problem

Postby anaderol » Mon Dec 13, 2010 2:41 am

Hi.
Apparently was an installation problem. Now it is working like it should, even after GEF installation.
Thank you very much.
anaderol
 
Posts: 8
Joined: Mon Nov 15, 2010 6:22 am

Re: ui.contextClick problem

Postby keertip » Mon Dec 13, 2010 8:31 am

Great! Glad that the issue is solved!
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest

cron