1

I am currently writing SWTBot tests and I encountered the problem that at one point I need to wait until an operation is finished and an Info-MessageBox informs me about the completion.

This is how I currently try to do it:

   public void generateCode() {
      SWTBotTree projectExplorerTree = bot.viewByTitle("Project Explorer").bot().tree();
      projectExplorerTree.getTreeItem(name).contextMenu("Generate Code").click();

      bot.waitUntil(Conditions.shellIsActive("Info"), 20000);
      bot.button(IDialogConstants.OK_LABEL).click();
   }

This is the message box I am waiting for:

enter image description here

But I get the following exception as SWTBot fails to recognize the message box:

org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout after: 20000 ms.: The shell 'Info' did not activate
    at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:412)
    at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBotFactory.java:386)

Anyone with a solution for my problem? Thanks!

Baz
  • 36,440
  • 11
  • 68
  • 94
Ethon
  • 93
  • 2
  • 12

1 Answers1

0

Okay, for some reason the message box was created by native code and that's why SWTBot couldn't find it!

Ethon
  • 93
  • 2
  • 12
  • So what did you do about it? – Baz Jul 24 '14 at 13:32
  • I don't know the exact solution - I am just tester and developing the software itself is not my business. I told a dev that I have this problem and that I suspect the message box to be a native widget. He built a workaround which causes a dummy SWT message box displayed instead when running the SWTBot test on it. I don't exactly how to do that but that is a workable solution. – Ethon Jul 24 '14 at 19:15