Java Code Examples for org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem#click()

The following examples show how to use org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem#click() . 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: ImportBdmWizardBot.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public ImportBdmWizardBot setImportAction(String packageName, String action) {
    SWTBotTree tree = bot.tree();
    SWTBotShell activeShell = bot.activeShell();
    bot.waitUntil(treeItemAvailable(tree, packageName));
    SWTBotTreeItem treeItem = tree.getTreeItem(packageName);
    treeItem.select();
    treeItem.click(1);

    SWTBot activeBot = activeShell.bot();
    SWTBotCCombo ccomboBoxInGroup = activeBot.ccomboBoxWithId(SmartImportBdmPage.IMPORT_ACTION_COMBO_EDITOR_ID);
    activeBot.waitUntil(new ConditionBuilder()
            .withTest(() -> Stream.of(ccomboBoxInGroup.items()).anyMatch(action::equals))
            .withFailureMessage(() -> String.format("Action '%s' not found in combo", action))
            .create());
    ccomboBoxInGroup.setSelection(action);
    return this;
}
 
Example 2
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 3
Source File: ControlViewProfileTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test load session
 */
private void testLoadSession() {
    SWTBotTreeItem nodeItem = SWTBotUtils.getTreeItem(fBot, fTree, getNodeName());
    SWTBotTreeItem sessionGroupItem = nodeItem.getNode(ControlViewSwtBotUtil.SESSION_GROUP_NAME);

    sessionGroupItem.select();
    SWTBotMenu menuBot = sessionGroupItem.contextMenu(ControlViewSwtBotUtil.LOAD_MENU_ITEM);
    menuBot.click();

    SWTBotShell shell = fBot.shell(ControlViewSwtBotUtil.LOAD_DIALOG_TITLE).activate();

    SWTBotRadio button = shell.bot().radio(ControlViewSwtBotUtil.REMOTE_RADIO_BUTTON_LABEL);
    button.click();

    SWTBotTree shellTree = shell.bot().tree();

    SWTBotTreeItem profileItem = shellTree.getTreeItem(SESSION_NAME + ControlViewSwtBotUtil.PROFILE_SUFFIX);
    profileItem.select();
    profileItem.click();

    shell.bot().button(ControlViewSwtBotUtil.CONFIRM_DIALOG_OK_BUTTON).click();
    WaitUtils.waitForJobs();

    sessionGroupItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(), ControlViewSwtBotUtil.SESSION_GROUP_NAME);

    fBot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(SESSION_NAME, sessionGroupItem));
    assertEquals(1, sessionGroupItem.getNodes().size());
}
 
Example 4
Source File: TestTraceOffsetting.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Test offsetting by 99 ns
 */
