Java Code Examples for org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView#bot()

The following examples show how to use org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView#bot() . 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: SWTBotUtils.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Opens a trace in an editor and get the TmfEventsEditor
 *
 * @param bot
 *            the workbench bot
 * @param projectName
 *            the name of the project that contains the trace
 * @param elementPath
 *            the trace element path (relative to Traces folder)
 * @return TmfEventsEditor the opened editor
 */
public static TmfEventsEditor openEditor(SWTWorkbenchBot bot, String projectName, IPath elementPath) {
    final SWTBotView projectExplorerView = bot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
    projectExplorerView.setFocus();
    SWTBot projectExplorerBot = projectExplorerView.bot();

    final SWTBotTree tree = projectExplorerBot.tree();
    projectExplorerBot.waitUntil(ConditionHelpers.isTreeNodeAvailable(projectName, tree));
    final SWTBotTreeItem treeItem = tree.getTreeItem(projectName);
    treeItem.expand();

    SWTBotTreeItem tracesNode = getTraceProjectItem(projectExplorerBot, treeItem, "Traces");
    tracesNode.expand();

    SWTBotTreeItem currentItem = tracesNode;
    for (String segment : elementPath.segments()) {
        currentItem = getTraceProjectItem(projectExplorerBot, currentItem, segment);
        currentItem.doubleClick();
    }

    SWTBotEditor editor = bot.editorByTitle(elementPath.toString());
    IEditorPart editorPart = editor.getReference().getEditor(false);
    assertTrue(editorPart instanceof TmfEventsEditor);
    return (TmfEventsEditor) editorPart;
}
 
Example 2
Source File: AddProjectNatureTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test viewer filter.
 */
@Test
public void testViewerFilter() {

    /* Check that shadow project is visible */
    toggleFilters(false);
    SWTBotTreeItem shadowProject = SWTBotUtils.selectProject(fBot, SOME_PROJECT_SHADOW_NAME);
    assertEquals(SOME_PROJECT_SHADOW_NAME, shadowProject.getText());
    SWTBotTreeItem tracesItem = SWTBotUtils.getTraceProjectItem(fBot, shadowProject, TRACES_FOLDER_NAME);
    SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, tracesItem, TRACE_NAME);
    assertEquals(TRACE_NAME, traceItem.getText());
    SWTBotUtils.getTraceProjectItem(fBot, shadowProject, EXPERIMENTS_FOLDER_NAME);

    /* Check that shadow project is not visible */
    toggleFilters(true);

    SWTBotView viewBot = fBot.viewByTitle(PROJECT_EXPLORER_TITLE);
    viewBot.setFocus();
    SWTBot projectExplorerBot = viewBot.bot();

    final SWTBotTree tree = projectExplorerBot.tree();
    SWTBotTreeItem[] items = tree.getAllItems();
    for (SWTBotTreeItem swtBotTreeItem : items) {
        assertNotEquals(SOME_PROJECT_SHADOW_NAME, swtBotTreeItem.getText());
    }
}
 
Example 3
Source File: ImportAndReadKernelSmokeTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private static @NonNull Set<@NonNull Entry<String, Set<String>>> getSsNames(SWTBotView bot) {
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(bot.bot());
    SWTBotTimeGraphEntry trace = timeGraph.getEntry("synthetic-trace");
    SWTBotTimeGraphEntry[] traceEntries = timeGraph.getEntries();
    assertEquals("State system explorer should have a single trace entry: " + Arrays.toString(traceEntries), 1, traceEntries.length);
    SWTBotTimeGraphEntry[] modules = trace.getEntries();
    Map<String, Set<String>> modulesToStateSystems = new HashMap<>();
    for (SWTBotTimeGraphEntry module : modules) {
        Set<String> stateSystems = new HashSet<>();
        for (SWTBotTimeGraphEntry stateSystem : module.getEntries()) {
            stateSystems.add(stateSystem.getText());
        }
        modulesToStateSystems.put(module.getText(), stateSystems);
    }
    return modulesToStateSystems.entrySet();
}
 
