Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » waitUntil
waitUntil [message #473347] Wed, 05 August 2009 19:58 Go to next message
Derek  is currently offline Derek Friend
Messages: 30
Registered: July 2009
Member
Hello,

I've got tests that I've made, but I'd just been using sleeps. I know I
should use waitUntil, or something like that to wait for dialogs or views
to show first.
I just don't fully understand what conditions I provide for the check.
If anyone could give me an example, say, to wait until the Welcome view is
displayed and active before closing it, that would help me out a lot.

Below is how I have my code, I'm just wondering what do I put in the place
of "condition"?

public void testCloseWelcome() {
try {
bot.waitUntil(condition);
bot.viewByTitle("Welcome").close();
} catch (WidgetNotFoundException e) {
fail("Welcome window not found.");
}
}

Thanks,

-Derek
Re: waitUntil [message #475225 is a reply to message #473347] Wed, 05 August 2009 22:23 Go to previous messageGo to next message
Jay Norwood is currently offline Jay NorwoodFriend
Messages: 155
Registered: July 2009
Senior Member
viewByTitle already has a built-in waitUntilWidgetAppears, so you just
have to create the view, activate it with show(), close it with close().

bot.menu("Window").menu("Show View").menu("Project Explorer").click(); //
create view
bot.viewByTitle("Project Explorer").show(); // activate view
bot.viewByTitle("Project Explorer").close(); //close view
Re: waitUntil [message #475590 is a reply to message #475225] Wed, 05 August 2009 22:44 Go to previous messageGo to next message
Derek  is currently offline Derek Friend
Messages: 30
Registered: July 2009
Member
Jay Norwood wrote:

> viewByTitle already has a built-in waitUntilWidgetAppears, so you just
> have to create the view, activate it with show(), close it with close().

> bot.menu("Window").menu("Show View").menu("Project Explorer").click(); //
> create view
> bot.viewByTitle("Project Explorer").show(); // activate view
> bot.viewByTitle("Project Explorer").close(); //close view

Oh, so do most calls have a built-in waitUntilWidgetAppears? editorByTitle?

Would dialogs behave similarly though? Like to check if the Preferences
dialog has been displayed, or at the same time has the Preferences dialog
been closed?

Thanks for the explanation on viewByTitle.

-Derek
Re: waitUntil [message #476341 is a reply to message #475590] Wed, 05 August 2009 23:41 Go to previous messageGo to next message
Jay Norwood is currently offline Jay NorwoodFriend
Messages: 155
Registered: July 2009
Senior Member
Derek wrote:

> Jay Norwood wrote:

>> viewByTitle already has a built-in waitUntilWidgetAppears, so you just
>> have to create the view, activate it with show(), close it with close().

>> bot.menu("Window").menu("Show View").menu("Project Explorer").click(); //
>> create view
>> bot.viewByTitle("Project Explorer").show(); // activate view
>> bot.viewByTitle("Project Explorer").close(); //close view

> Oh, so do most calls have a built-in waitUntilWidgetAppears? editorByTitle?

No, not all are implemented yet, but it looks like that is their
intention. You can dig in viewByTitle to see how the matchers are done.

> Would dialogs behave similarly though? Like to check if the Preferences
> dialog has been displayed, or at the same time has the Preferences dialog
> been closed?

The SWTBotShell#activate() appears to have a built-in wait.

bot.menu("Window").menu("Preferences").click();
SWTBotShell prefsShell = bot.shell("Preferences");
prefsShell.activate();

or just



> Thanks for the explanation on viewByTitle.

> -Derek
Re: waitUntil [message #478750 is a reply to message #476341] Thu, 06 August 2009 16:47 Go to previous message
Derek  is currently offline Derek Friend
Messages: 30
Registered: July 2009
Member
Jay Norwood wrote:

> The SWTBotShell#activate() appears to have a built-in wait.

> bot.menu("Window").menu("Preferences").click();
> SWTBotShell prefsShell = bot.shell("Preferences");
> prefsShell.activate();

> or just


Shell. That's helpful. I'll try that out.

Thanks Jay :)

-Derek
Previous Topic:article by Ralf Ebert
Next Topic:Documentation - Javadoc, & Snippets
Goto Forum:
  


Current Time: Thu Apr 25 04:07:55 GMT 2024

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

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

Back to the top