@Test
public void testOffsetting() {
    // Skip this test on Mac OS X 10.11.1 because of bug 481611
    // FIXME: Remove this work around once bug 481611 is fixed
    MacOsVersion macOsVersion = MacOsVersion.getMacOsVersion();
    boolean macBugPresent = macOsVersion != null && macOsVersion.compareTo(new MacOsVersion(10, 11, 1)) >= 0;
    assumeTrue(!macBugPresent);

    SWTBotUtils.createProject(PROJET_NAME);
    SWTBotTreeItem traceFolderItem = SWTBotUtils.selectTracesFolder(fBot, PROJET_NAME);
    SWTBotUtils.openTrace(PROJET_NAME, fLocation.getAbsolutePath(), "org.eclipse.linuxtools.tmf.core.tests.xmlstub");
    SWTBotEditor editor = fBot.editorByTitle(fLocation.getName());
    SWTBotTable eventsTableBot = editor.bot().table();
    String timestamp = eventsTableBot.cell(1, 1);
    assertEquals("19:00:00.000 000 000", timestamp);
    SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, traceFolderItem, fLocation.getName());
    traceItem.select();
    traceItem.contextMenu("Apply Time Offset...").click();
    WaitUtils.waitForJobs();
    // set offset to 99 ns
    SWTBotShell shell = fBot.shell("Apply time offset");
    shell.setFocus();
    SWTBotTreeItem[] allItems = fBot.tree().getAllItems();
    final SWTBotTreeItem swtBotTreeItem = allItems[0];
    swtBotTreeItem.select();
    swtBotTreeItem.click(1);
    // Press shortcuts on the cell editor
    SWTBotText text = shell.bot().text(1);
    text.pressShortcut(KeyStroke.getInstance('9'));
    text.pressShortcut(KeyStroke.getInstance('9'));
    text.pressShortcut(KeyStroke.getInstance('\n'));
    WaitUtils.waitForJobs();
    fBot.button("OK").click();

    // wait for trace to close
    fBot.waitWhile(ConditionHelpers.isEditorOpened(fBot, fLocation.getName()));

    // re-open trace
    SWTBotUtils.openTrace(PROJET_NAME, fLocation.getAbsolutePath(), "org.eclipse.linuxtools.tmf.core.tests.xmlstub");
    editor = fBot.editorByTitle(fLocation.getName());
    eventsTableBot = editor.bot().table();
    timestamp = eventsTableBot.cell(1, 1);
    assertEquals("19:01:39.000 000 000", timestamp);
    SWTBotUtils.deleteProject(PROJET_NAME, fBot);
}
 
Example 5
Source File: FilterViewerTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Return all timestamps ending with 100... for reasons
 */
@Test
public void testTimestampFilter() {
    SWTBotView viewBot = fBot.viewById(FilterView.ID);
    viewBot.setFocus();
    SWTBot filterBot = viewBot.bot();
    SWTBotTree treeBot = filterBot.tree();

    viewBot.toolbarButton("Add new filter").click();
    treeBot.getTreeItem("FILTER <name>").select();
    SWTBotText textBot = filterBot.text();
    textBot.setFocus();
    String filterName = "timestamp";
    textBot.setText(filterName);
    SWTBotTreeItem filterNodeBot = treeBot.getTreeItem(FILTER_TEST + filterName);
    filterNodeBot.click();
    filterNodeBot.contextMenu("TRACETYPE").click();
    filterNodeBot.expand();
    SWTBotCCombo comboBot = filterBot.ccomboBox();
    comboBot.setSelection(TRACETYPE);
    filterNodeBot.getNode(WITH_TRACETYPE).expand();

    // --------------------------------------------------------------------
    // add AND
    // --------------------------------------------------------------------

    filterNodeBot.getNode(WITH_TRACETYPE).contextMenu(AND).click();

    // --------------------------------------------------------------------
    // add CONTAINS "100"
    // --------------------------------------------------------------------

    filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).contextMenu(CONTAINS).click();
    filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).expand();
    comboBot = filterBot.ccomboBox(1); // aspect
    comboBot.setSelection(TIMESTAMP);
    textBot = filterBot.text();
    textBot.setFocus();
    textBot.setText("100");
    filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).getNode("Timestamp CONTAINS \"100\"").select();
    filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).select();

    viewBot.toolbarButton("Save filters").click();

    String ret = applyFilter(fBot, filterName);
    assertEquals("10/100", ret);
}
 
