Java Code Examples for org.eclipse.swtbot.swt.finder.widgets.SWTBotText#setText()

The following examples show how to use org.eclipse.swtbot.swt.finder.widgets.SWTBotText#setText() . 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: BotBdmModelEditor.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public BotBdmModelEditor addAttribute(String packageName, String businessObject, String attribute, String type) {
    SWTBotTable attributeTable = getAttributeTable(packageName, businessObject);
    attributeTable.unselect();
    bot.waitUntil(new DefaultCondition() {

        @Override
        public boolean test() throws Exception {
            return attributeTable.selectionCount() == 0;
        }

        @Override
        public String getFailureMessage() {
            return "Attribute table should have no selection";
        }
    });
    bot.toolbarButtonWithId(AttributeEditionControl.ADD_ATTRIBUTE_BUTTON_ID).click();
    SWTBotText botText = bot.textWithId(SWTBOT_ID_ATTRIBUTE_NAME_TEXTEDITOR);
    botText.setText(attribute);
    botText.pressShortcut(Keystrokes.CR);

    setType(packageName, businessObject, attributeTable.getTableItem(attribute), type, attributeTable);
    return this;
}
 
Example 2
Source File: TestWizardUI.java    From aCute with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testRelinkingSetsName() {
	openWizard();
	SWTBotText nameText = bot.textWithLabel("Project name");
	SWTBotToggleButton linkButton = bot.toggleButton(0);
	linkButton.click();
	assertTrue("Name field did not enable after unlinking",nameText.isEnabled());

	nameText.setText("DifferentProjectName");
	bot.textWithLabel("Location").setText("/new/directory/with/expectedProjectName");
	linkButton.click();

	assertFalse("Name field did not disable after linking",nameText.isEnabled());
	assertEquals("Name field did not update content after linking", "expectedProjectName", nameText.getText());

	bot.button("Cancel").click();
}
 
Example 3
Source File: ViewsResponseTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private void renameTrace(String oldName, String newName) {

        SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME), oldName);

        traceItem.contextMenu().menu("Rename...").click();
        final String RENAME_TRACE_DIALOG_TITLE = "Rename Trace";
        SWTBotShell shell = fBot.shell(RENAME_TRACE_DIALOG_TITLE).activate();
        SWTBotText text = shell.bot().textWithLabel("New Trace name:");
        text.setText(newName);
        shell.bot().button("OK").click();
        fBot.waitUntil(Conditions.shellCloses(shell));
        fBot.waitWhile(new ConditionHelpers.ActiveEventsEditor(fBot, null));

        SWTBotTreeItem copiedItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME), newName);
        copiedItem.contextMenu().menu("Open").click();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
        WaitUtils.waitForJobs();
    }
 
Example 4
Source File: SwtBotProjectHelper.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
public static SWTBotEclipseEditor newJavaEditor(final SWTWorkbenchBot it, final String typeName, final String packageName, final String sourceFolderPath) {
  SWTBotEclipseEditor _xblockexpression = null;
  {
    SwtBotProjectHelper.fileNew(it, "Class");
    it.shell("New Java Class").activate();
    SWTBotText _textWithLabel = it.textWithLabel("Source folder:");
    _textWithLabel.setText(sourceFolderPath);
    SWTBotText _textWithLabel_1 = it.textWithLabel("Package:");
    _textWithLabel_1.setText(packageName);
    SWTBotText _textWithLabel_2 = it.textWithLabel("Name:");
    _textWithLabel_2.setText(typeName);
    it.button("Finish").click();
    _xblockexpression = it.editorByTitle((typeName + ".java")).toTextEditor();
  }
  return _xblockexpression;
}
 
