use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTree in project linuxtools by eclipse.
the class TestUtils method openRepoFile.
public static SWTBotMultiPageEditor openRepoFile(SWTWorkbenchBot bot, SWTBotView navigator) {
// open the package explorer view
SWTBotTree botTree = navigator.bot().tree();
botTree.select(ICreaterepoTestConstants.REPO_NAME).contextMenu(ICreaterepoTestConstants.OPEN).click();
// get a handle on the multipage editor that was opened
SWTBotMultiPageEditor editor = bot.multipageEditorByTitle(ICreaterepoTestConstants.REPO_NAME);
editor.show();
// 3 = repository form page, metadata form page, repo file
assertEquals(3, editor.getPageCount());
return editor;
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTree 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.swt.finder.widgets.SWTBotTree 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.swt.finder.widgets.SWTBotTree in project linuxtools by eclipse.
the class EditDockerConnectionSWTBotTest method openConnectionEditionWizard.
private void openConnectionEditionWizard(final String elementName) {
// $NON-NLS-1$
final SWTBotTreeItem connectionItem = SWTUtils.getTreeItem(dockerExplorer.bot(), elementName);
final SWTBotTree dockerExplorerViewTreeBot = dockerExplorer.bot().bot().tree();
dockerExplorerViewTreeBot.select(connectionItem);
// $NON-NLS-1$
dockerExplorerViewTreeBot.contextMenu(WizardMessages.getString("ImageRunSelectionPage.editButton")).click();
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTree in project linuxtools by eclipse.
the class ImageRunSWTBotTest method shouldReportErrorIfContainerWithSameNameExists.
@Test
public void shouldReportErrorIfContainerWithSameNameExists() {
// given
final DockerClient client = MockDockerClientFactory.image(MockImageFactory.name("foo:latest").build()).container(MockContainerFactory.name("foo_bar").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
// expand the 'Images' node and select the 'foo' images
SWTUtils.getTreeItem(dockerExplorerViewBot, "Test", "Images", "foo").select();
// when opening the "Run Image..." wizard
final SWTBotTree dockerExplorerViewTreeBot = dockerExplorerViewBot.bot().tree();
dockerExplorerViewTreeBot.contextMenu("Run...").click();
// when use an existing container name
bot.textWithLabel(WizardMessages.getString("ImageRunSelectionPage.containerName")).setText("foo_bar");
// then
// wait for https://bugs.eclipse.org/bugs/show_bug.cgi?id=482889 to be
// able to check the wizard validation message
// assertThat(bot.text(WizardMessages.getString("ImageRunSelectionPage.containerWithSameName"))).isNotNull();
ButtonAssertions.assertThat(bot.button("Finish")).isNotEnabled();
}
Aggregations