org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView Java Examples

The following examples show how to use org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView. 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: FetchRemoteTracesTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test 9.1: Cannot connect to remote host (node doesn't exist)
 */
@Test
public void test_9_01() {
    SWTBotView projectExplorerBot = fBot.viewByTitle(PROJECT_EXPLORER);
    projectExplorerBot.show();
    SWTBotTreeItem tracesFolderItem = getTracesFolderTreeItem(projectExplorerBot);

    tracesFolderItem.contextMenu(FETCH_COMMAND_NAME).click();
    SWTBotShell shell = fBot.shell(FETCH_SHELL_NAME).activate();
    fBot.comboBox().setSelection("TestUnknown");
    fBot.button("Finish").click();
    /* ErrorDialog is inhibited by the platform when running tests */
    fBot.button("Cancel").click();
    fBot.waitUntil(Conditions.shellCloses(shell), FETCH_TIME_OUT);
    WaitUtils.waitForJobs();
}
 
Example #2
Source File: RCPTestSetupHelper.java    From tlaplus with MIT License 6 votes vote down vote up
public static void beforeClass() {
	UIThreadRunnable.syncExec(new VoidResult() {
		public void run() {
			resetWorkbench();
			resetToolbox();
			
			// close browser-based welcome screen (if open)
			SWTWorkbenchBot bot = new SWTWorkbenchBot();
			try {
				SWTBotView welcomeView = bot.viewByTitle("Welcome");
				welcomeView.close();
			} catch (WidgetNotFoundException e) {
				return;
			}
		}
	});
}
 
Example #3
Source File: PatternLatencyTableViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Get the table associated to the view
 */
private void getTable() {
    SWTBotView viewBot = fBot.viewById(VIEW_ID);
    final IViewReference viewReference = viewBot.getViewReference();
    IViewPart viewPart = UIThreadRunnable.syncExec(new Result<IViewPart>() {
        @Override
        public IViewPart run() {
            return viewReference.getView(true);
        }
    });
    assertNotNull(viewPart);
    if (!(viewPart instanceof PatternLatencyTableView)) {
        fail("Could not instanciate view");
    }
    fLatencyView = (PatternLatencyTableView) viewPart;
    fTable = fLatencyView.getSegmentStoreViewer();
    assertNotNull(fTable);
}
 
Example #4
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 #5
Source File: FetchRemoteTracesTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test 8.4: Run Profile "TestAllRecursive"
 */
@Test
public void test_8_04() {
    SWTBotView projectExplorerBot = fBot.viewByTitle(PROJECT_EXPLORER);
    projectExplorerBot.show();
    SWTBotTreeItem tracesFolderItem = getTracesFolderTreeItem(projectExplorerBot);

    tracesFolderItem.contextMenu(FETCH_COMMAND_NAME).click();
    SWTBotShell shell = fBot.shell(FETCH_SHELL_NAME).activate();
    fBot.comboBox().setSelection("TestAllRecursive");
    fBot.button("Next >").click();
    fBot.button("Finish").click();
    fBot.waitUntil(Conditions.shellCloses(shell), FETCH_TIME_OUT);
    WaitUtils.waitForJobs();

    TmfProjectElement project = TmfProjectRegistry.getProject(ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME), true);
    fBot.waitUntil(new TraceCountCondition(project, 3));
    final TmfTraceFolder tracesFolder = project.getTracesFolder();
    assertNotNull(tracesFolder);
    List<TmfTraceElement> traces = tracesFolder.getTraces();
    assertEquals(3, traces.size());
    testTrace(traces.get(0), CONNECTION_NODE1_NAME + "/resources/generated/synthetic-trace", TRACE_TYPE_KERNEL);
    testTrace(traces.get(1), CONNECTION_NODE1_NAME + "/resources/syslog", TRACE_TYPE_SYSLOG);
    testTrace(traces.get(2), CONNECTION_NODE1_NAME + "/resources/unrecognized", null);
}
 
Example #6
Source File: MemoryUsageViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test if Memory Usage is populated
 */
@Test
public void testOpenMemoryUsage() {
    SWTBotView viewBot = fBot.viewById(UstMemoryUsageView.ID);
    viewBot.setFocus();

    // Do some basic validation
    Matcher<Chart> matcher = WidgetOfType.widgetOfType(Chart.class);
    Chart chart = viewBot.bot().widget(matcher);

    checkAllEntries();

    // Verify that the chart has 4 series
    fBot.waitUntil(ConditionHelpers.numberOfSeries(chart, EXPECTED_NUM_SERIES));

    ISeriesSet seriesSet = chart.getSeriesSet();
    ISeries<?>[] series = seriesSet.getSeries();
    // Verify that each series is a ILineSeries
    for (ISeries<?> serie : series) {
        assertTrue(serie instanceof ILineSeries);
    }
}
 