Example 5
Source File: OrganizationCreationTest.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void addNewUSer(final String username, final String firstName, final String lastName, final String manager,
        final List<String[]> memberShip) {
    bot.button(Messages.add).click();
    bot.tabItem(Messages.general).activate();
    final SWTBotText usernameText = bot.textWithLabel(Messages.userName + " *");
    usernameText.setText("");
    usernameText.setText(username);
    if (manager != null && !manager.isEmpty()) {
        bot.comboBoxWithLabel(Messages.manager).setSelection(manager);
    }
    bot.textWithLabel(Messages.firstName).typeText(firstName);
    bot.textWithLabel(Messages.lastName).typeText(lastName);
    bot.tabItem(Messages.membership + " *").activate();
    for (int i = 0; i < memberShip.size(); i++) {
        if (i > 0) {
            bot.button(Messages.addMembership).click();
        }
        bot.comboBoxWithLabel("Group", i * 2).setSelection(
                memberShip.get(i)[0]);
        bot.comboBoxWithLabel("Role", i * 2).setSelection(
                memberShip.get(i)[1]);
    }
}
 
Example 6
Source File: ProjectExplorerTraceActionsTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test renaming of traces that are created with file system symbolic links.
 *
 * @throws CoreException
 *          If error happens
 * @throws TmfTraceImportException
 *          If error happens
 */
@Test
public void testRenameSymbolicLinks() throws CoreException, TmfTraceImportException {
    // Close editor from @Before since not needed
    fBot.closeAllEditors();

    // Create File system symbolic link to traces
    importTraceAsSymlink();
    SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), SYMBOLIC_FOLDER_NAME, TRACE_NAME);
    fBot.viewByTitle(PROJECT_EXPLORER_VIEW_NAME).setFocus();
    traceItem.doubleClick();
    fBot.waitUntil(new ConditionHelpers.ActiveEventsEditor(fBot, SYMBOLIC_FOLDER_NAME + '/' + TRACE_NAME));

    traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), SYMBOLIC_FOLDER_NAME, TRACE_NAME);
    traceItem.contextMenu().menu("Rename...").click();
    final String RENAME_TRACE_DIALOG_TITLE = "Rename Trace";
    SWTBotShell shell = fBot.shell(RENAME_TRACE_DIALOG_TITLE).activate();
    SWTBotText text = shell.bot().textWithLabel("New Trace name:");
    text.setText(RENAMED_TRACE_NAME);
    shell.bot().button("OK").click();
    fBot.waitUntil(Conditions.shellCloses(shell), DISK_ACCESS_TIMEOUT);
    fBot.waitWhile(new ConditionHelpers.ActiveEventsEditor(fBot, null));

    SWTBotTreeItem copiedItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), SYMBOLIC_FOLDER_NAME, RENAMED_TRACE_NAME);
    copiedItem.contextMenu().menu("Open").click();
    SWTBotImportWizardUtils.testEventsTable(fBot, SYMBOLIC_FOLDER_NAME + '/' + RENAMED_TRACE_NAME, CUSTOM_TEXT_LOG.getNbEvents(), CUSTOM_TEXT_LOG.getFirstEventTimestamp());

    // Make sure that the traces have the correct link status
    testLinkStatus(copiedItem, true);
}
 
Example 7
Source File: DiagramProjectExplorerBot.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Duplicate a diagram. The behavior is to add '-copy' at the end of the original name.
 * WARNING: It doesn't work if the diagram to duplicate has several pools (pool Text have all the same id..)
 */
public void duplicateDiagram(String diagramName, String version) {
    clickOnContextualMenu(getDiagramTreeItem(diagramName, version), "Duplicate...");
    bot.waitUntil(Conditions.shellIsActive(org.bonitasoft.studio.common.Messages.openNameAndVersionDialogTitle));
    SWTBotShell activeShell = bot.activeShell();
    activeShell.setFocus();
    bot.textWithId("org.bonitasoft.studio.common.diagram.dialog.name.text").setText(diagramName + "-copy");
    SWTBotText poolText = bot.textWithId("org.bonitasoft.studio.common.diagram.dialog.poolName.text");
    poolText.setText(poolText.getText() + "-copy");
    bot.button(IDialogConstants.OK_LABEL).click();
    bot.waitUntil(Conditions.shellCloses(activeShell));
}
 
