Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsBrowse For Folder dialog
https://www.eclipse.org/forums/index.php/mv/msg/11192/34772/#msg_34772
with it.
I'm having trouble with the Browse For Folder dialog.
It's found at:
Window->Preferences->Plug-in Development->Target Platform->Browse...
Below is part of the code I use to get to said dialog:
bot.menu("Window").menu("Preferences").click();
SWTBotTree preferencesSelectionTree = bot.tree();
preferencesSelectionTree.expandNode("Plug-in Development").select("Target
Platform");
bot.button("Browse...").click();
// Having trouble with below line
bot.textWithLabel("Folder:").setText("");
I tried using SpyView for this dialog but it doesn't spy it (I'm guessing
since it's a system dialog?)
Does anyone know the best way to find out how to focus on the Folder: text
field?
Much Appreciated,
Derek]]>Derek 2009-05-07T14:00:44-00:00Re: Browse For Folder dialog
https://www.eclipse.org/forums/index.php/mv/msg/11192/34805/#msg_34805
SWTBot offers no support.
Kay]]>Kay-Uwe Graw2009-05-07T14:12:44-00:00Re: Browse For Folder dialog
https://www.eclipse.org/forums/index.php/mv/msg/11192/34839/#msg_34839
Thanks for response :)]]>Derek 2009-05-07T14:47:56-00:00Re: Browse For Folder dialog
https://www.eclipse.org/forums/index.php/mv/msg/11192/34996/#msg_34996
class FolderDialog{
// return a 'special' value in test mode.
String open(){
if (System.getProperty('isTest').equals('true'))
return System.getProperty('folderDialogValue');
else
return new org.eclipse...FolderDialog(shell, flags).open()
}
}
This folder dialog is now a drop in replacement for swt's folder dialog.
To drive this from the swtbot tests:
@BeforeClass
public void beforeClass(){
System.setProperty('isTest');
}
...
@Test
public void test(){
System.setProperty('folderDialogValue', '/path/to/my/folder');
bot.button('browse').click(); // the mock dialog will now return the
folder above :)
}
-- Ketan
Derek wrote:
> I'm still fairly new to SWTBot, but so far it's been quite fun working
> with it.
> I'm having trouble with the Browse For Folder dialog.
> It's found at:
> Window->Preferences->Plug-in Development->Target Platform->Browse...
> Below is part of the code I use to get to said dialog:
> bot.menu("Window").menu("Preferences").click();
> SWTBotTree preferencesSelectionTree = bot.tree();
> preferencesSelectionTree.expandNode("Plug-in Development").select("Target
> Platform");
> bot.button("Browse...").click();
> // Having trouble with below line
> bot.textWithLabel("Folder:").setText("");
> I tried using SpyView for this dialog but it doesn't spy it (I'm guessing
> since it's a system dialog?)
> Does anyone know the best way to find out how to focus on the Folder: text
> field?
> Much Appreciated,
> Derek]]>Ketan Padegaonkar2009-05-08T03:07:34-00:00Re: Browse For Folder dialog
https://www.eclipse.org/forums/index.php/mv/msg/11192/490267/#msg_490267
> I suppose you just need the FolderDialog to 'return' a specific value:
>
> class FolderDialog{
>
> FolderDialog(Shell parent, int flags){
> this.shell = shell;
> this.flags = flags;
> }
>
> // return a 'special' value in test mode.
> String open(){
> if (System.getProperty('isTest').equals('true'))
> return System.getProperty('folderDialogValue');
> else
> return new org.eclipse...FolderDialog(shell, flags).open()
> }
> }
>
> This folder dialog is now a drop in replacement for swt's folder dialog.
> To drive this from the swtbot tests:
>
> @BeforeClass
> public void beforeClass(){
> System.setProperty('isTest');
> }
> ..
>
> @Test
> public void test(){
> System.setProperty('folderDialogValue', '/path/to/my/folder');
> bot.button('browse').click(); // the mock dialog will now return the
> folder above :)
> }
>
> -- Ketan
>
>
> Derek wrote:
>
>> I'm still fairly new to SWTBot, but so far it's been quite fun working
>> with it.
>> I'm having trouble with the Browse For Folder dialog.
>> It's found at:
>> Window->Preferences->Plug-in Development->Target Platform->Browse...
>
>> Below is part of the code I use to get to said dialog:
>
>> bot.menu("Window").menu("Preferences").click();
>> SWTBotTree preferencesSelectionTree = bot.tree();
>> preferencesSelectionTree.expandNode("Plug-in
>> Development").select("Target Platform");
>> bot.button("Browse...").click();
>> // Having trouble with below line
>> bot.textWithLabel("Folder:").setText("");
>
>
>> I tried using SpyView for this dialog but it doesn't spy it (I'm
>> guessing since it's a system dialog?)
>
>> Does anyone know the best way to find out how to focus on the Folder:
>> text field?
>
>
>
>> Much Appreciated,
>
>> Derek
>
I think its unnecessary to test the native dialogs, they just return
some value that I know before my test case runs. So one can use this
value to call text.setText("") directly and if you have some actions
which have to be performed after setting the text, just use the
ModifyListener on your Text widget.