Example #7
Source File: SystemCallLatencyStatisticsTableAnalysisTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private static void testToTsv(SWTBotView view) throws NoSuchMethodException {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    assertNotNull(os);
    IViewPart viewPart = view.getReference().getView(true);
    assertTrue(viewPart instanceof AbstractSegmentsStatisticsView);
    Class<@NonNull AbstractSegmentsStatisticsView> clazz = AbstractSegmentsStatisticsView.class;
    Method method = clazz.getDeclaredMethod("exportToTsv", java.io.OutputStream.class);
    method.setAccessible(true);
    final Exception[] except = new Exception[1];
    UIThreadRunnable.syncExec(() -> {
        try {
            method.invoke((AbstractSegmentsStatisticsView) viewPart, os);
        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
            except[0] = e;
        }
    });
    assertNull(except[0]);
    @SuppressWarnings("null")
    String[] lines = String.valueOf(os).split(System.getProperty("line.separator"));
    assertNotNull(lines);
    assertEquals("header", "Level\tMinimum\tMaximum\tAverage\tStandard Deviation\tCount\tTotal", lines[0]);
    assertEquals("line 1", "bug446190\t\t\t\t\t\t", lines[1]);
    assertEquals("line 2", "Total\t1 µs\t5.904 s\t15.628 ms\t175.875 ms\t1801\t28.146 s", lines[2]);
}
 
Example #8
Source File: SwtBotProjectActions.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns true if there are errors in the Problem view. Returns false otherwise.
 */
public static boolean hasErrorsInProblemsView(SWTWorkbenchBot bot) {
  // Open Problems View by Window -> show view -> Problems
  bot.menu("Window").menu("Show View").menu("Problems").click();

  SWTBotView view = bot.viewByTitle("Problems");
  view.show();
  SWTBotTree tree = view.bot().tree();

  for (SWTBotTreeItem item : tree.getAllItems()) {
    String text = item.getText();
    if (text != null && text.startsWith("Errors")) {
      return true;
    }
  }

  return false;
}
 
Example #9
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 #10
Source File: SWTBotTestUtil.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * select an event in the overview tree. Becarefull, if treeViewer exists in other views SWTBot may not find the one in
 * overview
 *
 * @param bot
 * @param poolName
 * @param eventName
 */
public static void selectElementFromOverview(final SWTGefBot bot, final String poolName, final String laneName,
        final String eventName) {
    final SWTBotView view = bot.viewById(SWTBotTestUtil.VIEWS_TREE_OVERVIEW);
    view.show();
    view.setFocus();
    final SWTBotTree tree = bot.treeWithId(BONITA_OVERVIEW_TREE_ID);
    tree.setFocus();
    tree.getTreeItem(poolName).click();
    if (laneName == null) {
        tree.expandNode(poolName).select(eventName);
    } else {
        tree.expandNode(poolName).expandNode(laneName);
        if (eventName != null) {
            tree.getTreeItem(eventName);
        }
    }
}
 
Example #11
Source File: LamiChartViewerTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Reset the current perspective
 */
@After
public void resetPerspective() {
    SWTBotView viewBot = fViewBot;
    if (viewBot != null) {
        viewBot.close();
    }
    /*
     * UI Thread executes the reset perspective action, which opens a shell
     * to confirm the action. The current thread will click on the 'Yes'
     * button
     */
    Runnable runnable = () -> SWTBotUtils.anyButtonOf(fBot, "Yes", "Reset Perspective").click();
    UIThreadRunnable.asyncExec(() -> {
        IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getWorkbenchWindows()[0];
        ActionFactory.RESET_PERSPECTIVE.create(activeWorkbenchWindow).run();
    });
    runnable.run();
}
 
Example #12
Source File: SystemCallLatencyTableAnalysisTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected AbstractSegmentStoreTableView openTable() {
    /*
     * Open latency view
     */
    SWTBotUtils.openView(PRIMARY_VIEW_ID, SECONDARY_VIEW_ID);
    SWTBotView viewBot = fBot.viewById(PRIMARY_VIEW_ID);
    final IViewReference viewReference = viewBot.getViewReference();
    IViewPart viewPart = UIThreadRunnable.syncExec(new Result<IViewPart>() {
        @Override
        public IViewPart run() {
            return viewReference.getView(true);
        }
    });
    assertTrue("Could not instanciate view", viewPart instanceof SegmentStoreTableView);
    return (SegmentStoreTableView) viewPart;
}
 