Example 8
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 9
Source File: SwtBotProjectHelper.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public static SWTBotShell newXtendProject(final SWTWorkbenchBot it, final String projectName) {
  SWTBotShell _xblockexpression = null;
  {
    final SWTBotShell shell = it.activeShell();
    final Function1<SWTBotView, Boolean> _function = (SWTBotView it_1) -> {
      String _title = it_1.getTitle();
      return Boolean.valueOf(Objects.equal(_title, "Welcome"));
    };
    SWTBotView _findFirst = IterableExtensions.<SWTBotView>findFirst(it.views(), _function);
    if (_findFirst!=null) {
      _findFirst.close();
    }
    it.perspectiveByLabel("Java").activate();
    SwtBotProjectHelper.fileNew(it, "Project...");
    it.shell("New Project").activate();
    SwtBotProjectHelper.expandNode(it.tree(), "Java").select("Java Project");
    it.button("Next >").click();
    SWTBotText _textWithLabel = it.textWithLabel("Project name:");
    _textWithLabel.setText(projectName);
    it.button("Next >").click();
    it.tabItem("Libraries").activate();
    it.button("Add Library...").click();
    it.shell("Add Library").activate();
    it.list().select("Xtend Library");
    it.button("Next >").click();
    it.button("Finish").click();
    it.button("Finish").click();
    _xblockexpression = shell.activate();
  }
  return _xblockexpression;
}
 
Example 10
Source File: ControlViewKernelFilterTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected void testEnableKernelEvent() {
    SWTBotTreeItem sessionItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName());

    sessionItem.select();
    SWTBotMenu menuBot = sessionItem.contextMenu(ControlViewSwtBotUtil.ENABLE_EVENT_DEFAULT_CHANNEL_MENU_ITEM);
    menuBot.click();

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

    shell.bot().radioInGroup(ControlViewSwtBotUtil.GROUP_SELECT_NAME, ControlViewSwtBotUtil.TRACEPOINTS_GROUP_NAME).click();

    SWTBotTree tracepointsTree = shell.bot().tree();
    SWTBotTreeItem allItem = SWTBotUtils.getTreeItem(fBot, tracepointsTree, ControlViewSwtBotUtil.ALL_TREE_NODE);
    allItem.check();

    SWTBotText filterText = shell.bot().textInGroup(ControlViewSwtBotUtil.FILTER_EXPRESSION_LABEL);
    filterText.setText(FILTER_EXPRESSION);
    shell.bot().button(ControlViewSwtBotUtil.DIALOG_OK_BUTTON).click();
    WaitUtils.waitForJobs();

    fBot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME, sessionItem));

    SWTBotTreeItem kernelDomainItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME);
    assertEquals(ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME, kernelDomainItem.getText());

    SWTBotTreeItem channelItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME);
    assertEquals(ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME, channelItem.getText());

    SWTBotTreeItem eventItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME,
            ControlViewSwtBotUtil.ALL_EVENTS_NAME);
    assertEquals(ControlViewSwtBotUtil.ALL_EVENTS_NAME, eventItem.getText());

    ITraceControlComponent comp = ControlViewSwtBotUtil.getComponent(fNode,
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME,
            ControlViewSwtBotUtil.ALL_EVENTS_NAME);
    assertNotNull(comp);
    assertTrue(comp instanceof TraceEventComponent);
    TraceEventComponent event = (TraceEventComponent) comp;
    assertEquals(FILTER_EXPRESSION_DISPLAY, event.getFilterExpression());
}
 
Example 11
Source File: TimeGraphViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Integration test for the time event filtering dialog
 */
