Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » ShellIsActive wait condition
ShellIsActive wait condition [message #508312] Mon, 18 January 2010 11:37 Go to next message
Mika Viljanen is currently offline Mika Viljanen
Messages: 2
Registered: January 2010
Junior Member
Hi,

I have a situation where I have a main program window and certain operations open dialog windows that users should close manually by clicking a "Finish" or "Close" button. I'm using SWTBot to test opening and closing a dialog several times in a row. The action that opens the dialog is started by clicking a menu item in the main window, and the dialog is closed by clicking a button. But currently I run into the problem of still having the dialog open when the test tries to click a menu item in the main window again.

I have this wait condition in the code where I open the dialog:
bot.waitUntil(Conditions.shellIsActive("Main Window"));

However, checking the active shell before and after this row shows that sometimes the dialog is still open when advancing from this.

I checked the implementation of the ShellIsActive condition class and its test method return the value as follows:
return shell.widget.isVisible() || shell.widget.isFocusControl();

I noticed that this test returns values that are not consistent with the results of the method call
shell.isActive()

Is this how it should be or is there a bug in the condition test? I tried writing my own condition class with the test returning the value of "shell.isActive()" and it worked exactly like I thought ShellIsActive would work.

So, should ShellIsActive condition pass when activeShell() returns the shell that is checked in the condition test? Because now it doesn't seem to do so... Or is my case special in some sense? I guess I might be doing something weird in my code.

(If there are posts about the issue or a bug report already, feel free to point me to one. I couldn't find one by searching.)

BR,
Mika V.
Re: ShellIsActive wait condition [message #508357 is a reply to message #508312] Mon, 18 January 2010 14:39 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
Mika Viljanen wrote:
> Hi,
>
> I have a situation where I have a main program window and certain
> operations open dialog windows that users should close manually by
> clicking a "Finish" or "Close" button. I'm using SWTBot to test opening
> and closing a dialog several times in a row. The action that opens the
> dialog is started by clicking a menu item in the main window, and the
> dialog is closed by clicking a button. But currently I run into the
> problem of still having the dialog open when the test tries to click a
> menu item in the main window again.
>
> I have this wait condition in the code where I open the dialog:
> bot.waitUntil(Conditions.shellIsActive("Main Window"));

You could also use the shellCloses condition:
bot.waitUntil(Conditions.shellCloses(shell));

where shell is the previously open shell.

Hope this helps.
--
Pascal GĂ©linas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: ShellIsActive wait condition [message #508403 is a reply to message #508357] Mon, 18 January 2010 16:32 Go to previous message
Mika Viljanen is currently offline Mika Viljanen
Messages: 2
Registered: January 2010
Junior Member
Quote:
You could also use the shellCloses condition:
bot.waitUntil(Conditions.shellCloses(shell));

where shell is the previously open shell.

Hope this helps.

Thanks for the tip!

I actually open the dialog in several test classes (in different situations) and have it in a separate utility class method. I had planned to include the waiting condition there also but might put that in the calling end and add your suggested wait clause there.

BR,
Mika V.

[Updated on: Mon, 18 January 2010 16:33]

Report message to a moderator

Previous Topic:Combination of SWTBot und TPTP
Next Topic:Getting Teststeps from swtbot
Goto Forum:
  


Current Time: Sat Oct 25 08:57:47 GMT 2014

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

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