Example #13
Source File: TestValidSelectionExport.java    From aCute with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testValidSelectionExport() {
openExportWizard();
SWTBotButton finishButton = bot.button("Finish");
assertTrue("Should be able to Finish an export with a valid Project selected.", finishButton.isEnabled());
finishButton.click();

bot.waitUntil(Conditions.waitForWidget(withText("<terminated> .NET Core Export")),30000);

SWTBotView view = bot.viewByTitle("Project Explorer");
SWTBotTree tree = new SWTBot(view.getWidget()).tree(0);
SWTBotTreeItem projectItem = tree.getTreeItem(project.getName());

try {
	projectItem.expand().getNode("bin");
}catch (WidgetNotFoundException e) {
	SWTBotView consoleView = bot.viewByPartName("Console");
	fail("Export failed: "+ consoleView.bot().styledText().getText());
}
}
 
Example #14
Source File: SwtBotWorkbenchActions.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
/** Open the view with the given ID. */
public static SWTBotView openViewById(SWTWorkbenchBot bot, String viewId) {
  UIThreadRunnable.syncExec(
      bot.getDisplay(),
      () -> {
        IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        assertNotNull(activeWindow);
        try {
          activeWindow.getActivePage().showView(viewId);
        } catch (PartInitException ex) {
          // viewById() will fail in calling thread
          logger.log(Level.SEVERE, "Unable to open view " + viewId, ex);
        }
      });
  return bot.viewById(viewId);
}
 
Example #15
Source File: FetchRemoteTracesTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test 8.14: Cancel Import
 */
@Test
public void test_8_14() {
    SWTBotView projectExplorerBot = fBot.viewByTitle(PROJECT_EXPLORER);
    projectExplorerBot.show();
    SWTBotTreeItem tracesFolderItem = getTracesFolderTreeItem(projectExplorerBot);

    tracesFolderItem.contextMenu(FETCH_COMMAND_NAME).click();
    SWTBotShell shell = fBot.shell(FETCH_SHELL_NAME).activate();
    fBot.comboBox().setSelection("TestAllRecursive");
    fBot.button("Next >").click();
    fBot.button("Finish").click();
    fBot.button("Cancel").click();
    fBot.waitUntil(Conditions.shellCloses(shell), FETCH_TIME_OUT);
    WaitUtils.waitForJobs();

    /* Can't verify cancelled import, it depends on timing */
}
 
Example #16
Source File: SwtBotTestingUtilities.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
/** Wait until the view's content description matches. */
public static void waitUntilViewContentDescription(
    SWTBot bot, SWTBotView consoleView, Matcher<String> matcher) {
  bot.waitUntil(
      new DefaultCondition() {

        @Override
        public boolean test() throws Exception {
          return matcher.matches(consoleView.getViewReference().getContentDescription());
        }

        @Override
        public String getFailureMessage() {
          return matcher.toString();
        }
      });
}
 
Example #17
Source File: FlameGraphTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Open a flamegraph
 */
@Before
public void before() {
    fBot = new SWTWorkbenchBot();
    SWTBotUtils.openView(FLAMEGRAPH_ID);
    SWTBotView view = fBot.viewById(FLAMEGRAPH_ID);
    assertNotNull(view);
    fView = view;
    FlameGraphView flamegraph = UIThreadRunnable.syncExec((Result<FlameGraphView>) () -> {
        IViewPart viewRef = fView.getViewReference().getView(true);
        return (viewRef instanceof FlameGraphView) ? (FlameGraphView) viewRef : null;
    });
    assertNotNull(flamegraph);
    fTimeGraphViewer = flamegraph.getTimeGraphViewer();
    assertNotNull(fTimeGraphViewer);
    SWTBotUtils.maximize(flamegraph);
    fFg = flamegraph;
}
 
Example #18
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 #19
Source File: SystemCallLatencyStatisticsTableAnalysisTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Opens a latency table
 */
@Before
public void createTree() {
    /*
     * Open latency view
     */
    SWTBotUtils.openView(PRIMARY_VIEW_ID, SECONDARY_VIEW_ID);
    SWTWorkbenchBot bot = new SWTWorkbenchBot();
    SWTBotView viewBot = bot.viewById(PRIMARY_VIEW_ID);
    final IViewReference viewReference = viewBot.getViewReference();
    IViewPart viewPart = UIThreadRunnable.syncExec(new Result<IViewPart>() {
        @Override
        public IViewPart run() {
            return viewReference.getView(true);
        }
    });
    assertTrue("Could not instanciate view", viewPart instanceof SegmentStoreStatisticsView);
    fTreeBot = viewBot.bot().tree();
    assertNotNull(fTreeBot);
}
 
