org.eclipse.swtbot.swt.finder.widgets.SWTBotTree Java Examples
The following examples show how to use
org.eclipse.swtbot.swt.finder.widgets.SWTBotTree.
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: SwtBotProjectActions.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
public static void createUiBinder(final SWTWorkbenchBot bot, String projectName, String packageName, String name, boolean generateSampleContent, boolean generateComments) { // Open the list of new project wizards bot.menu("File").menu("New").menu("Other...").click(); // Select the Web App project wizard SWTBotTree projectSelectionTree = bot.tree(); SWTBotTreeItem projectSelectionGoogleTreeItem = SwtBotTreeActions .getUniqueTreeItem(bot, projectSelectionTree, "GWT Classes", "UiBinder").expand(); SwtBotTreeActions.selectTreeItem(bot, projectSelectionGoogleTreeItem, "UiBinder"); bot.button("Next >").click(); // Configure the UiBinder and then create it String sourceFolder = projectName + "/" + SOURCE_FOLDER; bot.textWithLabel("Source folder:").setText(sourceFolder); bot.textWithLabel("Package:").setText(packageName); bot.textWithLabel("Name:").setText(name); SwtBotUtils.setCheckBox(bot.checkBox("Generate sample content"), generateSampleContent); SwtBotUtils.setCheckBox(bot.checkBox("Generate comments"), generateComments); SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("Finish")); }
Example #2
Source File: FetchRemoteTracesTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Test creating a profile, fetching only one trace */ @Test public void testImportOnlyOne() { testImport(() -> { SWTBotTree tree = fBot.tree(); fBot.button("Deselect All").click(); int length = tree.getAllItems().length; assertTrue(length > 0); // Selecting the second trace under node > traceGroup SWTBotTreeItem node = getTreeItem(fBot, tree, new String[] { CONNECTION_NODE_TEXT, TRACE_GROUP_NODE_TEXT }).getNode(1); assertEquals("syslog", node.getText()); node.check(); }, () -> { TmfProjectElement project = TmfProjectRegistry.getProject(ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME), true); fBot.waitUntil(new TraceCountCondition(project, 1)); final TmfTraceFolder tracesFolder = project.getTracesFolder(); assertNotNull(tracesFolder); List<TmfTraceElement> traces = tracesFolder.getTraces(); assertEquals(1, traces.size()); testTrace(traces.get(0), CONNECTION_NODE1_NAME + "/resources/syslog", TRACE_TYPE_SYSLOG); }); }
Example #3
Source File: CoreSwtbotTools.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Open view. * * @param bot * to work with, must not be {@code null} * @param category * the category, must not be {@code null} * @param view * the name of the view, must not be {@code null} */ public static void openView(final SWTWorkbenchBot bot, final String category, final String view) { Assert.isNotNull(bot, ARGUMENT_BOT); Assert.isNotNull(category, "category"); Assert.isNotNull(view, ARGUMENT_VIEW); bot.menu("Window").menu("Show View").menu("Other...").click(); bot.shell("Show View").activate(); final SWTBotTree tree = bot.tree(); for (SWTBotTreeItem item : tree.getAllItems()) { if (category.equals(item.getText())) { CoreSwtbotTools.waitForItem(bot, item); final SWTBotTreeItem[] node = item.getItems(); for (SWTBotTreeItem swtBotTreeItem : node) { if (view.equals(swtBotTreeItem.getText())) { swtBotTreeItem.select(); } } } } assertTrue("View or Category found", bot.button().isEnabled()); bot.button("OK").click(); }
Example #4
Source File: ControlFlowViewSortingTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * UI test of sorting of processes in CFV based on column selection. To verify that the sorting * was executed correctly, the test will use bot.waitUntil() the column content has the right * order. */ @Test public void testColumnSorting() { fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) fViewBot.getViewReference().getPart(false), new TmfTimeRange(TRACE_START_TIME, TRACE_START_TIME), TRACE_START_TIME)); // Create a known state applyFilter(); final SWTBotTree tree = fViewBot.bot().tree(); final SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(fViewBot.bot()); final SWTBotTimeGraphEntry timeGraphEntry = timeGraph.getEntry(TRACE_NAME, SYSTEMD_PROCESS_NAME); timeGraphEntry.select(); testProcessSorting(tree, timeGraph); testTidSorting(tree, timeGraph); testPidSorting(tree, timeGraph); testPtidSorting(tree, timeGraph); testBirthtimeSorting(tree, timeGraph); }
Example #5
Source File: ControlFlowViewSortingTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private void applyFilter() { // Select only certain root nodes and their children but filter out rest SWTBotToolbarButton filterButton = fViewBot.toolbarButton(FILTER_ACTION); filterButton.click(); SWTBotShell shell = fBot.shell(FILTER_DIALOG_TITLE).activate(); SWTBot bot = shell.bot(); SWTBotTree treeBot = bot.tree(); bot.button(UNCHECK_ALL).click(); int checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals("default", 0, checked); // select root nodes and their children checkFilterTreeItems(bot, treeBot, SYSTEMD_PROCESS_NAME); checkFilterTreeItems(bot, treeBot, KTHREAD_PROCESS_NAME); checkFilterTreeItems(bot, treeBot, LTTNG_CONSUMER_PROCESS_NAME); bot.button(OK_BUTTON).click(); }
Example #6
Source File: BotBdmQueriesEditor.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void selectCustomQuery(String queryName) { SWTBotTree tree = getQueryListTree(); tree.select(Messages.customQueriesOption); tree.expandNode(Messages.customQueriesOption); bot.waitUntil(new ConditionBuilder() .withTest(() -> { try { tree.getTreeItem(Messages.customQueriesOption).getNode(queryName); return true; } catch (WidgetNotFoundException e) { return false; } }) .withFailureMessage(() -> String.format("Can't find custom query %s", queryName)) .create()); tree.getTreeItem(Messages.customQueriesOption).getNode(queryName).select(); }
Example #7
Source File: SuperBot.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void confirmShellAddProjectToSession(String project, String[] files) throws RemoteException { SWTBot bot = new SWTBot(); SWTBotShell shell = bot.shell(SHELL_ADD_PROJECTS_TO_SESSION); shell.activate(); // wait for tree update bot.sleep(500); SWTBotTree tree = shell.bot().tree(); selectProjectFiles(tree, project, files); shell.bot().button(FINISH).click(); bot.waitUntil(Conditions.shellCloses(shell)); }
Example #8
Source File: SmartImportBdmIT.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Test public void should_overwrite_when_conflicts_are_not_solvable() throws Exception { BotApplicationWorkbenchWindow workbenchBot = new BotApplicationWorkbenchWindow(bot); ImportBdmWizardBot importBot = workbenchBot.importBDM(); importBot.setArchive(getFileURL("/smartImport/model_conflicting_not_ok.zip")); SWTBotTree importTree = bot.tree(); bot.waitUntil(importBot.treeItemAvailable(importTree, EMPLOYEE_PACKAGE)); bot.waitUntil(importBot.treeItemAvailable(importTree, BUSINESS_PACKAGE)); assertThat(bot.button(org.bonitasoft.studio.ui.i18n.Messages.importLabel).isEnabled()).isTrue(); SWTBotTreeItem businessTreeItem = importTree.getTreeItem(BUSINESS_PACKAGE); SWTBotTreeItem personTreeItem = importTree.getTreeItem(EMPLOYEE_PACKAGE); businessTreeItem.expand(); personTreeItem.expand(); bot.waitUntil(importBot.treeNodeAvailable(businessTreeItem, String.format(org.bonitasoft.studio.businessobject.i18n.Messages.conflictingWithSameObject, LOAN_BO))); bot.waitUntil(importBot.treeNodeAvailable(personTreeItem, String.format(org.bonitasoft.studio.businessobject.i18n.Messages.objectAlreadyExistsInAnotherPackage, PERSON_BO, "com.company.human"))); importBot.doImport(); BusinessObjectModelFileStore fileStore = (BusinessObjectModelFileStore) repositoryStore.getChild("bom.xml", true); assertThat(fileStore.getContent().getBusinessObjects()).extracting(BusinessObject::getQualifiedName) .containsExactlyInAnyOrder(toQualifiedName(BUSINESS_PACKAGE, LOAN_BO), toQualifiedName(EMPLOYEE_PACKAGE, PERSON_BO)); }
Example #9
Source File: SwtBotProjectHelper.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
public static SWTBotTreeItem expandNode(final AbstractSWTBot<?> bot, final String node) { SWTBotTreeItem item = null; if ((bot instanceof SWTBotTree)) { item = ((SWTBotTree)bot).getTreeItem(node); } else { if ((bot instanceof SWTBotTreeItem)) { item = ((SWTBotTreeItem)bot).getNode(node); } } boolean _isExpanded = item.isExpanded(); boolean _not = (!_isExpanded); if (_not) { item.expand(); } return item; }
Example #10
Source File: SwtBotUtils.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
/** * Create a java project with the specified project name. This function opens up the Java * Perspective. * * @param bot The current SWTWorkbenchBot object * @param projectName Name of java project to be created */ public static void createJavaProject(SWTWorkbenchBot bot, String projectName) { // Open Java Perspective bot.perspectiveById("org.eclipse.jdt.ui.JavaPerspective").activate(); // Open the list of new project wizards bot.menu("File").menu("New").menu("Project...").click(); // Select the Java project SWTBotTree projectSelectionTree = bot.tree(); SWTBotTreeItem projectSelectionTreeItem = SwtBotTreeActions.getUniqueTreeItem(bot, projectSelectionTree, "Java", "Java Project"); SwtBotTreeActions.selectTreeItem(bot, projectSelectionTreeItem, "Java Project"); bot.button("Next >").click(); // Configure the project and then create it bot.textWithLabel("Project name:").setText(projectName); SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("Finish")); }
Example #11
Source File: ImportBdmWizardBot.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public ImportBdmWizardBot setImportAction(String packageName, String action) { SWTBotTree tree = bot.tree(); SWTBotShell activeShell = bot.activeShell(); bot.waitUntil(treeItemAvailable(tree, packageName)); SWTBotTreeItem treeItem = tree.getTreeItem(packageName); treeItem.select(); treeItem.click(1); SWTBot activeBot = activeShell.bot(); SWTBotCCombo ccomboBoxInGroup = activeBot.ccomboBoxWithId(SmartImportBdmPage.IMPORT_ACTION_COMBO_EDITOR_ID); activeBot.waitUntil(new ConditionBuilder() .withTest(() -> Stream.of(ccomboBoxInGroup.items()).anyMatch(action::equals)) .withFailureMessage(() -> String.format("Action '%s' not found in combo", action)) .create()); ccomboBoxInGroup.setSelection(action); return this; }
Example #12
Source File: SwtBotProjectActions.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
/** * Creates a java project with the specified project name. * * @param bot the SWTWorkbenchBot * @param projectName the name of the java project to create */ public static void createJavaProject(SWTWorkbenchBot bot, String projectName) { // Open Java Perspective bot.perspectiveById("org.eclipse.jdt.ui.JavaPerspective").activate(); // Open the list of new project wizards bot.menu("File").menu("New").menu("Project...").click(); // Select the Java project SWTBotTree projectSelectionTree = bot.tree(); SWTBotTreeItem projectSelectionGoogleTreeItem = SwtBotTreeActions.getUniqueTreeItem(bot, projectSelectionTree, "Java", "Java Project"); SwtBotTreeActions.selectTreeItem(bot, projectSelectionGoogleTreeItem, "Java Project"); bot.button("Next >").click(); // Configure the project and then create it bot.textWithLabel("Project name:").setText(projectName); SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("Finish")); }
Example #13
Source File: XMLUITests.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @param nodeText */ private void executeTestOnConnector(String nodeText) { gmfEditor.getEditPart("Step1").parent().select().part(); bot.viewById(SWTBotTestUtil.VIEWS_PROPERTIES_PROCESS_GENERAL).show(); SWTBotTestUtil.selectTabbedPropertyView(bot, "Connectors"); bot.button("Add...").click(); final SWTBotTree tree = bot.tree(); tree.expandNode("Bonita", false); final SWTBotTreeItem treeItem = tree.getTreeItem("Bonita"); treeItem.getNode(nodeText).select(); bot.button("Next >").click(); bot.text().setText("setVariableWithXmlTest"); bot.button("Next >").click(); final SWTBotCombo comboBox = bot.comboBox(); comboBox.setSelection("${xmlData}..."); final SWTBotTree tree2 = bot.tree(); tree2.expandNode("Whole variable", false); final SWTBotTreeItem treeItem2 = tree2.getTreeItem("Whole variable"); treeItem2.getNode("Body").select(); bot.button("OK").click(); final String result = comboBox.getText(); bot.button("Cancel").click(); assertEquals("xmlData$/Body", result); }
Example #14
Source File: ConditionHelpers.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Is a tree node available * * @param name * the name of the node * @param tree * the parent tree * @return ICondition for verification */ public static ICondition isTreeNodeAvailable(final String name, final SWTBotTree tree) { return new SWTBotTestCondition() { @Override public boolean test() throws Exception { try { final SWTBotTreeItem[] treeItems = tree.getAllItems(); for (SWTBotTreeItem ti : treeItems) { final String text = ti.getText(); if (text.equals(name)) { return true; } } } catch (Exception e) { } return false; } @Override public String getFailureMessage() { return NLS.bind("No child of tree {0} found with text {1}. Child items: {2}", new String[] { tree.toString(), name, Arrays.toString(tree.getAllItems()) }); } }; }
Example #15
Source File: SWTBotTestUtil.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * 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 #16
Source File: SuperBot.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void confirmShellAddProjectsToSession(String... projectNames) throws RemoteException { SWTBot bot = new SWTBot(); SWTBotShell shell = bot.shell(SHELL_ADD_PROJECTS_TO_SESSION); shell.activate(); // wait for tree update bot.sleep(500); SWTBotTree tree = shell.bot().tree(); for (String projectName : projectNames) tree.getTreeItem(projectName).check(); shell.bot().button(FINISH).click(); bot.waitUntil(Conditions.shellCloses(shell)); }
Example #17
Source File: CountersViewBenchmark.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public void prepareView(SWTBotView view) { SWTBotTree tree = view.bot().tree(); for (SWTBotTreeItem item : tree.getAllItems()) { item.check(); } }
Example #18
Source File: ControlFlowViewSortingTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static void testTidSorting(final SWTBotTree tree, final SWTBotTimeGraph timeGraph) { String[] expected = { SYSTEMD_TID, KTHREAD_TID, LTTNG_CONSUMER_TID }; SWTBotTreeColumn column = tree.header(TID_COLUMN); /* Sort direction Up */ SWTBotTestCondition condition = getSortCondition(TID_COLUMN, TID_COLUMN_ID, expected, timeGraph, false); clickColumn(tree, column, condition); /* Sort direction Down */ condition = getSortCondition(TID_COLUMN, TID_COLUMN_ID, expected, timeGraph, true); clickColumn(tree, column, condition); }
Example #19
Source File: ControlFlowViewSortingTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static void testPtidSorting(final SWTBotTree tree, final SWTBotTimeGraph timeGraph) { SWTBotTreeColumn column = tree.header(PTID_COLUMN); String[] expected = { LTTNG_CONSUMER_PROCESS_NAME, SYSTEMD_PROCESS_NAME, KTHREAD_PROCESS_NAME }; /* Sort direction Up */ SWTBotTestCondition condition = getSortCondition(PTID_COLUMN, PROCESS_COLUMN_ID, expected, timeGraph, false); clickColumn(tree, column, condition); /* Sort direction Down */ String[] expected2 = { SYSTEMD_PROCESS_NAME, KTHREAD_PROCESS_NAME, LTTNG_CONSUMER_PROCESS_NAME }; condition = getSortCondition(PTID_COLUMN, PROCESS_COLUMN_ID, expected2, timeGraph, false); clickColumn(tree, column, condition); }
Example #20
Source File: ControlFlowViewSortingTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static void testBirthtimeSorting(final SWTBotTree tree, final SWTBotTimeGraph timeGraph) { SWTBotTreeColumn column = tree.header(BIRTH_COLUMN); String[] expected = { FormatTimeUtils.formatTime(LTTNG_CONSUMER_BIRTHTIME, TimeFormat.CALENDAR, Resolution.NANOSEC), FormatTimeUtils.formatTime(SYSTEMD_BIRTHTIME, TimeFormat.CALENDAR, Resolution.NANOSEC), FormatTimeUtils.formatTime(KTHREAD_BIRTHTIME, TimeFormat.CALENDAR, Resolution.NANOSEC) }; /* Sort direction Up */ SWTBotTestCondition condition = getSortCondition(BIRTH_COLUMN, BIRTH_COLUMN_ID, expected, timeGraph, false); clickColumn(tree, column, condition); /* Sort direction Down */ condition = getSortCondition(BIRTH_COLUMN, BIRTH_COLUMN_ID, expected, timeGraph, true); clickColumn(tree, column, condition); }
Example #21
Source File: ControlViewTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Test enable event (all tracepoints) on channel level */ protected void testEnableUstEvents() { SWTBotTreeItem channelItem = SWTBotUtils.getTreeItem(fBot, fTree, getNodeName(), ControlViewSwtBotUtil.SESSION_GROUP_NAME, getSessionName(), ControlViewSwtBotUtil.UST_DOMAIN_NAME, UST_CHANNEL_NAME); assertEquals(UST_CHANNEL_NAME, channelItem.getText()); channelItem.select(); SWTBotMenu menuBot = channelItem.contextMenu(ControlViewSwtBotUtil.ENABLE_EVENT_MENU_ITEM); menuBot.click(); SWTBotShell shell = fBot.shell(ControlViewSwtBotUtil.ENABLE_EVENT_DIALOG_TITLE).activate(); SWTBotTree tracepointsTree = shell.bot().tree(); tracepointsTree.select(ControlViewSwtBotUtil.ALL_TREE_NODE); shell.bot().button(ControlViewSwtBotUtil.DIALOG_OK_BUTTON).click(); WaitUtils.waitForJobs(); SWTBotTreeItem eventItem = SWTBotUtils.getTreeItem(fBot, fTree, getNodeName(), ControlViewSwtBotUtil.SESSION_GROUP_NAME, getSessionName(), ControlViewSwtBotUtil.UST_DOMAIN_NAME, UST_CHANNEL_NAME, ControlViewSwtBotUtil.ALL_EVENTS_NAME); assertEquals(ControlViewSwtBotUtil.ALL_EVENTS_NAME, eventItem.getText()); }
Example #22
Source File: ControlViewExcludeEventsTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * 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 #23
Source File: ControlFlowViewSortingTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static void testProcessSorting(final SWTBotTree tree, final SWTBotTimeGraph timeGraph) { SWTBotTreeColumn column = tree.header(PROCESS_COLUMN); String[] expected = { KTHREAD_PROCESS_NAME, LTTNG_CONSUMER_PROCESS_NAME, SYSTEMD_PROCESS_NAME }; /* Sort direction Up */ SWTBotTestCondition condition = getSortCondition(PROCESS_COLUMN, PROCESS_COLUMN_ID, expected, timeGraph, false); clickColumn(tree, column, condition); /* Sort direction Down */ condition = getSortCondition(PROCESS_COLUMN, 0, expected, timeGraph, true); clickColumn(tree, column, condition); }
Example #24
Source File: SwtBotMenuActions.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
public static void openNewMavenProject(SWTWorkbenchBot bot) { openNewOtherProjectDialog(bot); // filter maven options bot.text().setText("maven"); bot.sleep(500); // click on Maven Project SWTBotTree tree = bot.tree(); SWTBotTreeItem[] items = tree.getAllItems(); SwtBotTreeActions.selectTreeItem(bot, items[0], "Maven Project"); // move to next step bot.button("Next >").click(); }
Example #25
Source File: SWTBotImportWizardUtils.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * While in the import wizard, select an item in the file selection control. * The item can be a folder in the left tree or a file in the right table. * The item will be checked. * * @param bot * the SWTBot * @param treePath * the path to the item, ending with a file or folder */ public static void selectItem(SWTBot bot, String... treePath) { SWTBotTree tree = bot.tree(); bot.waitUntil(Conditions.widgetIsEnabled(tree)); if (treePath.length == 0) { return; } if (treePath.length == 1) { SWTBotTreeItem rootNode = SWTBotUtils.getTreeItem(bot, tree, treePath); rootNode.select(); rootNode.check(); return; } String[] parentPath = Arrays.copyOf(treePath, treePath.length - 1); String itemName = treePath[treePath.length - 1]; SWTBotTreeItem folderNode = SWTBotUtils.getTreeItem(bot, tree, parentPath); folderNode.expand(); if (folderNode.getNodes().contains(itemName)) { folderNode = folderNode.getNode(itemName); folderNode.select(); folderNode.check(); } else { folderNode.select(); SWTBotTable fileTable = bot.table(); bot.waitUntil(Conditions.widgetIsEnabled(fileTable)); bot.waitUntil(ConditionHelpers.isTableItemAvailable(itemName, fileTable)); SWTBotTableItem tableItem = fileTable.getTableItem(itemName); tableItem.check(); } }
Example #26
Source File: FlameChartViewTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Test check callstack at a time with sorting, the trace is not sortable, * this is a smoke test */ @Test public void testGoToTimeSortAndCheckStack() { goToTime(TIMESTAMPS[0]); final SWTBotView viewBot = sfBot.viewById(FlameChartView.ID); viewBot.setFocus(); SWTBotTree tree = viewBot.bot().tree(); tree.header(SORT_BY_NAME).click(); tree.header(SORT_BY_ID).click(); tree.header(SORT_BY_START).click(); viewBot.setFocus(); WaitUtils.waitForJobs(); waitForSymbolNames(STACK_FRAMES[0]); }
Example #27
Source File: SWTBotImportWizardUtils.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * While in the import wizard, select the specified directory as a source. * * @param bot * the SWTBot * @param directoryPath * the directory path to set as a source */ public static void selectImportFromDirectory(SWTBot bot, String directoryPath) { SWTBotRadio button = bot.radio("Select roo&t directory:"); button.click(); SWTBotCombo sourceCombo = bot.comboBox(); File traceFolderParent = new File(directoryPath); sourceCombo.setFocus(); sourceCombo.setText(traceFolderParent.getAbsolutePath()); /* the resource tree gets updated when the combo loses focus */ SWTBotTree tree = bot.tree(); tree.setFocus(); }
Example #28
Source File: TraceTypePreferencePageTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static SWTBotShell openTraceTypePreferences() { SWTBotShell preferencesShell = SWTBotUtils.openPreferences(fBot); SWTBot bot = preferencesShell.bot(); SWTBotTree tree = bot.tree(0); SWTBotTreeItem treeNode = tree.getTreeItem("Tracing"); treeNode.select(); treeNode.expand(); bot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable("Trace Types", treeNode)); treeNode = treeNode.getNode("Trace Types"); treeNode.select(); return preferencesShell; }
Example #29
Source File: ProjectExplorerBot.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public SWTBotTree getProjectExplorerTree() { bot.waitUntil( Conditions.waitForWidget( allOf(widgetOfType(Tree.class), withId("org.bonitasoft.studio.application.projectExplorerTree"))), 120000); return bot.treeWithId("org.bonitasoft.studio.application.projectExplorerTree"); }
Example #30
Source File: SWTBotUtils.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Deletes a project * * @param projectName * the name of the tracing project * @param deleteResources * whether or not to deleted resources under the project * @param bot * the workbench bot */ public static void deleteProject(final String projectName, boolean deleteResources, SWTWorkbenchBot bot) { // Wait for any analysis to complete because it might create // supplementary files WaitUtils.waitForJobs(); try { ResourcesPlugin.getWorkspace().getRoot().getProject(projectName).refreshLocal(IResource.DEPTH_INFINITE, null); } catch (CoreException e) { } WaitUtils.waitForJobs(); closeSecondaryShells(bot); WaitUtils.waitForJobs(); if (!ResourcesPlugin.getWorkspace().getRoot().getProject(projectName).exists()) { return; } focusMainWindow(bot.shells()); final SWTBotView projectViewBot = bot.viewById(IPageLayout.ID_PROJECT_EXPLORER); projectViewBot.setFocus(); SWTBotTree treeBot = projectViewBot.bot().tree(); SWTBotTreeItem treeItem = treeBot.getTreeItem(projectName); SWTBotMenu contextMenu = treeItem.contextMenu("Delete"); contextMenu.click(); handleDeleteDialog(deleteResources, bot); WaitUtils.waitForJobs(); }