@Test
public void testTimegraphEventFiltering() {
    SWTWorkbenchBot bot = fBot;
    resetTimeRange();

    SWTBot viewBot = fViewBot.bot();
    SWTBotTimeGraph timegraph = fTimeGraph;
    assertTrue("timegraph visible", timegraph.isVisible());
    timegraph.setFocus();

    Rectangle bounds = fBounds;

    ImageHelper ref = ImageHelper.grabImage(bounds);

    timegraph.setFocus();
    // Move mouse to middle of the timegraph
    timegraph.moveMouseToWidget();
    // Press '/' to open the filter dialog
    timegraph.pressShortcut(KeyStroke.getInstance('/'));

    SWTBotShell dialogShell = viewBot.shell("Time Event Filter").activate();
    SWTBot shellBot = dialogShell.bot();
    SWTBotText text = shellBot.text();
    text.setText("Hat1");
    bot.waitWhile(fTimeGraphIsDirty);

    timegraph.setFocus();
    ImageHelper filtered = ImageHelper.waitForNewImage(bounds, ref);

    /* Compare with the original, they should be different */
    int refHatCount = ref.getHistogram().count(fHat);
    int filteredHatCount = filtered.getHistogram().count(fHat);
    int refHairCount = ref.getHistogram().count(fHair);
    int filteredHairCount = filtered.getHistogram().count(fHair);
    assertTrue("Count of \"HAT\" did not decrease to non-zero", filteredHatCount < refHatCount && filteredHatCount > 0);
    assertTrue("Count of \"HAIR\" did not decrease to zero", filteredHairCount < refHairCount && filteredHairCount == 0);

    dialogShell = viewBot.shell("Time Event Filter").activate();
    shellBot = dialogShell.bot();
    text = shellBot.text();
    text.setFocus();
    SWTBotUtils.pressShortcut(text, Keystrokes.CR);

    bot.waitWhile(fTimeGraphIsDirty);
    List<String> visibleItems = getVisibleItems(timegraph);
    assertEquals("Fewer entries should be visible here: " + visibleItems, 3, visibleItems.size());
}
 
Example 12
Source File: TimeGraphViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Integration test for the time event filtering dialog
 */
@Test
public void testHideEmptyRows() {
    resetTimeRange();

    SWTBotTimeGraph timegraph = fTimeGraph;
    assertTrue("timegraph visible", timegraph.isVisible());
    timegraph.setFocus();

    /* set time range */
    setWindowRange(49L, 75L);
    SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 17, timegraph, () -> "All entries should be visible here: " + getVisibleItems(timegraph));

    /* hide empty rows (includes a row with only 1 marker) */
    fViewBot.toolbarButton("Hide Empty Rows").click();
    SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 10, timegraph, () -> "Fewer entries should be visible here: " + getVisibleItems(timegraph));

    /* change time range to exclude row with markers */
    setWindowRange(51L, 75L);
    SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 9, timegraph, () -> "Fewer entries should be visible here: " + getVisibleItems(timegraph));

    /* add a time events filter */
    timegraph.setFocus();
    // Move mouse to middle of the timegraph
    timegraph.moveMouseToWidget();
    // Press '/' to open the filter dialog
    timegraph.pressShortcut(KeyStroke.getInstance('/'));

    SWTBot viewBot = fViewBot.bot();
    SWTBotShell dialogShell = viewBot.shell("Time Event Filter").activate();
    SWTBot shellBot = dialogShell.bot();
    SWTBotText text = shellBot.text();
    text.setText("Head3");
    text.setFocus();
    SWTBotUtils.pressShortcut(text, Keystrokes.CR);
    SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 2, timegraph, () -> "Fewer entries should be visible here: " + getVisibleItems(timegraph));

    /* show also empty rows */
    fViewBot.toolbarButton("Hide Empty Rows").click();
    /* All rows will be filtered by time events filter */
    SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 2, timegraph, () -> "Same number of entries should be visible here: " + getVisibleItems(timegraph));

    /* remove time events filter */
    dialogShell = viewBot.shell("Time Event Filter").activate();
    shellBot = dialogShell.bot();
    SWTBotButton button = shellBot.buttonWithTooltip("Close (Esc)");
    button.click();
    SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 17, timegraph, () -> "All entries should be visible here: " + getVisibleItems(timegraph));
}
 