Example #20
Source File: FetchRemoteTracesTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test 8.11: Run Profile "TestSpecificRecursive"
 */
@Test
public void test_8_11() {
    SWTBotView projectExplorerBot = fBot.viewByTitle(PROJECT_EXPLORER);
    projectExplorerBot.show();
    SWTBotTreeItem tracesFolderItem = getTracesFolderTreeItem(projectExplorerBot);

    tracesFolderItem.contextMenu(FETCH_COMMAND_NAME).click();
    SWTBotShell shell = fBot.shell(FETCH_SHELL_NAME).activate();
    fBot.comboBox().setSelection("TestSpecificRecursive");
    fBot.button("Next >").click();
    fBot.button("Finish").click();
    fBot.waitUntil(Conditions.shellCloses(shell), FETCH_TIME_OUT);
    WaitUtils.waitForJobs();

    TmfProjectElement project = TmfProjectRegistry.getProject(ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME), true);
    fBot.waitUntil(new TraceCountCondition(project, 2));
    final TmfTraceFolder tracesFolder = project.getTracesFolder();
    assertNotNull(tracesFolder);
    List<TmfTraceElement> traces = tracesFolder.getTraces();
    assertEquals(2, traces.size());
    testTrace(traces.get(0), CONNECTION_NODE1_NAME + "/resources/generated/synthetic-trace", TRACE_TYPE_KERNEL);
    testTrace(traces.get(1), CONNECTION_NODE1_NAME + "/resources/syslog", TRACE_TYPE_SYSLOG);
}
 
Example #21
Source File: ConsoleViewContains.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean test() throws Exception {
  msg = "Could not open Console view";
  SWTBotView consoleView = bot.viewById("org.eclipse.ui.console.ConsoleView");
  msg = "Could not find textWidget in Console view";
  SWTBotStyledText textWidget = consoleView.bot().styledText();
  msg = "Could not get the text from the Console view";
  String text = textWidget.getText();
  msg = "Looking for: '" + searchString + "' but found \n\t------\n\t" + text + "\n\t-----";

  return text.contains(searchString);
}
 
Example #22
Source File: ConditionHelpers.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Condition to wait for a view to become active
 *
 * @param view
 *            bot view for the view
 * @return ICondition for verification
 */
public static ICondition viewIsActive(final SWTBotView view) {
    return new SWTBotTestCondition() {
        @Override
        public boolean test() throws Exception {
            return (view != null) && (view.isActive());
        }

        @Override
        public String getFailureMessage() {
            return view.getTitle() + " view did not become active";
        }
    };
}
 
Example #23
Source File: FlameChartViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static void goToTime(long timestamp) {
    ITmfTimestamp time = TmfTimestamp.fromNanos(timestamp);
    SWTBotTable table = sfBot.activeEditor().bot().table();
    table.setFocus();
    WaitUtils.waitForJobs();
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(table.widget, time));
    sfBot.waitUntil(ConditionHelpers.selectionInEventsTable(sfBot, timestamp));
    final SWTBotView viewBot = sfBot.viewById(FlameChartView.ID);
    IWorkbenchPart part = viewBot.getViewReference().getPart(false);
    sfBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) part, new TmfTimeRange(time, time), time));
}
 
Example #24
Source File: TmfAlignTimeAxisTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static AbstractSWTBot<?> getAlignmentControl(String viewId) {
    SWTBotView viewBot = fBot.viewById(viewId);
    switch (viewId) {
    case HistogramView.ID:
        return new SWTBotSash(viewBot.bot().widget(WidgetOfType.widgetOfType(Sash.class)));
    case TimeGraphViewStub.ID:
    case TimeChartView.ID:
        return new SWTBotTimeGraph(viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class)));
    default:
        return null;
    }
}
 
Example #25
Source File: ResourcesViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test tool bar buttons "Next Marker" and "Previous Marker"
 */
@Test
public void testToolBarSelectNextPreviousMarker() {
    SWTBotView viewBot = getViewBot();
    testNextPreviousMarker(
            () -> viewBot.toolbarButton(NEXT_MARKER).click(),
            () -> viewBot.toolbarButton(NEXT_MARKER).click(SWT.SHIFT),
            () -> viewBot.toolbarButton(PREVIOUS_MARKER).click(),
            () -> viewBot.toolbarButton(PREVIOUS_MARKER).click(SWT.SHIFT));
}
 
Example #26
Source File: FlameChartViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test if callstack is populated
 */