Example 4
Source File: FlameChartViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test check callstack at a time with function map
 *
 * @throws IOException
 *             Missing file
 */
@Test
public void testGoToTimeAndCheckStackWithNames() throws IOException {
    goToTime(TIMESTAMPS[0]);
    final SWTBotView viewBot = sfBot.viewById(FlameChartView.ID);
    viewBot.setFocus();

    URL mapUrl = CtfTmfTestTraceUtils.class.getResource("cyg-profile-mapping.txt");
    String absoluteFile = FileLocator.toFileURL(mapUrl).getFile();
    TmfFileDialogFactory.setOverrideFiles(absoluteFile);

    SWTBotShell shell = openSymbolProviderDialog();
    SWTBot shellBot = shell.bot();
    shellBot.button("Add...").click();
    shellBot.button("OK").click();
    shellBot.waitUntil(Conditions.shellCloses(shell));
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    SWTBotTimeGraphEntry[] threads = timeGraph.getEntry(TRACE, PROCESS).getEntries();
    assertEquals(1, threads.length);
    assertEquals(THREAD, threads[0].getText(0));
    waitForSymbolNames("main", "event_loop", "handle_event");
}
 
Example 5
Source File: FlameChartViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static List<String> getVisibleStackFrames(final SWTBotView viewBot) {
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    List<String> stackFrames = new ArrayList<>();
    for (SWTBotTimeGraphEntry entry : timeGraph.getEntry(TRACE, PROCESS, THREAD).getEntries()) {
        String name = entry.getText();
        if (!name.isEmpty()) {
            stackFrames.add(name);
        }
    }
    return stackFrames;
}
 
Example 6
Source File: ResourcesViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test "Next Event" tool bar button sub-menu
 */
/* SWTBot doesn't support clicking the same tool bar sub-menu twice */
@Ignore
@Test
public void testMarkerNavigationSubMenu() {
    SWTBotView viewBot = getViewBot();
    /* set selection to trace start time */
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME);

    /* set focus on time graph */
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    timeGraph.setFocus();

    /* select first item */
    timeGraph.getEntry(LttngTraceGenerator.getName()).select();

    /* disable Lost Events navigation */
    viewBot.toolbarDropDownButton(NEXT_MARKER).menuItem(LOST_EVENTS).click();

    /* click "Next Marker" */
    viewBot.toolbarButton(NEXT_MARKER).click();
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME);

    /* enable Lost Events navigation */
    viewBot.toolbarDropDownButton(NEXT_MARKER).menuItem(LOST_EVENTS).click();

    /* click "Next Marker" */
    viewBot.toolbarButton(NEXT_MARKER).click();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1);
}
 
Example 7
Source File: ResourcesViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test "Show Empty Rows" view menu
 */
@Test
public void testShowRows() {
    SWTBotView viewBot = getViewBot();
    /* change window range to 10 ms */
    TmfTimeRange range = new TmfTimeRange(START_FOR_EMPTY_ROWS_TEST, END_FOR_EMPTY_ROWS_TEST);
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));

    IWorkbenchPart part = viewBot.getViewReference().getPart(false);
    assertTrue(part instanceof AbstractTimeGraphView);
    AbstractTimeGraphView abstractTimeGraphView = (AbstractTimeGraphView) part;
    viewBot.bot().waitUntil(ConditionHelpers.timeGraphRangeCondition(abstractTimeGraphView, Objects.requireNonNull(TmfTraceManager.getInstance().getActiveTrace()), range));
    fBot.waitUntil(ConditionHelpers.windowRange(range));

    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    timeGraph.setFocus();

    int count = getVisibleItems(timeGraph);

    viewBot.toolbarButton(HIDE_EMPTY_ROWS).click();

    /* Verify that number active entries changed */
    SWTBotUtils.waitUntil(graph -> getVisibleItems(graph) < count, timeGraph,
            () -> "Fewer number of visible entries expected: (count: " + count + ", actual: " + getVisibleItems(timeGraph) + ")");

    timeGraph.setFocus();
    viewBot.toolbarButton(HIDE_EMPTY_ROWS).click();

    /* Verify that number active entries changed */
    SWTBotUtils.waitUntil(graph -> getVisibleItems(graph) == count, timeGraph,
            () -> "More number of visible entries expected: (count: " + count + ", actual: " + getVisibleItems(timeGraph) + ")");
}
 
