use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView in project linuxtools by eclipse.
the class TestCreateSystemtapScript method testTapsetContents.
@Test
public void testTapsetContents() {
// Create a blank script and add a function to it while it's open.
String scriptName = "probeScript.stp";
createScript(bot, scriptName);
SWTBotView funcView = bot.viewByTitle("Function");
funcView.setFocus();
SWTBotTree funcTree = funcView.bot().tree();
SWTBotTreeItem item = funcTree.getTreeItem(funcNodeName);
item.doubleClick();
SWTBotEclipseEditor editor = bot.activeEditor().toTextEditor();
assertTrue(editor.getText().contains(item.getText()));
// Open a non-stap file and add a probe. This should bring up a dialog
// asking if the function should be added to the only open .stp file.
clickMainMenu("File", "New", "Other...");
SWTBotShell shell = bot.shell("New");
shell.setFocus();
shell.bot().text().setText("Untitled Text File");
bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "General", "Untitled Text File"));
bot.button("Finish").click();
bot.waitUntil(Conditions.shellCloses(shell));
SWTBotView probeView = bot.viewByTitle("Probe Alias");
probeView.setFocus();
SWTBotTree probeTree = probeView.bot().tree();
SWTBotTreeItem probeCategory = probeTree.getTreeItem(probeCategoryFull);
probeCategory.expand();
bot.waitUntil(new TreeItemPopulated(probeCategory));
String dialogTitle = "Select Script";
item = probeCategory.getNode(probeGroup);
item.expand();
bot.waitUntil(new TreeItemPopulated(item));
item = item.getNode(0);
item.doubleClick();
{
Matcher<Shell> withText = withText(dialogTitle);
bot.waitUntil(Conditions.waitForShell(withText));
}
shell = bot.shell(dialogTitle);
shell.setFocus();
bot.button("Yes").click();
bot.waitUntil(Conditions.shellCloses(shell));
// The editor containing the script should now be in focus.
bot.waitUntil(new EditorIsActive(scriptName));
assertTrue(wasProbeInserted(editor, item, false));
// Open the probe's definition file (an .stp script).
probeView.show();
item.contextMenu("View Definition").click();
bot.waitUntil(new EditorIsActive(probeDef.getName()));
// Adding a probe while an .stp editor is in focus should always add it
// to that editor, even if multiple .stp editors are open.
item = probeCategory.getNode(probeGroup);
item.doubleClick();
assertTrue(wasProbeInserted(bot.activeEditor().toTextEditor(), item, true));
assertFalse(wasProbeInserted(editor, item, true));
// Switch to the non-stp editor, and add a probe. A dialog should appear
// to let the user choose which of the open files to add to.
editor = bot.editorByTitle("Untitled 1").toTextEditor();
editor.show();
item = probeCategory.getNode(probeSingleWithoutDef);
item.doubleClick();
shell = bot.shell(dialogTitle);
shell.setFocus();
SWTBotTable table = bot.table();
assertTrue(table.containsItem(scriptName));
assertTrue(table.containsItem(probeDef.getName()));
table.select(scriptName);
bot.button("OK").click();
bot.waitUntil(Conditions.shellCloses(shell));
bot.waitUntil(new EditorIsActive(scriptName));
assertTrue(wasProbeInserted(bot.activeEditor().toTextEditor(), item, false));
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView in project linuxtools by eclipse.
the class ProjectExplorer method getTree.
/**
* Assumes Project Explorer view is shown.
*
* @return The tree of the Project Explorer view
*/
public static SWTBotTree getTree() {
SWTBotView projectExplorer = bot.viewByTitle("Project Explorer");
projectExplorer.show();
Composite projectExplorerComposite = (Composite) projectExplorer.getWidget();
Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), projectExplorerComposite);
return new SWTBotTree(swtTree);
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView in project liferay-ide by liferay.
the class ViewVisibleCondition method _getView.
private SWTBotView _getView() {
long oldTimeOut = SWTBotPreferences.TIMEOUT;
SWTBotPreferences.TIMEOUT = 1000;
SWTBotView view = null;
try {
if (_id) {
view = _bot.viewById(_identifier);
} else {
view = _bot.viewByTitle(_identifier);
}
} catch (WidgetNotFoundException wnfe) {
} finally {
SWTBotPreferences.TIMEOUT = oldTimeOut;
}
return view;
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView in project syncope by apache.
the class SyncopeViewTest method canOpenLoginDialog.
@Test
public void canOpenLoginDialog() throws Exception {
SWTBotView view = BOT.viewByTitle("Apache Syncope Templates");
view.getToolbarButtons().get(0).click();
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView in project egit by eclipse.
the class GitRepositoriesViewBranchHandlingTest method testCreateDeleteLocalBranchWithUnmerged.
@Test
public void testCreateDeleteLocalBranchWithUnmerged() throws Exception {
final SWTBotView view = getOrOpenView();
SWTBotTreeItem localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(), repositoryFile);
TestUtil.expandAndWait(localItem);
assertEquals("Wrong number of children", 1, localItem.getNodes().size());
assertEquals("master", localItem.getNodes().get(0));
localItem.getNode(0).select();
ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil.getPluginLocalizedValue("CreateBranchCommand"));
SWTBotShell createPage = bot.shell(UIText.CreateBranchWizard_NewBranchTitle);
createPage.activate();
// getting text with label doesn't work
createPage.bot().textWithId("BranchName").setText("newLocal");
createPage.bot().checkBox(UIText.CreateBranchPage_CheckoutButton).select();
createPage.bot().button(IDialogConstants.FINISH_LABEL).click();
TestUtil.joinJobs(JobFamilies.CHECKOUT);
refreshAndWait();
localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(), repositoryFile);
TestUtil.expandAndWait(localItem);
assertEquals("Wrong number of children", 2, localItem.getNodes().size());
touchAndSubmit("Some more changes");
localItem.getNode(1).select();
assertCheckoutNotAvailable(view);
localItem.getNode(0).select();
ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil.getPluginLocalizedValue("CheckoutCommand"));
TestUtil.joinJobs(JobFamilies.CHECKOUT);
refreshAndWait();
localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(), repositoryFile);
localItem.getNode(1).select();
ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil.getPluginLocalizedValue("RepoViewDeleteBranch.label"));
SWTBotShell confirmPopup = bot.shell(UIText.UnmergedBranchDialog_Title);
confirmPopup.activate();
confirmPopup.bot().button(UIText.UnmergedBranchDialog_deleteButtonLabel).click();
refreshAndWait();
localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(), repositoryFile);
TestUtil.expandAndWait(localItem);
assertEquals("Wrong number of children", 1, localItem.getNodes().size());
}
Aggregations