Example 13
Source File: BotImportOtherDialog.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public BotImportOtherDialog setArchive(URL bosURLInClasspath) throws IOException {
    final SWTBotText pathText = bot.textWithLabel(Messages.selectFileToImport);
    pathText.setText(toAbsoluteFilePath(bosURLInClasspath));
    return this;
}
 
Example 14
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 15
Source File: ControlViewKernelFilterTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
private void testEnableKernelFromProviderEvent() {
    SWTBotTreeItem kernelProviderEventItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.PROVIDER_GROUP_NAME,
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.SCHED_SWITCH_EVENT_NAME);

    kernelProviderEventItem.select();
    SWTBotMenu menuBot = kernelProviderEventItem.contextMenu(ControlViewSwtBotUtil.ENABLE_EVENT_MENU_ITEM);
    menuBot.click();

    SWTBotShell shell = fBot.shell(ControlViewSwtBotUtil.ENABLE_EVENT_DIALOG_TITLE).activate();
    SWTBotCCombo sessionCombo = shell.bot().ccomboBoxInGroup(ControlViewSwtBotUtil.SESSION_LIST_GROUP_NAME);
    sessionCombo.setSelection(getSessionName());
    SWTBotText filterText = shell.bot().textInGroup(ControlViewSwtBotUtil.FILTER_EXPRESSION_LABEL);
    filterText.setText(FILTER_EXPRESSION);
    shell.bot().button(ControlViewSwtBotUtil.DIALOG_OK_BUTTON).click();
    WaitUtils.waitForJobs();

    SWTBotTreeItem sessionItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName());

    fBot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME, sessionItem));

    SWTBotTreeItem kernelDomainItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME);
    assertEquals(ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME, kernelDomainItem.getText());

    SWTBotTreeItem channelItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME);
    assertEquals(ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME, channelItem.getText());

    SWTBotTreeItem eventItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME,
            ControlViewSwtBotUtil.SCHED_SWITCH_EVENT_NAME);
    assertEquals(ControlViewSwtBotUtil.SCHED_SWITCH_EVENT_NAME, eventItem.getText());

    ITraceControlComponent comp = ControlViewSwtBotUtil.getComponent(fNode,
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName(),
            ControlViewSwtBotUtil.KERNEL_DOMAIN_NAME,
            ControlViewSwtBotUtil.DEFAULT_CHANNEL_NAME,
            ControlViewSwtBotUtil.SCHED_SWITCH_EVENT_NAME);
    assertNotNull(comp);
    assertTrue(comp instanceof TraceEventComponent);
    TraceEventComponent event = (TraceEventComponent) comp;
    assertEquals(FILTER_EXPRESSION_DISPLAY, event.getFilterExpression());
}
 
Example 16
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 17
Source File: ParameterPassThroughTest.java    From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Test in project properties.
 */