Example 8
Source File: ResourcesViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test "Show Markers" view menu
 */
@Test
public void testShowMarkers() {
    SWTBotView viewBot = getViewBot();
    /* set selection to trace start time */
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME);

    /* set focus on time graph */
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    timeGraph.setFocus();

    /* select first item */
    timeGraph.getEntry(LttngTraceGenerator.getName()).select();

    assertTrue(viewBot.viewMenu(LOST_EVENTS).isChecked());

    /* check that "Next Marker" and "Previous Marker" are enabled */
    assertTrue(viewBot.toolbarButton(NEXT_MARKER).isEnabled());
    assertTrue(viewBot.toolbarButton(PREVIOUS_MARKER).isEnabled());

    /* disable Lost Events markers */
    viewBot.viewMenu(LOST_EVENTS).click();

    /* check that "Next Marker" and "Previous Marker" are disabled */
    assertFalse(viewBot.toolbarButton(NEXT_MARKER).isEnabled());
    assertFalse(viewBot.toolbarButton(PREVIOUS_MARKER).isEnabled());

    /* enable Lost Events markers */
    viewBot.viewMenu(LOST_EVENTS).click();

    /* check that "Next Marker" and "Previous Marker" are enabled */
    assertTrue(viewBot.toolbarButton(NEXT_MARKER).isEnabled());
    assertTrue(viewBot.toolbarButton(PREVIOUS_MARKER).isEnabled());
}
 
Example 9
Source File: KernelTimeGraphViewTestBase.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test that re-opening a view repoopulates it properly.
 */
@Test
public void testOpenCloseOpen() {
    SWTBotView viewBot = openView();
    SWTBotTimeGraph tgBot = new SWTBotTimeGraph(viewBot.bot());
    Map<String, List<String>> before = getItemNames(tgBot);
    viewBot.close();
    viewBot = openView();
    tgBot = new SWTBotTimeGraph(viewBot.bot());
    Map<String, List<String>> after = getItemNames(tgBot);
    assertEquals(before, after);
}
 
Example 10
Source File: XmlTimegraphViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static SWTBotTimeGraph getTimegraph() {
    SWTBotView viewBot = fBot.viewById(XmlTimeGraphView.ID);
    SWTBotTimeGraph timegraph = new SWTBotTimeGraph(viewBot.bot());
    assertTrue("timegraph visible", timegraph.isVisible());
    timegraph.setFocus();
    return timegraph;
}
 
Example 11
Source File: ProjectExplorerTracesFolderTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static String getTraceProperty(SWTBotTreeItem traceItem, String property) {
    SWTBotUtils.openView(IPageLayout.ID_PROP_SHEET);
    SWTBotView view = fBot.viewById(IPageLayout.ID_PROP_SHEET);
    view.show();
    traceItem.select();
    SWTBot viewBot = view.bot();
    SWTBotUtils.waitUntil(bot -> bot.tree().cell(0, 0).equals(RESOURCE_PROPERTIES), viewBot, "Resource properties did not appear");
    SWTBotTreeItem traceTypeItem = SWTBotUtils.getTreeItem(viewBot, viewBot.tree(), RESOURCE_PROPERTIES, property);
    return traceTypeItem.cell(1);
}
 
