org.eclipse.swtbot.swt.finder.widgets.SWTBotText Java Examples

The following examples show how to use org.eclipse.swtbot.swt.finder.widgets.SWTBotText. 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: TestUpdatingDefault.java    From aCute with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void TestDefaultExportLocation() {
	final String frameworkString = "netcoreapp1.0";
	String expectedExportSubDirectory = "/bin/Release/"
			+ frameworkString + "/"+ getDefaultRuntime() + "/";
	
	bot.list().select(frameworkString);
	bot.checkBox("Self-Contained Deployment").click();
	bot.radio("Release").click();

	SWTBotText exportLocation = bot.textWithLabel("Location:", 2);
	
	assertTrue("Export location: " + exportLocation.getText() + 
			" does not match: .*" + expectedExportSubDirectory + " after field changes.",
			exportLocation.getText().matches(".*"+expectedExportSubDirectory));
}
 
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: 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 #4
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 #5
Source File: ControlViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private static @NonNull String verifyExperimentNameHandling(SWTBot bot, String aExperimentName) {
    String experimentName = aExperimentName;

    // experiment already exists
    checkFinishButton(bot, false);

    SWTBotText expText = bot.textInGroup(ControlViewSwtBotUtil.OPTION_GROUP_NAME);

    // Invalid experiment name (only whitespaces)
    expText.setText(String.valueOf(' '));
    checkFinishButton(bot, false);

    // Invalid experiment name
    expText.setText(String.valueOf('/'));
    checkFinishButton(bot, false);

    // Set valid experiment name
    experimentName += '_';
    expText.setText(experimentName);
    return experimentName;
}
 
Example #6
Source File: ControlViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test enable UST channel on session level (default values)
 */
protected void testEnableUstChannel() {
    SWTBotTreeItem sessionItem = SWTBotUtils.getTreeItem(fBot, fTree,
            getNodeName(),
            ControlViewSwtBotUtil.SESSION_GROUP_NAME,
            getSessionName());
    sessionItem.select();
    SWTBotMenu menuBot = sessionItem.contextMenu(ControlViewSwtBotUtil.ENABLE_CHANNEL_MENU_ITEM);
    menuBot.click();

    SWTBotShell shell = fBot.shell(ControlViewSwtBotUtil.ENABLE_CHANNEL_DIALOG_TITLE).activate();
    SWTBotText channelText = shell.bot().textWithLabel(ControlViewSwtBotUtil.CHANNEL_NAME_LABEL);
    channelText.setText(UST_CHANNEL_NAME);

    shell.bot().radioInGroup(ControlViewSwtBotUtil.UST_GROUP_NAME, ControlViewSwtBotUtil.DOMAIN_GROUP_NAME).click();
    shell.bot().radioInGroup(ControlViewSwtBotUtil.BUFFERTYPE_PER_UID, ControlViewSwtBotUtil.BUFFERTYPE_GROUP_NAME).click();
    shell.bot().button(ControlViewSwtBotUtil.DIALOG_OK_BUTTON).click();
    WaitUtils.waitForJobs();
    fBot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(ControlViewSwtBotUtil.UST_DOMAIN_NAME, sessionItem));
}
 
Example #7
Source File: XlfEditor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 跳到指定文本段
 * @param segNum
 *            文本段行号
 */
public void gotoSeg(int segNum) {
	getNatTable();
	nattable.click(1, 1);
	int targetRowIndex;
	if (isHorizontalLayout()) {
		targetRowIndex = segNum - 1;
	} else {
		targetRowIndex = (segNum - 1) * 2;
	}
	int selectedRowIndex = nattable.indexOfSelectedRow(positionOfTargetTextColumn());

	// 先判断指定文本段是否已经被选中,若未被选中才继续
	if (segNum != 1 && targetRowIndex != selectedRowIndex) {
		SWTBotText text = editorBot.text(lineNumLastValue);
		text.setText(String.valueOf(segNum));
		text.pressShortcut(Keystrokes.LF);
		lineNumLastValue = String.valueOf(segNum);
		// 确认选中了指定文本段
		bot.waitUntil(new IsSegmentSelected(this, targetRowIndex));
	}
}
 
Example #8
Source File: StandardImportAndReadSmokeTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private @NonNull static String verifyExperimentNameHandling(String aExperimentName) {
    String experimentName = aExperimentName;

    // experiment already exists
    SWTBotImportWizardUtils.checkFinishButton(fBot, false);

    SWTBotText expText = fBot.textInGroup("Options");

    // Invalid experiment name (only whitespaces)
    expText.setText(String.valueOf(' '));
    SWTBotImportWizardUtils.checkFinishButton(fBot, false);

    // Invalid experiment name
    expText.setText(String.valueOf('/'));
    SWTBotImportWizardUtils.checkFinishButton(fBot, false);

    // Set valid experiment name
    experimentName += '_';
    expText.setText(experimentName);
    return experimentName;
}
 