@Test
public void testOpenCallstack() {
    SWTBotView viewBot = sfBot.viewById(FlameChartView.ID);
    viewBot.setFocus();
    waitForSymbolNames("0x40472b");
}
 
Example #27
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 #28
Source File: ProjectExplorerTracesFolderTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Action : Test the import wizard from workbench menu with no project selected
 * <p>
 * <pre>
 * Procedure : 1) Clear selection in Project Explorer view
 *             2) Open import wizard from menu File > Import... > Tracing > Trace Import
 *             3) Browse to directory ${local}/traces/import/
 *             4) Select trace ExampleCustomTxt.log
 *             5) Keep <Auto Detection>, select "Create Links to workspace" and
 *             6) press Finish
 * </pre>
 * <p>
 * Expected Results: Verify that trace is imported to default "Tracing" project and can be opened.
 */
@Test
public void test3_22ImportFromMenuProjectNotSelected() {
    SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);

    SWTBotView projectExplorerBot = fBot.viewByTitle("Project Explorer");
    projectExplorerBot.show();
    projectExplorerBot.bot().waitUntil(Conditions.widgetIsEnabled(projectExplorerBot.bot().tree()));
    projectExplorerBot.bot().tree().unselect();
    SWTBotShell shell = openWorkbenchMenuImport();
    int optionFlags = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
    importTrace(shell, null, null, optionFlags, new ImportConfirmationSupplier(), CUSTOM_TEXT_LOG.getTracePath());
    verifyTrace(CUSTOM_TEXT_LOG, optionFlags, CUSTOM_TEXT_LOG.getTraceName(), CUSTOM_TEXT_LOG.getTraceType(), DEFAULT_PROJECT_NAME);
    SWTBotUtils.deleteProject(DEFAULT_PROJECT_NAME, fBot);
}
 
Example #29
Source File: ControlViewExcludeEventsTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test that the Properties view has been update and shows the the right
 * information.
 */
protected void testPropertiesEventExclude() {
    // Open the properties view (by id)
    SWTBotUtils.openView("org.eclipse.ui.views.PropertySheet");

    // Select the event in the Control view
    fBot.viewById(ControlView.ID).show();
    SWTBotTreeItem eventItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.UST_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME,
            ControlViewSwtBotUtil.ALL_EVENTS_NAME);
    eventItem.select();

    // Get a bot and open the Properties view
    SWTBotView propertiesViewBot = fBot.viewByTitle(PROPERTIES_VIEW);
    propertiesViewBot.show();

    // Get the Exclude field in the tree
    SWTBotTree propertiesViewTree = propertiesViewBot.bot().tree();
    SWTBotTreeItem excludeTreeItem = propertiesViewTree.getTreeItem(EXCLUDE_TREE_ITEM);
    // We want the VALUE of the 'Exclude' row so the cell index is 1
    String excludeExpression = excludeTreeItem.cell(1);

    // Assert that the expression in the Properties view is the same as
    // the one we entered
    assertEquals(EXCLUDE_EXPRESSION, excludeExpression);

    // Close the Properties view
    SWTBotUtils.closeView(PROPERTIES_VIEW, fBot);
}
 
Example #30
Source File: AddProjectNatureTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static void toggleFilters(boolean checked) {
    SWTBotView viewBot = fBot.viewByTitle(PROJECT_EXPLORER_TITLE);
    viewBot.setFocus();

    SWTBotRootMenu viewMenu = viewBot.viewMenu();
    String title = CUSTOMIZE_VIEW_DIALOG_TITLE_4_7;
    try {
        viewMenu.menu(CUSTOMIZE_VIEW_MENU_ITEM_4_7).click();
    } catch (WidgetNotFoundException e) {
        viewMenu.menu(CUSTOMIZE_VIEW_MENU_ITEM_4_6).click();
        title = CUSTOMIZE_VIEW_DIALOG_TITLE_4_6;
    }
    SWTBotShell shell = fBot.shell(title).activate();
    // Select first cTabItem which has name 'Filters' in 4.10 or older, and 'Pre-set filters' starting with 4.11
    shell.bot().cTabItem(0).activate();

    SWTBotTable table = shell.bot().table();
    SWTBotTableItem item = table.getTableItem(CUSTOMIZE_VIEW_RESOURCES_FILTER);
    item.select();
    if (checked != item.isChecked()) {
        item.toggleCheck();
    }
    item = table.getTableItem(CUSTOMIZE_VIEW_SHADOW_FILTER);
    item.select();
    if (checked != item.isChecked()) {
        item.toggleCheck();
    }

    shell.bot().button(OK_BUTTON).click();
}