Example 12
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());
}
 
Example 13
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);
    }
 
Example 14
Source File: ResourcesViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
private void testNextPreviousMarker(Runnable nextMarker, Runnable shiftNextMarker, Runnable previousMarker, Runnable shiftPreviousMarker) {
    SWTBotView viewBot = getViewBot();
    /* set selection to trace start time */
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME);

    /* set focus on time graph */
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    timeGraph.setFocus();

    /* select first item */
    timeGraph.getEntry(LttngTraceGenerator.getName()).select();

    /* click "Next Marker" 3 times */
    nextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1);
    nextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME2, LOST_EVENT_END2), LOST_EVENT_TIME2);
    nextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END3), LOST_EVENT_TIME3);

    /* shift-click "Previous Marker" 3 times */
    shiftPreviousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_TIME3), LOST_EVENT_TIME3);
    shiftPreviousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_TIME2), LOST_EVENT_TIME2);
    shiftPreviousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_TIME1), LOST_EVENT_TIME1);

    /* shift-click "Next Marker" 3 times */
    shiftNextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END1), LOST_EVENT_END1);
    shiftNextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END2), LOST_EVENT_END2);
    shiftNextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END3), LOST_EVENT_END3);

    /* click "Previous Marker" 3 times */
    previousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME2, LOST_EVENT_END2), LOST_EVENT_TIME2);
    previousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1);
    previousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1);
}
 
Example 15
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 16
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 17
Source File: ResourcesViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Test tool bar button "Add Bookmark..." and "Remove Bookmark"
 */
@Test
public void testAddRemoveBookmark() {
    SWTBotView viewBot = getViewBot();
    /* change window range to 10 ms */
    TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    fBot.waitUntil(ConditionHelpers.windowRange(range));

    /* set selection to trace start time */
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME);

    /* set focus on time graph */
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    timeGraph.setFocus();

    /* select first CPU resource */
    timeGraph.getEntry(LttngTraceGenerator.getName(), CPU0_THREADS).select();

    /* click "Select Next State Change" 2 times */
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME1, CPU0_TIME1), CPU0_TIME1);
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME2, CPU0_TIME2), CPU0_TIME2);

    /* click "Add Bookmark..." and fill Add Bookmark dialog */
    viewBot.toolbarButton(ADD_BOOKMARK).click();
    SWTBot dialogBot = fBot.shell(ADD_BOOKMARK_DIALOG).bot();
    dialogBot.text().setText("B1");
    dialogBot.button(OK).click();

    /*
     * click "Select Next State Change" 2 times and shift-click "Select Next
     * State Change
     */
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME3, CPU0_TIME3), CPU0_TIME3);
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME4), CPU0_TIME4);
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME5), CPU0_TIME5);

    /* click "Add Bookmark..." and fill Add Bookmark dialog */
    viewBot.toolbarButton(ADD_BOOKMARK).click();
    dialogBot = fBot.shell(ADD_BOOKMARK_DIALOG).bot();
    dialogBot.text().setText("B2");
    dialogBot.button(OK).click();

    /* click "Previous Marker" */
    viewBot.toolbarButton(PREVIOUS_MARKER).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME2, CPU0_TIME2), CPU0_TIME2);

    /* click "Remove Bookmark" */
    viewBot.toolbarButton(REMOVE_BOOKMARK).click();

    /* click "Next Marker" */
    viewBot.toolbarButton(NEXT_MARKER).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME5), CPU0_TIME5);

    /* click "Remove Bookmark" */
    viewBot.toolbarButton(REMOVE_BOOKMARK).click();

    /* click "Previous Marker" */
    viewBot.toolbarButton(PREVIOUS_MARKER).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME5), CPU0_TIME5);

    /* click "Select Previous State Change" */
    viewBot.toolbarButton(SELECT_PREVIOUS_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME4), CPU0_TIME4);
}