Example #9
Source File: ProjectExplorerTraceActionsTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test that the trace can be renamed with the context menu
 * <p>
 * Action : Rename trace
 * <p>
 * Procedure :Select the Rename menu and provide a new name. Reopen.
 * <p>
 * Expected Results: Trace is renamed. The trace editor is closed.
 */
@Test
public void test4_04Rename() {
    SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_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), RENAMED_TRACE_NAME);
    copiedItem.contextMenu().menu("Open").click();
    SWTBotImportWizardUtils.testEventsTable(fBot, RENAMED_TRACE_NAME, CUSTOM_TEXT_LOG.getNbEvents(), CUSTOM_TEXT_LOG.getFirstEventTimestamp());
}
 
Example #10
Source File: FetchRemoteTracesTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static void createProfile() {
    fBot.button("Add").click();

    // The first tree is the preference "categories" on the left side, we
    // need to skip it
    SWTBotTree tree = fBot.tree(1);

    SWTBotTreeItem treeNode = getTreeItem(fBot, tree, PROFILE_NAME, "name (ssh://userinfo@host:22)");
    treeNode.select();
    SWTBotText uriLabel = fBot.textWithLabel("URI:");
    uriLabel.setText("file://");
    SWTBotText nodeNameLabel = fBot.textWithLabel("Node name:");
    nodeNameLabel.setText(CONNECTION_NODE1_NAME);

    SWTBotTreeItem traceRootNode = treeNode.getNode("/rootpath");
    traceRootNode.select();
    SWTBotText pathLabel = fBot.textWithLabel("Root path:");
    pathLabel.setText(TRACE_LOCATION);
    fBot.checkBox("Recursive").select();

    // Add the ctf file pattern
    treeNode = traceRootNode.getNode(".*");
    treeNode.select();
    SWTBotText filePatternLabel = fBot.textWithLabel("File pattern:");
    filePatternLabel.setText(LTTNG_TRACE_FILE_PATTERN);

    // Add the syslog file pattern
    traceRootNode.contextMenu("New Trace").click();
    treeNode = traceRootNode.getNode(".*");
    treeNode.select();
    filePatternLabel = fBot.textWithLabel("File pattern:");
    filePatternLabel.setText(SYSLOG_FILE_PATTERN);
    SWTBotCombo combo = fBot.comboBoxWithLabel("Trace type:");
    combo.setSelection("Test trace : Test Syslog");

    // Add the wildcard file pattern
    traceRootNode.contextMenu("New Trace").click();

    SWTBotUtils.pressOKishButtonInPreferences(fBot);
}
 
Example #11
Source File: AbstractRefactoringSwtBotTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public void renameInJavaEditor(final SWTBotEclipseEditor javaEditor, final String newName, final String dialogName) {
  final SWTBotMenu renameMenuItem = SwtBotProjectHelper.clickableContextMenu(javaEditor, "Refactor", "Rename...");
  renameMenuItem.click();
  boolean _isUseInlineRefactoring = this.testParams.isUseInlineRefactoring();
  if (_isUseInlineRefactoring) {
    javaEditor.typeText(newName);
    boolean _isUsePreview = this.testParams.isUsePreview();
    if (_isUsePreview) {
      javaEditor.pressShortcut(SWT.CTRL, SWT.CR);
      AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate();
      AbstractRefactoringSwtBotTest.bot.button("OK").click();
    } else {
      javaEditor.pressShortcut(KeyStroke.getInstance(SWT.LF));
    }
  } else {
    SWTBot _bot = AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate().bot();
    final Procedure1<SWTBot> _function = (SWTBot it) -> {
      SWTBotText _textWithLabel = it.textWithLabel("New name:");
      _textWithLabel.setText(newName);
      boolean _isUsePreview_1 = this.testParams.isUsePreview();
      if (_isUsePreview_1) {
        it.button("Next").click();
      }
      it.button("Finish").click();
    };
    ObjectExtensions.<SWTBot>operator_doubleArrow(_bot, _function);
  }
  this.waitForRefactoring(javaEditor);
}
 
Example #12
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 #13
Source File: ParameterPassThroughTest.java    From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Test the global preferences.
 */
@Test
public void testGlobal() {
    SWTBotShell preferencesShell = GuiUtils.getPreferencesTab(CODECHECKER, bot);

    GuiUtils.setCCBinDir(ccDir, bot);

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

    GuiUtils.applyClosePreferences(preferencesShell, bot);
}
 
Example #14
Source File: BotAddConnectorDialog.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Select the variable to store the connector output.
 *
 * @param pVariableId
 */
