Search in sources :

Example 1 with SWTBotView

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));
}
Also used : SWTBotEclipseEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor) Matcher(org.hamcrest.Matcher) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) SWTBotTable(org.eclipse.swtbot.swt.finder.widgets.SWTBotTable) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test)

Example 2 with SWTBotView

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);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) Tree(org.eclipse.swt.widgets.Tree) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)

Example 3 with SWTBotView

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;
}
Also used : WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)

Example 4 with SWTBotView

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();
}
Also used : SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) Test(org.junit.jupiter.api.Test)

Example 5 with SWTBotView

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());
}
Also used : SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test)

Aggregations

SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)41 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)14 Test (org.junit.Test)12 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)10 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)7 Repository (org.eclipse.jgit.lib.Repository)3 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)3 Git (org.eclipse.jgit.api.Git)2 Composite (org.eclipse.swt.widgets.Composite)2 Tree (org.eclipse.swt.widgets.Tree)2 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)2 SWTBotStyledText (org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledText)2 SWTBotToolbarToggleButton (org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarToggleButton)2 DockerClient (com.spotify.docker.client.DockerClient)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 IResource (org.eclipse.core.resources.IResource)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IDynamicVariable (org.eclipse.core.variables.IDynamicVariable)1 GitScopeOperation (org.eclipse.egit.ui.internal.operations.GitScopeOperation)1