@Test
public void testProject() {
    bot.menu("File").menu("New").menu(GuiUtils.CPP_PROJECT).click();

    SWTBotShell shell = bot.shell("C++ Project");
    shell.activate();
    
    bot.textWithLabel("&Project name:").setText(CR_PROJ);
    bot.tree().getTreeItem("Executable").getNode("Hello World C++ Project").select();
    bot.button(GuiUtils.FINISH).click();

    bot.sleep(GuiUtils.SHORT_WAIT_TIME);

    project = bot.tree().getTreeItem(CR_PROJ);
    project.contextMenu(GuiUtils.ADD_NATURE_MENU).click();
    project.contextMenu(GuiUtils.PROPERTIES).click();

    SWTBotShell propertiesShell = bot.shell(GuiUtils.PROPERTIES_FOR + CR_PROJ);
    propertiesShell.activate();
    bot.tree().getTreeItem(GuiUtils.CODECHECKER).select();
    
    bot.radio(GuiUtils.PROJECT_RADIO).click();

    GuiUtils.setCCBinDir(ccDir, bot);

    SWTBotText display = bot.textWithLabel(CommonGui.CC_FINAL_DISP_LABEL);
    assertThat("Properties page Display is incorrect!", display.getText().startsWith(ccDir.toString()));

    SWTBotText extra = bot.textWithLabel(CommonGui.CC_EXTRA_CMD_LABEL);
    extra.setText(EXTRA);

    assertThat("Display not contains extra parameters", extra.getText().contains(EXTRA));

    GuiUtils.applyCloseProperties(propertiesShell, bot);
    
    project.contextMenu(GuiUtils.PROPERTIES).click();
    propertiesShell = bot.shell(GuiUtils.PROPERTIES_FOR + CR_PROJ);
    propertiesShell.activate();

    extra = bot.textWithLabel(CommonGui.CC_EXTRA_CMD_LABEL);
    assertThat("Display does not contains extra parameters after reopen", extra.getText().contains(EXTRA));

    GuiUtils.applyCloseProperties(propertiesShell, bot);

    GuiUtils.deleteProject(CR_PROJ, true, bot);
}
 
Example 18
Source File: OpenNameAndVersionDiagramForDiagramTest.java    From bonita-studio with GNU General Public License v2.0 3 votes vote down vote up
@Test
public void testOpenNameAndVersionDiagramForDiagram() {

    final SWTWorkbenchBot workbenchBot = new SWTWorkbenchBot();


    SWTBotTestUtil.createNewDiagram(workbenchBot);
    SWTBotTestUtil.createNewDiagram(workbenchBot);

    final SWTGefBot gefBot = new SWTGefBot();
    final SWTBotEditor botEditor = gefBot.activeEditor();
    final SWTBotGefEditor gmfEditor = gefBot.gefEditor(botEditor.getTitle());
    gmfEditor.mainEditPart().click();

    bot.viewById(SWTBotTestUtil.VIEWS_PROPERTIES_PROCESS_GENERAL).show();
    bot.viewById(SWTBotTestUtil.VIEWS_PROPERTIES_PROCESS_GENERAL).setFocus();

    SWTBotTestUtil.selectTabbedPropertyView(bot, "Diagram");
    bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Edit...")));
    bot.button("Edit...").click();

    bot.waitUntil(Conditions.shellIsActive(org.bonitasoft.studio.common.Messages.openNameAndVersionDialogTitle));

    SWTBotText t = bot.textWithLabelInGroup("Name", "Pools");
    t.setText("Pool");

    final SWTBotButton okBtton = bot.button(IDialogConstants.OK_LABEL);

    assertFalse("Ok button is enabled when rename the pool name but the pool name already exist", okBtton.isEnabled());

    t = bot.textWithLabelInGroup("Name", "Pools");
    t.setText("Pool2"+System.currentTimeMillis());

    assertTrue("Ok button is disabled when rename the pool name but the pool name doesn't already exist",
            okBtton.isEnabled());

    okBtton.click();
}
 
Example 19
Source File: MOOSETester.java    From ice with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Enters the specified text into a text widget with the given label,
 * followed by pressing the enter key. This function will cause the test to
 * fail if the text widget with the given label is not enabled.
 * 
 * @param label
 *            The label of the text widget to type in.
 * @param text
 *            The text to be typed.
 */
public void enterText(String label, String text) {
	// Find the appropriate widget
	SWTBotText widget = bot.textWithLabel(label);

	// Type in the text and hit enter
	widget.setText(text);
	widget.pressShortcut(Keystrokes.LF);
}
 
Example 20
Source File: SwtWizardBot.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Write some input in the field with the given label.
 *
 * @param fieldName
 *          the field in which the input is written
 * @param input
 *          an input
 */
public void writeToTextField(final String fieldName, final String input) {
  SWTBotText text = textWithLabel(fieldName);
  text.setText(input);
}