Example 6
Source File: FilterViewerTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
     * Return all timestamps ending with 100... for reasons
     */
    @Test
    public void testTimestampEqualsOr() {
        SWTBotView viewBot = fBot.viewById(FilterView.ID);
        viewBot.setFocus();
        SWTBot filterBot = viewBot.bot();
        SWTBotTree treeBot = filterBot.tree();

        viewBot.toolbarButton("Add new filter").click();
        treeBot.getTreeItem("FILTER <name>").select();
        SWTBotText textBot = filterBot.text();
        textBot.setFocus();
        String filterName = "matchAndEquals";
        textBot.setText(filterName);
        SWTBotTreeItem filterNodeBot = treeBot.getTreeItem(FILTER_TEST + filterName);
        filterNodeBot.click();
        filterNodeBot.contextMenu("TRACETYPE").click();
        filterNodeBot.expand();
        SWTBotCCombo comboBot = filterBot.ccomboBox();
        comboBot.setSelection(TRACETYPE);
        filterNodeBot.getNode(WITH_TRACETYPE).expand();

        // --------------------------------------------------------------------
        // add OR
        // --------------------------------------------------------------------

        filterNodeBot.getNode(WITH_TRACETYPE).contextMenu(OR).click();

        // --------------------------------------------------------------------
        // add EQUALS "19...300"
        // --------------------------------------------------------------------

        SWTBotTreeItem orNode = filterNodeBot.getNode(WITH_TRACETYPE).getNode(OR);
        orNode.contextMenu("EQUALS").click();
        orNode.expand();
        orNode.getNode(0).select();
        comboBot = filterBot.ccomboBox(1); // aspect
        comboBot.setSelection(TIMESTAMP);
        textBot = filterBot.text();
        textBot.setFocus();
        textBot.setText("19:00:00.000 000 300");

        // --------------------------------------------------------------------
        // add MATCHES "1"
        // --------------------------------------------------------------------
        orNode.contextMenu("MATCHES").click();
        orNode.expand();
        orNode.getNode(1).select();
        comboBot = filterBot.ccomboBox(1); // aspect
        comboBot.setSelection(CONTENTS);
        textBot = filterBot.text(0); // field
        textBot.setFocus();
        textBot.setText("field");
        textBot = filterBot.text(1); // value
        textBot.setFocus();
        textBot.setText("1");

        viewBot.toolbarButton("Save filters").click();

        String ret = applyFilter(fBot, filterName);
        assertEquals("26/100", ret);
//        filterNodeBot.contextMenu().menu("Delete").click();
    }
 
Example 7
Source File: FilterViewerTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
     * test compare field >= 2
     */
    @Test
    public void testField01() {
        SWTBotView viewBot = fBot.viewById(FilterView.ID);
        viewBot.setFocus();
        SWTBot filterBot = viewBot.bot();
        SWTBotTree treeBot = filterBot.tree();

        viewBot.toolbarButton("Add new filter").click();
        treeBot.getTreeItem("FILTER <name>").select();
        SWTBotText textBot = filterBot.text();
        textBot.setFocus();
        String filterName = "field";
        textBot.setText(filterName);
        SWTBotTreeItem filterNodeBot = treeBot.getTreeItem(FILTER_TEST + filterName);
        filterNodeBot.click();
        filterNodeBot.contextMenu("TRACETYPE").click();
        filterNodeBot.expand();
        SWTBotCCombo comboBot = filterBot.ccomboBox();
        comboBot.setSelection(TRACETYPE);
        filterNodeBot.getNode(WITH_TRACETYPE).expand();

        // --------------------------------------------------------------------
        // add Compare > 1.5
        // --------------------------------------------------------------------

        filterNodeBot.getNode(WITH_TRACETYPE).contextMenu(COMPARE).click();
        SWTBotTreeItem contentNode = filterNodeBot.getNode(WITH_TRACETYPE).getNode("<select aspect> " + "=" + " <value>");
        contentNode.expand();
        comboBot = filterBot.ccomboBox(1); // aspect
        comboBot.setSelection(CONTENTS);
        textBot = filterBot.text(0); // field
        textBot.setFocus();
        textBot.setText(filterName);

        textBot = filterBot.text(1); // value
        textBot.setFocus();
        textBot.setText("1.5");
        filterBot.radio(">").click();

        // --------------------------------------------------------------------
        // apply
        // --------------------------------------------------------------------
        viewBot.toolbarButton("Save filters").click();

        String ret = applyFilter(fBot, filterName);
//        filterNodeBot.contextMenu().menu("Delete").click();
        assertEquals("50/100", ret);
    }