Java Code Examples for org.eclipse.swtbot.swt.finder.widgets.SWTBotTree#expandNode()

The following examples show how to use org.eclipse.swtbot.swt.finder.widgets.SWTBotTree#expandNode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TraceTypePreferencePageTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private static void setTraceTypePreferences(@NonNull String button, @NonNull String... pathToCheck) {
    SWTBot bot = openTraceTypePreferences().bot();
    SWTBotTree treeBot = bot.tree(1);
    if (!button.isEmpty()) {
        bot.button(button).click();
    }

    if (pathToCheck.length > 0) {
        SWTBotTreeItem treeItem = treeBot.expandNode(pathToCheck);
        assertNotNull("Tree item not null", treeItem);
        treeItem.select();
        bot.button(CHECK_SELECTED).click();
    }
    bot.button("Apply").click();
    SWTBotUtils.pressOKishButtonInPreferences(fBot);
}
 
Example 2
Source File: BotBdmQueriesEditor.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void selectCustomQuery(String queryName) {
    SWTBotTree tree = getQueryListTree();
    tree.select(Messages.customQueriesOption);
    tree.expandNode(Messages.customQueriesOption);
    bot.waitUntil(new ConditionBuilder()
            .withTest(() -> {
                try {
                    tree.getTreeItem(Messages.customQueriesOption).getNode(queryName);
                    return true;
                } catch (WidgetNotFoundException e) {
                    return false;
                }
            })
            .withFailureMessage(() -> String.format("Can't find custom query %s", queryName))
            .create());
    tree.getTreeItem(Messages.customQueriesOption).getNode(queryName).select();
}
 
Example 3
Source File: XMLUITests.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param nodeText
 */
private void executeTestOnConnector(String nodeText) {
    gmfEditor.getEditPart("Step1").parent().select().part();
    bot.viewById(SWTBotTestUtil.VIEWS_PROPERTIES_PROCESS_GENERAL).show();
    SWTBotTestUtil.selectTabbedPropertyView(bot, "Connectors");
    bot.button("Add...").click();
    final SWTBotTree tree = bot.tree();
    tree.expandNode("Bonita", false);
    final SWTBotTreeItem treeItem = tree.getTreeItem("Bonita");
    treeItem.getNode(nodeText).select();
    bot.button("Next >").click();
    bot.text().setText("setVariableWithXmlTest");
    bot.button("Next >").click();
    final SWTBotCombo comboBox = bot.comboBox();
    comboBox.setSelection("${xmlData}...");
    final SWTBotTree tree2 = bot.tree();
    tree2.expandNode("Whole variable", false);
    final SWTBotTreeItem treeItem2 = tree2.getTreeItem("Whole variable");
    treeItem2.getNode("Body").select();
    bot.button("OK").click();
    final String result = comboBox.getText();
    bot.button("Cancel").click();
    assertEquals("xmlData$/Body", result);
}
 
Example 4
Source File: AbstractImportAndReadSmokeTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates a tracing projects
 *
 * @param traceProjectName
 *            the name of the test project
 */
protected static void createProject(String traceProjectName) {
    SWTBotUtils.focusMainWindow(fBot.shells());
    fBot.menu("File").menu("New").menu("Project...").click();

    fBot.shell("New Project").activate();
    SWTBotTree tree = fBot.tree();
    assertNotNull(tree);
    final String tracingKey = "Tracing";
    fBot.waitUntil(ConditionHelpers.isTreeNodeAvailable(tracingKey, tree));
    final SWTBotTreeItem tracingNode = tree.expandNode(tracingKey);

    tracingNode.select();
    final String projectKey = "Tracing Project";
    fBot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(projectKey, tracingNode));
    final SWTBotTreeItem tracingProject = tracingNode.getNode(projectKey);
    assertNotNull(tracingProject);

    tracingProject.select();
    tracingProject.click();

    SWTBotButton nextButton = fBot.button("Next >");
    fBot.waitUntil(Conditions.widgetIsEnabled(nextButton));
    nextButton.click();
    fBot.shell("Tracing Project").activate();

    final SWTBotText text = fBot.text();
    text.setText(traceProjectName);

    fBot.button("Finish").click();
    WaitUtils.waitForJobs();
}
 
Example 5
Source File: TraceTypePreferencePageTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test enabled/disabled trace types behavior in the filters view
 */
@Test
public void testFiltersView() {
    int defaultCount = TmfTraceType.getAvailableTraceTypes().length;
    SWTBotUtils.openView(FilterView.ID);
    SWTBotView viewBot = fBot.viewById(FilterView.ID);
    importFilter(viewBot);
    SWTBot bot = viewBot.bot();

    SWTBotTree tree = bot.tree(0);
    SWTBotTreeItem item = tree.expandNode("FILTER test", "WITH TRACETYPE Custom XML : testxmlextension");
    item.select();

    SWTBotCCombo comboBox = bot.ccomboBox(0);
    assertEquals("Combo: number of trace types", defaultCount, comboBox.itemCount());

    // Change the preference value for testxmlextension
    setTraceTypePreferences(UNCHECK_ALL, "Custom XML", "testxmlextension");

    // Change node to refresh the tree
    item = tree.expandNode("FILTER test");
    item.select();
    item = tree.expandNode("FILTER test", "WITH TRACETYPE Custom XML : testxmlextension");
    item.select();

    comboBox = bot.ccomboBox(0);
    assertEquals("Combo: number of trace types", 1, comboBox.itemCount());

    setTraceTypePreferences(UNCHECK_ALL, "Custom Text", "testtxtextension");

    // Change node to refresh the tree
    item = tree.expandNode("FILTER test");
    item.select();
    item = tree.expandNode("FILTER test", "WITH TRACETYPE Custom XML : testxmlextension");
    item.select();

    comboBox = bot.ccomboBox(0);
    assertEquals("Combo: number of trace types", 2, comboBox.itemCount());
}