Skip to content

Instantly share code, notes, and snippets.

@DinisCruz
Created October 23, 2013 10:06
Show Gist options
  • Select an option

  • Save DinisCruz/7115920 to your computer and use it in GitHub Desktop.

Select an option

Save DinisCruz/7115920 to your computer and use it in GitHub Desktop.
23rd Oct 2013 - more SWTBot Groovy scripts
import org.eclipse.swtbot.eclipse.finder.*;
import org.eclipse.swtbot.swt.finder.utils.*
Thread.start
{
SWTBotPreferences.TIMEOUT = 100;
try
{
def bot = new SWTWorkbenchBot();
//def pathToProjectToOpen = "/Users/zen/Fortify-Plugin/Eclipses/workspaces/test_proj";
def pathToProjectToOpen = "/Users/zen/Fortify-Plugin/TeamMentor_Eclipse_Plugin";
def importMenu = bot.menu("File").menu("Import...");
importMenu.click();
def shell = bot.shell("Import");
shell.activate();
bot.tree().expandNode("General").select("Existing Projects into Workspace");
bot.button("Next >").click();
bot.radio("Select root directory:").click();
bot.text(0).setText(pathToProjectToOpen);
eclipseApi.log("before checking tree");
def tree = bot.tree();
eclipseApi.log("before checking tree");
tree.setFocus();
def allItems = tree.allItems;
assert allItems.size() == 3
assert allItems[1].text.startsWith("TeamMentor.Eclipse.PlugIn.Fortify");
assert allItems[2].text.startsWith("TeamMentor.Feature");
assert bot.button("Finish").enabled
shell.close();
//inspect(tree.allItems[1]);
//eclipseApi.log("after: " + tree);
//inspect(bot.button("Finish"));
//bot.button("Finish").click();
}
catch(Exception ex)
{
eclipseApi.log("ex: " + ex.getMessage());
}
};
return "done";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment