Java Code Examples for org.eclipse.swtbot.swt.finder.widgets.SWTBotTable#click()
The following examples show how to use
org.eclipse.swtbot.swt.finder.widgets.SWTBotTable#click() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SWTBotCustomChartUtils.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Select the chart type from the dialog maker. * * The chart maker dialog must have been opened by the caller, this method * will put focus on the dialog. * * @param bot * The SWT workbench bot to use * @param chartType * The type of chart to select */ public static void selectChartType(SWTWorkbenchBot bot, ChartType chartType) { ensureDialogFocus(bot); int index = 0; switch (chartType) { case BAR_CHART: index = 0; break; case SCATTER_CHART: index = 1; break; case PIE_CHART: default: throw new IllegalStateException("Unsupported chart type: " + chartType.name()); } // The chart selection table is the first SWTBotTable table = bot.table(CHART_TYPE_TABLE_INDEX); // Click on the row corresponding to the chart type table.click(index, 0); }
Example 2
Source File: SwtBotTestingUtilities.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
/** * Click on all table cells in column {@code col} with the contents {@code value}. Selection * should be the last cell clicked upon. */ public static void clickOnTableCellValue(SWTBotTable table, int col, String value) { String column = table.columns().get(col); for (int row = 0; row < table.rowCount(); row++) { String cellValue = table.cell(row, column); if (cellValue.equals(value)) { table.click(row, col); break; } } }
Example 3
Source File: SwtBotUtils.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
public static void clickOnTableCellValue(SWTBotTable table, int col, String value) { String column = table.columns().get(col); for (int row = 0; row < table.rowCount(); row++) { String cellValue = table.cell(row, column); if (cellValue.equals(value)) { table.click(row, col); break; } } }
Example 4
Source File: BotActorDefinitionPropertySection.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public BotActorDefinitionPropertySection addActor(final String name, final String description) { bot.button(Messages.addActor).click(); final SWTBotTable table = bot.table(); table.click(table.rowCount() - 1, 1); bot.text() .typeText(name) .pressShortcut(Keystrokes.CR); table.click(table.rowCount() - 1, 2); bot.text() .typeText(description) .pressShortcut(Keystrokes.CR); return this; }
Example 5
Source File: ActorFilterDefinitionTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Test public void testAddInputs() throws Exception { final String id = "test5"; final String textLabel = "Definition id *"; final String version = "1.0.0"; final String inputName = "testInput"; final String mandatory = "Mandatory"; final String value = "hello"; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; bot.textWithLabel(textLabel).setText(id); bot.button(IDialogConstants.NEXT_LABEL).click(); bot.button("Add...").click(); bot.button("Add...").click(); bot.button("Add...").click(); bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Remove")), 5000); bot.button("Remove").click(); SWTBotTable table = bot.table(); table.click(0, 0); bot.sleep(500); bot.text(0).setText(inputName); table.click(0, 1); bot.ccomboBox().setSelection(mandatory); Keyboard key = KeyboardFactory.getSWTKeyboard(); key.pressShortcut(Keystrokes.CR); bot.waitUntil(Conditions.widgetIsEnabled(table)); table.click(0, 3); bot.text().setText("hello"); bot.button(IDialogConstants.FINISH_LABEL).click(); ActorFilterDefRepositoryStore store = (ActorFilterDefRepositoryStore) RepositoryManager .getInstance().getRepositoryStore(ActorFilterDefRepositoryStore.class); ConnectorDefinition actorDefinition = store.getDefinition(id, version); assertEquals("wrong number of inputs", actorDefinition.getInput() .size(), 2); Input input = actorDefinition.getInput().get(0); assertEquals("wrong input name", input.getName(), inputName); assertEquals("wrong input value", input.getDefaultValue(), value); assertTrue("input should be mandatory", input.isMandatory()); }
Example 6
Source File: ActorFilterDefinitionWizardPageTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void openActorFilterDefinitionWizardPage(String id) { final String packageLang = "java.lang."; final String packageUtil = "java.util."; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; Keyboard key = KeyboardFactory.getSWTKeyboard(); SWTBotActorFilterUtil.activateActorFilterDefinitionShell(bot); SWTBotActorFilterUtil.createActorFilterDefinition(bot, id, "1.0.0"); bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.NEXT_LABEL)), 5000); bot.button(IDialogConstants.NEXT_LABEL).click(); SWTBotTable table = bot.table(); bot.button("Add...").click(); bot.button("Add...").click(); bot.button("Add...").click(); bot.button("Add...").click(); table.click(1, 2); bot.ccomboBox().setSelection(packageLang + "Boolean"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(2, 2); bot.ccomboBox().setSelection(packageLang + "Double"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(3, 2); bot.ccomboBox().setSelection(packageLang + "Float"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(4, 2); bot.ccomboBox().setSelection(packageLang + "Integer"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(5, 2); bot.ccomboBox().setSelection(packageUtil + "List"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(6, 2); bot.ccomboBox().setSelection(packageUtil + "Map"); key.pressShortcut(Keystrokes.CR); bot.button(IDialogConstants.NEXT_LABEL).click(); }
Example 7
Source File: ConnectorDefinitionTranslationsTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void openConnectorDefinitionWizardPage(String id, String categoryId) throws Exception { SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot); SWTBotConnectorTestUtil.createConnectorDefinition(bot, id, "1.0.0"); SWTBotConnectorTestUtil.createNewCategory(bot, categoryId); bot.button(IDialogConstants.NEXT_LABEL).click(); SWTBotTable table = bot.table(); bot.button("Add...").click(); bot.button("Add...").click(); bot.button("Add...").click(); bot.button("Add...").click(); table.click(1, 2); bot.ccomboBox().setSelection(Boolean.class.getName()); bot.button("Add...").click(); table.click(2, 2); bot.ccomboBox().setSelection(Double.class.getName()); bot.button("Add...").click(); table.click(3, 2); bot.ccomboBox().setSelection(Float.class.getName()); bot.button("Add...").click(); table.click(4, 2); bot.ccomboBox().setSelection(Integer.class.getName()); bot.button("Add...").click(); table.click(5, 2); bot.ccomboBox().setSelection(List.class.getName()); bot.button("Add...").click(); table.click(6, 2); bot.ccomboBox().setSelection(Map.class.getName()); bot.button(IDialogConstants.NEXT_LABEL).click(); }
Example 8
Source File: SWTBotConnectorDefinitionTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Test public void testAddInputs() throws Exception { final String id = "test5"; final String textLabel = "Definition id *"; final String version = "1.0.0"; final String inputName = "testInput"; final String mandatory = "Mandatory"; final String value = "hello"; SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot); bot.textWithLabel(textLabel).setText(id); bot.button(IDialogConstants.NEXT_LABEL).click(); bot.button("Add...").click(); bot.button("Add...").click(); bot.button("Add...").click(); bot.button("Remove").click(); SWTBotTable table = bot.table(); table.click(0, 0); bot.sleep(500); bot.text(0).setText(inputName); table.click(0, 1); bot.ccomboBox().setSelection(mandatory); SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; Keyboard key = KeyboardFactory.getSWTKeyboard(); key.pressShortcut(Keystrokes.CR); bot.waitUntil(Conditions.widgetIsEnabled(table)); table.click(0, 3); bot.text().setText("hello"); bot.button(IDialogConstants.FINISH_LABEL).click(); ConnectorDefRepositoryStore store = (ConnectorDefRepositoryStore) RepositoryManager .getInstance().getRepositoryStore(ConnectorDefRepositoryStore.class); ConnectorDefinition connectorDef = store.getDefinition(id, version); assertEquals("wrong number of inputs", connectorDef.getInput().size(), 2); Input input = connectorDef.getInput().get(0); assertEquals("wrong input name", input.getName(), inputName); assertEquals("wrong input value", input.getDefaultValue(), value); assertTrue("input should be mandatory", input.isMandatory()); }
Example 9
Source File: SWTBotConnectorDefinitionTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Test public void testAddOutputs() throws Exception { final String id = "test6"; final String textLabel = "Definition id *"; final String version = "1.0.0"; final String outputName = "output"; final String type = "java.lang.Boolean"; SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot); bot.textWithLabel(textLabel).setText(id); bot.button(IDialogConstants.NEXT_LABEL).click(); bot.button(IDialogConstants.NEXT_LABEL).click(); bot.button(IDialogConstants.NEXT_LABEL).click(); bot.button("Add...").click(); bot.button("Add...").click(); bot.button("Add...").click(); bot.button("Remove").click(); SWTBotTable table = bot.table(); table.click(0, 0); bot.sleep(500); bot.text(0).setText(outputName); table.click(0, 1); bot.ccomboBox().setSelection(type); Keyboard key = KeyboardFactory.getSWTKeyboard(); key.pressShortcut(Keystrokes.CR); bot.button(IDialogConstants.FINISH_LABEL).click(); ConnectorDefRepositoryStore store = (ConnectorDefRepositoryStore) RepositoryManager .getInstance().getRepositoryStore(ConnectorDefRepositoryStore.class); ConnectorDefinition connectorDef = store.getDefinition(id, version); assertEquals("wrong number of outputs", connectorDef.getOutput().size(), 2); Output output = connectorDef.getOutput().get(0); assertEquals("wrong output name", output.getName(), outputName); assertEquals("wrong type of output", output.getType(), type); }
Example 10
Source File: ConnectorDefinitionWizardPageTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void openConnectorDefinitionWizardPage(String id) { final String packageLang = "java.lang."; final String packageUtil = "java.util."; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; Keyboard key = KeyboardFactory.getSWTKeyboard(); SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot); SWTBotConnectorTestUtil.createConnectorDefinition(bot, id, "1.0.0"); bot.button(IDialogConstants.NEXT_LABEL).click(); SWTBotTable table = bot.table(); bot.button("Add...").click(); bot.button("Add...").click(); bot.button("Add...").click(); bot.button("Add...").click(); table.click(1, 2); bot.ccomboBox().setSelection(packageLang + "Boolean"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(2, 2); bot.ccomboBox().setSelection(packageLang + "Double"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(3, 2); bot.ccomboBox().setSelection(packageLang + "Float"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(4, 2); bot.ccomboBox().setSelection(packageLang + "Integer"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(5, 2); bot.ccomboBox().setSelection(packageUtil + "List"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(6, 2); bot.ccomboBox().setSelection(packageUtil + "Map"); key.pressShortcut(Keystrokes.CR); bot.button(IDialogConstants.NEXT_LABEL).click(); }
Example 11
Source File: CollapseEventsInTableTest.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
/** * Main test case */ @Test public void test() { SWTBotUtils.createProject(TRACE_PROJECT_NAME); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, fTestFile.getAbsolutePath(), COLLAPSE_TRACE_TYPE); SWTBotEditor editorBot = SWTBotUtils.activateEditor(fBot, fTestFile.getName()); SWTBotTable tableBot = editorBot.bot().table(); /* Maximize editor area */ SWTBotUtils.maximize(editorBot.getReference(), tableBot); tableBot.click(1, 0); /* Collapse Events */ SWTBotMenu menuBot = tableBot.contextMenu("Collapse Events"); menuBot.click(); fBot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "7/22", 1, 1)); String cell = tableBot.cell(1, 1); assertEquals("filterString", "7/22", cell); /* Verify first collapsed event */ cell = tableBot.cell(7, 0); assertEquals("1st repeatCount", "+14", cell); cell = tableBot.cell(7, 1); assertEquals("1st Timestamp", "Jan 1 06:06:06", cell); cell = tableBot.cell(7, 2); assertEquals("1st Host", "HostF", cell); cell = tableBot.cell(7, 3); assertEquals("1st Logger", "LoggerF", cell); cell = tableBot.cell(7, 4); assertEquals("1st File", "SourceFile", cell); cell = tableBot.cell(7, 5); assertEquals("1st Line", "9", cell); cell = tableBot.cell(7, 6); assertEquals("1st Message", "Message F", cell); /* Verify second collapsed event */ cell = tableBot.cell(8, 0); assertEquals("2nd repeatCount", "+1", cell); cell = tableBot.cell(8, 1); assertEquals("2nd Timestamp", "Jan 1 06:06:21", cell); cell = tableBot.cell(8, 2); assertEquals("2nd Host", "HostF", cell); cell = tableBot.cell(8, 3); assertEquals("2nd Logger", "LoggerF", cell); cell = tableBot.cell(8, 4); assertEquals("2nd File", "SourceFile", cell); cell = tableBot.cell(8, 5); assertEquals("2nd Line", "10", cell); cell = tableBot.cell(8, 6); assertEquals("2nd Message", "Message D", cell); /* Clear Filter */ menuBot = tableBot.contextMenu("Clear Filters"); menuBot.click(); fBot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "Jan 1 01:01:01", 1, 1)); assertEquals("Timestamp", "Jan 1 01:01:01", tableBot.cell(1, 1)); SWTBotUtils.maximize(editorBot.getReference(), tableBot); fBot.closeAllEditors(); SWTBotUtils.deleteProject(TRACE_PROJECT_NAME, fBot); }
Example 12
Source File: ActorDefinitionTranslationsTest.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private void openActorFilterDefinitionWizardPage(String id) throws Exception { final String packageLang = "java.lang."; final String packageUtil = "java.util."; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; Keyboard key = KeyboardFactory.getSWTKeyboard(); SWTBotActorFilterUtil.activateActorFilterDefinitionShell(bot); bot.textWithLabel("Definition id *").setText(id); SWTBotActorFilterUtil.createNewCategory(bot, "categoryAFDWP1"); bot.button(IDialogConstants.NEXT_LABEL).click(); SWTBotTable table = bot.table(); bot.button("Add...").click(); bot.button("Add...").click(); bot.button("Add...").click(); bot.button("Add...").click(); table.click(1, 2); bot.ccomboBox().setSelection(packageLang + "Boolean"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(2, 2); bot.ccomboBox().setSelection(packageLang + "Double"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(3, 2); bot.ccomboBox().setSelection(packageLang + "Float"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(4, 2); bot.ccomboBox().setSelection(packageLang + "Integer"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(5, 2); bot.ccomboBox().setSelection(packageUtil + "List"); key.pressShortcut(Keystrokes.CR); bot.button("Add...").click(); table.click(6, 2); bot.ccomboBox().setSelection(packageUtil + "Map"); key.pressShortcut(Keystrokes.CR); bot.button(IDialogConstants.NEXT_LABEL).click(); }
Example 13
Source File: OrganizationCreationTest.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * @author Florine Boudin * @throws InterruptedException */ @Test public void addNewUsersInACMETest() throws InterruptedException { // open shell "Manage organization" bot.menu("Organization").menu("Define...").click(); bot.waitUntil(Conditions.shellIsActive(Messages.manageOrganizationTitle)); SWTBotTable table = bot.table(); Assert.assertNotNull(table); // Set Description of the new Organisation final int idxBonita = table.indexOf("ACME (" + Messages.active + ")", 0); Assert.assertTrue("Error: No ACME found in the table", idxBonita != -1); // go to the next shell table.click(idxBonita, 0); for (int i = 0; i < 3; i++) { bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.NEXT_LABEL)), 1000); bot.button(IDialogConstants.NEXT_LABEL).click(); } // in the user shell, get table of user list table = bot.table(); Assert.assertNotNull("Error: No user table found", table); final int nbUsers = table.rowCount(); //add new user Elton John final SWTBotButton addButton = bot.button("Add"); addButton.click(); Assert.assertEquals("Error : wrong number of added users", nbUsers + 1, table.rowCount()); bot.textWithLabel(Messages.userName + " *").setText("elton.john"); bot.textWithLabel(Messages.password + " *").setText("bpm"); bot.comboBoxWithLabel(Messages.manager).setSelection("william.jobs"); Assert.assertEquals("Error: Manager is not selected", "william.jobs", bot.comboBoxWithLabel(Messages.manager).getText()); bot.tabItem("General").activate(); bot.textWithLabel(Messages.firstName).setText("Elton"); bot.textWithLabel(Messages.lastName).setText("John"); Assert.assertEquals("Error: First name user is not setted", "Elton", bot.textWithLabel(Messages.firstName).getText()); Assert.assertEquals("Error: Last name user is not setted", "John", bot.textWithLabel(Messages.lastName).getText()); bot.tabItem(Messages.membership + " *").activate(); bot.comboBoxWithLabel("Group").setSelection("/acme"); bot.comboBoxWithLabel("Role").setSelection("member"); // Finish the user add bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.FINISH_LABEL))); bot.button(IDialogConstants.FINISH_LABEL).click(); bot.waitUntil(Conditions.shellIsActive(Messages.organizationHasBeenModifiedTitle)); bot.button(IDialogConstants.NO_LABEL).click(); }