public void selectOutputVariable(final String pVariableId) {
    final SWTBotText text = bot.text(0);
    text.setFocus();
    bot.toolbarButtonWithId("expressionViewerDropDown", 0).click();
    final SWTBot proposalBot = bot.shellWithId("expressionViewerProposalShell").bot();
    final SWTBotTable proposalTAble = proposalBot.tableWithId("expressionViewerProposalTable");
    proposalTAble.select(pVariableId);; //1st value
    SWTBotTestUtil.pressEnter();
}
 
Example #15
Source File: BotImportBOSDialog.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public BotImportBOSDialog setArchive(URL bosURLInClasspath) throws IOException {
    final SWTBotText pathText = bot.textWithLabel(Messages.selectLocation);
    Display.getDefault().syncExec(() -> {
        try {
            pathText.widget.setText(toAbsoluteFilePath(bosURLInClasspath));
        } catch (final IOException e) {
            throw new RuntimeException(e);
        }
    });
    return this;
}
 
Example #16
Source File: ProjectExplorerTraceActionsTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static void createExperimentCopy(SWTBotTreeItem expItem, boolean deepCopy) {
    fBot.viewByTitle(PROJECT_EXPLORER_VIEW_NAME).setFocus();
    expItem.contextMenu().menu("Copy...").click();
    SWTBotShell shell = fBot.shell(COPY_EXPERIMENT_DIALOG_TITLE).activate();
    SWTBotText text = shell.bot().textWithLabel("New Experiment name:");
    text.setText(RENAMED_EXP_NAME);
    if (deepCopy) {
        text.setText(RENAMED_EXP_DEEP_COPY);
        shell.bot().checkBox(DEEP_COPY_OPTION).click();
    }
    shell.bot().button("OK").click();
    fBot.waitUntil(Conditions.shellCloses(shell), DISK_ACCESS_TIMEOUT);
}
 
Example #17
Source File: ImportDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return 文本信息:用户取消了导入操作;
 */
public SWTBotText msgCancelImport() {
	if (importType.equals(TMX)) {
		return dialogBot.text(TsUIConstants.getString("txtCancelImportTMX"));
	} else {
		return dialogBot.text(TsUIConstants.getString("txtCancelImportTBX"));
	}
}
 
Example #18
Source File: ImportDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return 文本框:TMX/TBX 文件;
 */
public SWTBotText txtWLblFile() {
	if (importType.equals(TMX)) {
	return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblTMXFile"));
	}
	else {
		return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblTBXFile"));
	}
}
 
Example #19
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 #20
Source File: NewProjectDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 文本框:电子邮箱
 */
public SWTBotText txtWLblEMail() {
	return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblProjectEMail"));
}
 
Example #21
Source File: MemoryDatabaseManagementDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 文本框:数据库用户名;
 */
public SWTBotText txtWLblUsername() {
	return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblUsername"));
}
 
Example #22
Source File: MemoryDatabaseManagementDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 文本框:数据库保存路径;
 */
public SWTBotText txtWLblPath() {
	return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblPath"));
}
 
Example #23
Source File: InputDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 文本框(这种对话框通常只有一个文本框);
 */
public SWTBotText txt() {
	return dialogBot.text();
}
 
Example #24
Source File: ImportDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 文本框:数据库;
 */
public SWTBotText txtWLblDatabase() {
	return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblDatabase"));
}
 
Example #25
Source File: ImportDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 文本信息:提示选择要导入的库;
 */
public SWTBotText msgNoDBToImport() {
	return dialogBot.text(TsUIConstants.getString("txtNoDBToImport"));
}
 
Example #26
Source File: ImportDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 文本信息:提示选择要导入的库;
 */
public SWTBotText msgNoDBToImport() {
	return dialogBot.text(TsUIConstants.getString("txtNoDBToImport"));
}
 
Example #27
Source File: DocumentPropertiesView.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 文本框:项目相关信息;
 */
public SWTBotText txtWlblProjectInfo() {
	return viewBot.textWithLabel(TsUIConstants.getString("txtWlblProjectInfo"));
}
 
Example #28
Source File: ProjectSettingDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 文本框:客户;
 */
public SWTBotText txtWLblClient() {
	return dlgBot.textWithLabel(TsUIConstants.getString("txtWLblClient_"));
}
 
Example #29
Source File: ProjectSettingDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 文本框:公司;
 */
public SWTBotText txtWLblCompany() {
	return dlgBot.textWithLabel(TsUIConstants.getString("txtWLblCompany"));
}
 
Example #30
Source File: CreateDatabaseDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return 文本框:数据库名称;
 */
public SWTBotText txtWLblDatabaseName() {
	// return dialogBot.text();
	return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblDatabaseName"));
}