org.eclipse.swtbot.swt.finder.widgets.SWTBotShell Java Examples
The following examples show how to use
org.eclipse.swtbot.swt.finder.widgets.SWTBotShell.
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: TestConnectorExpression.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Test public void testConnectorExpression() { final String id = "connectorExpressionTest"; createConnectorDefinition(id); SWTBotConnectorTestUtil.activateConnectorTestWizard(bot); bot.text().setText(id); bot.table().select(id); bot.button(IDialogConstants.NEXT_LABEL).click(); SWTBotShell activeShell = bot.activeShell(); bot.toolbarButtonWithId(SWTBOT_ID_EDITBUTTON, 0).click(); bot.table().select("Constant"); bot.text().setText("Hello World"); assertFalse("return type combobox should be disabled", bot.comboBoxWithLabel("Return type").isEnabled()); assertEquals("wrong return type", bot.comboBoxWithLabel("Return type").selection(), String.class.getName()); bot.button(IDialogConstants.OK_LABEL).click(); activeShell.setFocus(); assertEquals("wrong value for input1", bot.textWithLabel("Input1").getText(), "Hello World"); editGroovyEditor(1, "Input2", Boolean.class.getName(), "booleanScriptTest", "1==1;"); editGroovyEditor(2, "Input3", Double.class.getName(), "doubleScriptTest", "(double)9.345+1.256;"); editGroovyEditor(3, "Input4", Float.class.getName(), "floatScriptTest", "(float)9.345+1.256;"); editGroovyEditor(4, "Input5", Integer.class.getName(), "integerScriptTest", "(int)9+10;"); editGroovyEditor(5, "Input6", List.class.getName(), "listScriptTest", "def list=[1,2,3];"); bot.button(IDialogConstants.CANCEL_LABEL).click(); }
Example #2
Source File: SarosPreferences.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public boolean isAccountActive(JID jid) throws RemoteException { try { SWTBotShell shell = preCondition(); shell.bot().sleep(REFRESH_TIME_FOR_ACCOUNT_LIST); String activeAccount = shell.bot().labelInGroup(GROUP_TITLE_XMPP_JABBER_ACCOUNTS).getText(); boolean isActive = activeAccount.startsWith(LABEL_ACTIVE_ACCOUNT_PREFIX) && activeAccount.contains(jid.getBase()); shell.bot().button(CANCEL).click(); shell.bot().waitUntil(SarosConditions.isShellClosed(shell)); return isActive; } catch (Exception e) { log.error(e.getMessage(), e); return false; } }
Example #3
Source File: SWTBotUtils.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Close all non-main shells that are visible. * * @param bot * the workbench bot */ public static void closeSecondaryShells(SWTWorkbenchBot bot) { SWTBotShell[] shells = bot.shells(); SWTBotShell mainShell = getMainShell(shells); if (mainShell == null) { return; } // Close all non-main shell but make sure we don't close an invisible // shell such the special "limbo shell" that Eclipse needs to work Arrays.stream(shells) .filter(shell -> shell != mainShell) .filter(s -> !s.widget.isDisposed()) .filter(SWTBotShell::isVisible) .peek(shell -> log.debug(MessageFormat.format("Closing lingering shell with title {0}", shell.getText()))) .forEach(SWTBotShell::close); }
Example #4
Source File: ViewsResponseTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
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 #5
Source File: ActorFilterDefinitionWizardPageTest.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void createWidget(String widgetId, String widgetType, int inputIndex) throws Exception { SWTBotShell activeShell = bot.activeShell(); bot.button("Add...").click(); assertFalse("button ok should be disabled", bot.button(IDialogConstants.OK_LABEL).isEnabled()); bot.textWithLabel("Widget id*").setText(widgetId); bot.comboBoxWithLabel("Widget type").setSelection(widgetType); if (!widgetType.equals("Group")) { bot.comboBoxWithLabel("Input *").setSelection(inputIndex); } else { assertFalse("inputs combo box should be disabled for Group widget", bot.comboBoxWithLabel("Input *").isEnabled()); } assertTrue("button ok should be enabled", bot.button(IDialogConstants.OK_LABEL).isEnabled()); bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.OK_LABEL)), 5000); bot.button(IDialogConstants.OK_LABEL).click(); activeShell.setFocus(); }
Example #6
Source File: SarosPreferences.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public boolean existsAccount(JID jid) throws RemoteException { try { SWTBotShell shell = preCondition(); shell.bot().sleep(REFRESH_TIME_FOR_ACCOUNT_LIST); String[] items = shell.bot().listInGroup(GROUP_TITLE_XMPP_JABBER_ACCOUNTS).getItems(); for (String item : items) { if ((jid.getBase()).equals(item)) { shell.bot().button(CANCEL).click(); return true; } } shell.bot().button(CANCEL).click(); shell.bot().waitUntil(SarosConditions.isShellClosed(shell)); return false; } catch (Exception e) { log.error(e.getMessage(), e); return false; } }
Example #7
Source File: SuperBot.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void confirmShellAddXMPPAccount(JID jid, String password) throws RemoteException { SWTBotShell shell = new SWTBot().shell(SHELL_ADD_XMPP_JABBER_ACCOUNT); shell.activate(); /* * FIXME with comboBoxInGroup(GROUP_EXISTING_ACCOUNT) you wil get * WidgetNoFoundException. */ shell.bot().comboBoxWithLabel(LABEL_XMPP_JABBER_ID).setText(jid.getBase()); shell.bot().textWithLabel(LABEL_PASSWORD).setText(password); shell.bot().button(FINISH).click(); shell.bot().waitUntil(Conditions.shellCloses(shell)); }
Example #8
Source File: FlameChartViewTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Test loading conflicting mapping files. * * @throws IOException * Missing file */ @Test public void testLoadingMappingFiles() throws IOException { // 1- Open conflicting mapping files URL mapUrlA = CtfTmfTestTraceUtils.class.getResource("cyg-profile-mapping.txt"); URL mapUrlB = CtfTmfTestTraceUtils.class.getResource("dummy-mapping.txt"); String absoluteFileA = FileLocator.toFileURL(mapUrlA).getFile(); String absoluteFileB = FileLocator.toFileURL(mapUrlB).getFile(); String[] overrideFiles = { absoluteFileA, absoluteFileB }; TmfFileDialogFactory.setOverrideFiles(overrideFiles); SWTBotShell shell = openSymbolProviderDialog(); final SWTBot symbolDialog = shell.bot(); symbolDialog.button("Add...").click(); symbolDialog.button("OK").click(); // 2- Ensure symbols are loaded and prioritized sfBot.viewById(FlameChartView.ID).setFocus(); WaitUtils.waitForJobs(); goToTime(TIMESTAMP); waitForSymbolNames("main", "event_loop", "draw_frame", "draw_gears", "drawB"); }
Example #9
Source File: XMLAnalysesManagerPreferencePageTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Test opening up the preference page from context menu of Traces folder */ @Test public void testPreferencePageContextMenu() { SWTBotUtils.createProject(TRACE_PROJECT_NAME); /* Finish waiting for eclipse to load */ WaitUtils.waitForJobs(); /* Open preferences page from context menu */ SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); fBot.viewByTitle(PROJECT_EXPLORER_VIEW_NAME).setFocus(); tracesFolder.contextMenu().menu(MANAGE_XML_ANALYSES_COMMAND_NAME).click(); SWTBotShell shell = SWTBotUtils.anyShellOf(fBot, PREFERENCES_SHELL, MANAGE_XML_ANALYSES_PREF_TITLE_FILTERED).activate(); SWTBot bot = shell.bot(); /* Close preference page*/ SWTBotUtils.pressOKishButtonInPreferences(bot); SWTBotUtils.deleteProject(TRACE_PROJECT_NAME, fBot); }
Example #10
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 #11
Source File: GuiUtils.java From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 | 6 votes |
/** * Changes to CDT project. * * @param perspective * The perspective to be changed to. * @param bot * the workbench bot to be used. */ public static void changePerspectiveTo(String perspective, SWTWorkbenchBot bot) { UIThreadRunnable.syncExec(new VoidResult() { public void run() { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().forceActive(); } }); // Change the perspective via the Open Perspective dialog bot.menu(WINDOW_MENU).menu(PERSP_MENU).menu(OPEN_PERSP).menu(OTHER_MENU).click(); SWTBotShell openPerspectiveShell = bot.shell(OPEN_PERSP); openPerspectiveShell.activate(); // select the dialog bot.table().select(perspective); bot.button("Open").click(); }
Example #12
Source File: ProjectExplorerTracesFolderTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private static void importCustomParsers() { // FIXME: We can't use Manage Custom Parsers > Import because it uses a native dialog. We'll still check that they show up in the dialog CustomTxtTraceDefinition[] txtDefinitions = CustomTxtTraceDefinition.loadAll(getPath("customParsers/ExampleCustomTxtParser.xml")); txtDefinitions[0].save(); CustomXmlTraceDefinition[] xmlDefinitions = CustomXmlTraceDefinition.loadAll(getPath("customParsers/ExampleCustomXmlParser.xml")); xmlDefinitions[0].save(); SWTBotTreeItem traceFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); traceFolder.contextMenu("Manage Custom Parsers...").click(); SWTBotShell shell = fBot.shell(MANAGE_CUSTOM_PARSERS_SHELL_TITLE).activate(); SWTBot shellBot = shell.bot(); // Make sure the custom text trace type is imported shellBot.list().select(CUSTOM_TEXT_LOG.getTraceType()); // Make sure the custom xml trace type is imported shellBot.radio("XML").click(); shellBot.list().select(CUSTOM_XML_LOG.getTraceType()); shellBot.button("Close").click(); shellBot.waitUntil(Conditions.shellCloses(shell), DISK_ACCESS_TIMEOUT); }
Example #13
Source File: FlameChartViewTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Test check callstack at a time with function map * * @throws IOException * Missing file */ @Test public void testGoToTimeAndCheckStackWithNames() throws IOException { goToTime(TIMESTAMPS[0]); final SWTBotView viewBot = sfBot.viewById(FlameChartView.ID); viewBot.setFocus(); URL mapUrl = CtfTmfTestTraceUtils.class.getResource("cyg-profile-mapping.txt"); String absoluteFile = FileLocator.toFileURL(mapUrl).getFile(); TmfFileDialogFactory.setOverrideFiles(absoluteFile); SWTBotShell shell = openSymbolProviderDialog(); SWTBot shellBot = shell.bot(); shellBot.button("Add...").click(); shellBot.button("OK").click(); shellBot.waitUntil(Conditions.shellCloses(shell)); SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot()); SWTBotTimeGraphEntry[] threads = timeGraph.getEntry(TRACE, PROCESS).getEntries(); assertEquals(1, threads.length); assertEquals(THREAD, threads[0].getText(0)); waitForSymbolNames("main", "event_loop", "handle_event"); }
Example #14
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 #15
Source File: FetchRemoteTracesTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Test 8.14: Cancel Import */ @Test public void test_8_14() { SWTBotView projectExplorerBot = fBot.viewByTitle(PROJECT_EXPLORER); projectExplorerBot.show(); SWTBotTreeItem tracesFolderItem = getTracesFolderTreeItem(projectExplorerBot); tracesFolderItem.contextMenu(FETCH_COMMAND_NAME).click(); SWTBotShell shell = fBot.shell(FETCH_SHELL_NAME).activate(); fBot.comboBox().setSelection("TestAllRecursive"); fBot.button("Next >").click(); fBot.button("Finish").click(); fBot.button("Cancel").click(); fBot.waitUntil(Conditions.shellCloses(shell), FETCH_TIME_OUT); WaitUtils.waitForJobs(); /* Can't verify cancelled import, it depends on timing */ }
Example #16
Source File: FetchRemoteTracesTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Test 8.10: Run Profile "TestAllNonRecursive" */ @Test public void test_8_10() { SWTBotView projectExplorerBot = fBot.viewByTitle(PROJECT_EXPLORER); projectExplorerBot.show(); SWTBotTreeItem tracesFolderItem = getTracesFolderTreeItem(projectExplorerBot); tracesFolderItem.contextMenu(FETCH_COMMAND_NAME).click(); SWTBotShell shell = fBot.shell(FETCH_SHELL_NAME).activate(); fBot.comboBox().setSelection("TestAllNonRecursive"); fBot.button("Next >").click(); fBot.button("Finish").click(); fBot.waitUntil(Conditions.shellCloses(shell), FETCH_TIME_OUT); WaitUtils.waitForJobs(); TmfProjectElement project = TmfProjectRegistry.getProject(ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME), true); fBot.waitUntil(new TraceCountCondition(project, 2)); final TmfTraceFolder tracesFolder = project.getTracesFolder(); assertNotNull(tracesFolder); List<TmfTraceElement> traces = tracesFolder.getTraces(); assertEquals(2, traces.size()); testTrace(traces.get(0), CONNECTION_NODE1_NAME + "/resources/syslog", TRACE_TYPE_SYSLOG); testTrace(traces.get(1), CONNECTION_NODE1_NAME + "/resources/unrecognized", null); }
Example #17
Source File: ConnectorDefinitionTranslationsTest.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void createWidget(String widgetId, String widgetType, int inputIndex) throws Exception { SWTBotShell activeShell = bot.activeShell(); bot.button("Add...").click(); assertFalse("button ok should be disabled", bot.button(IDialogConstants.OK_LABEL).isEnabled()); bot.textWithLabel("Widget id*").setText(widgetId); bot.comboBoxWithLabel("Widget type").setSelection(widgetType); if (!widgetType.equals("Group")) { bot.comboBoxWithLabel("Input *").setSelection(inputIndex); } else { assertFalse("inputs combo box should be disabled for Group widget", bot.comboBoxWithLabel("Input *").isEnabled()); } assertTrue("button ok should be enabled", bot.button(IDialogConstants.OK_LABEL).isEnabled()); bot.button(IDialogConstants.OK_LABEL).click(); activeShell.setFocus(); }
Example #18
Source File: TestPatternExpressionViewer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void fillGroovyExpression() { SWTBotShell activeShell = bot.activeShell(); bot.link(Messages.switchEditor).click(Messages.switchEditor.replaceAll("<A>", "").replaceAll("</A>", "")); bot.button(IDialogConstants.YES_LABEL).click(); activeShell.setFocus(); bot.waitUntil(Conditions.shellIsActive(activeShell.getText())); editGroovyEditor(0, "Request", String.class.getName(), "sqlQuery", GROOVY_SQL_QUERY); bot.sleep(1000); bot.button(IDialogConstants.NEXT_LABEL).click(); if (bot.button(IDialogConstants.NEXT_LABEL).isEnabled()) { bot.button(IDialogConstants.NEXT_LABEL).click(); } bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.FINISH_LABEL)), 5000); bot.button(IDialogConstants.FINISH_LABEL).click(); bot.sleep(1000); bot.activeEditor().save(); }
Example #19
Source File: XsemanticsSwtbotTestBase.java From xsemantics with Eclipse Public License 1.0 | 6 votes |
protected void createProjectAndAssertNoErrorMarker(String projectType) throws CoreException { SWTBotMenu fileMenu = bot.menu("File"); SWTBotMenu newMenu = fileMenu.menu("New"); SWTBotMenu projectMenu = newMenu.menu("Project..."); projectMenu.click(); SWTBotShell shell = bot.shell("New Project"); shell.activate(); SWTBotTreeItem xsemanticsNode = bot.tree().expandNode("Xsemantics"); waitForTreeItems(xsemanticsNode); xsemanticsNode.expandNode(projectType).select(); bot.button("Next >").click(); bot.textWithLabel("Project name:").setText(TEST_PROJECT); bot.button("Finish").click(); // creation of a project might require some time bot.waitUntil(shellCloses(shell), SHELL_TIMEOUT); assertTrue("Project doesn't exist", isProjectCreated(TEST_PROJECT)); waitForBuild(); assertNoErrorsInProject(); }
Example #20
Source File: FetchRemoteTracesTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Test 9.1: Cannot connect to remote host (node doesn't exist) */ @Test public void test_9_01() { SWTBotView projectExplorerBot = fBot.viewByTitle(PROJECT_EXPLORER); projectExplorerBot.show(); SWTBotTreeItem tracesFolderItem = getTracesFolderTreeItem(projectExplorerBot); tracesFolderItem.contextMenu(FETCH_COMMAND_NAME).click(); SWTBotShell shell = fBot.shell(FETCH_SHELL_NAME).activate(); fBot.comboBox().setSelection("TestUnknown"); fBot.button("Finish").click(); /* ErrorDialog is inhibited by the platform when running tests */ fBot.button("Cancel").click(); fBot.waitUntil(Conditions.shellCloses(shell), FETCH_TIME_OUT); WaitUtils.waitForJobs(); }
Example #21
Source File: ActorDefinitionTranslationsTest.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void createWidget(String widgetId, String widgetType, int inputIndex) throws Exception { SWTBotShell activeShell = bot.activeShell(); bot.button("Add...").click(); assertFalse("button ok should be disabled", bot.button(IDialogConstants.OK_LABEL).isEnabled()); bot.textWithLabel("Widget id*").setText(widgetId); bot.comboBoxWithLabel("Widget type").setSelection(widgetType); if (!widgetType.equals("Group")) { bot.comboBoxWithLabel("Input *").setSelection(inputIndex); } else { assertFalse("inputs combo box should be disabled for Group widget", bot.comboBoxWithLabel("Input *").isEnabled()); } assertTrue("button ok should be enabled", bot.button(IDialogConstants.OK_LABEL).isEnabled()); bot.button(IDialogConstants.OK_LABEL).click(); activeShell.setFocus(); }
Example #22
Source File: StandardImportAndReadSmokeTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Create a temporary archive from the specified resource. */ private static String createArchive(IResource sourceResource) throws URISyntaxException { IPath exportedPath = sourceResource.getFullPath(); SWTBotTreeItem traceFilesProject = SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME); traceFilesProject.contextMenu("Export...").click(); SWTBotShell activeShell = fBot.shell("Export").activate(); SWTBotTree exportWizardsTree = fBot.tree(); SWTBotTreeItem treeItem = SWTBotUtils.getTreeItem(fBot, exportWizardsTree, "General", "Archive File"); treeItem.select(); fBot.button("Next >").click(); fBot.button("&Deselect All").click(); try { String resolveLinkedResLabel = "Resolve and export linked resources"; fBot.waitUntil(Conditions.waitForWidget(withMnemonic(resolveLinkedResLabel)), 100); fBot.checkBox(resolveLinkedResLabel).select(); } catch (TimeoutException e) { // Ignore, doesn't exist pre-4.6M5 } if (sourceResource instanceof IFile) { String[] folderPath = exportedPath.removeLastSegments(1).segments(); String fileName = exportedPath.lastSegment(); SWTBotImportWizardUtils.selectFile(fBot, fileName, folderPath); } else { selectFolder(exportedPath.segments()); } String workspacePath = URIUtil.toFile(URIUtil.fromString(System.getProperty("osgi.instance.area"))).getAbsolutePath(); final String archiveDestinationPath = workspacePath + File.separator + TRACE_PROJECT_NAME + File.separator + GENERATED_ARCHIVE_NAME; fBot.comboBox().setText(archiveDestinationPath); fBot.button("&Finish").click(); fBot.waitUntil(Conditions.shellCloses(activeShell), IMPORT_TIME_OUT); return archiveDestinationPath; }
Example #23
Source File: CheckWizardTestUtil.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Waits until the grammar field combo box is enabled. * * @param wizard * the wizard */ public static void waitForGrammarFieldEnabled(final SwtWizardBot wizard) { boolean wizardIsActive = syncExec(new BoolResult() { @Override public Boolean run() { SWTBotShell wizardShell = wizard.activeShell(); return wizardShell.widget.getData() instanceof WizardDialog; } }); assertTrue("Wizard is active before waiting on grammar field", wizardIsActive); wizard.waitUntil(Conditions.widgetIsEnabled(wizard.comboBoxWithLabel(Messages.GRAMMAR_FIELD_NAME_LABEL)), 2 * SwtWizardBot.SWTBOT_TIMEOUT); }
Example #24
Source File: TestProjectCreation.java From aCute with Eclipse Public License 2.0 | 5 votes |
@Test public void testNewLocation() throws CoreException{ IFolder folder = project.getFolder("TestFolder"); folder.create(false, false, null); SWTBotShell shell = openWizard(); bot.text(0).setText(folder.getLocation().toString()); assertTrue("Updating directory did not set Project name", bot.text(1).getText().equals(folder.getLocation().lastSegment())); newProject = checkProjectCreate(shell, null); }
Example #25
Source File: CheckProjectWizardTest.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Tests that applying the next button changes the wizard page. */ @BugTest("AIG-479") public void testNextButtonChangesPage() { wizard.writeToTextField(Messages.PROJECT_NAME_LABEL, "a.b"); SWTBotShell projectPage = wizard.shell(Messages.PROJECT_WIZARD_WINDOW_TITLE); wizard.changeToNextPage(); SWTBotShell catalogPage = wizard.shell(Messages.PROJECT_WIZARD_WINDOW_TITLE); assertNotSame("Next button changed page", projectPage, catalogPage); }
Example #26
Source File: ProjectExplorerRefreshTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Test Refresh after modifying trace content while trace is opened. * * @throws IOException if an exception occurs */ @Test public void test16_02RefreshOpenedTraceContentModified() throws IOException { SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); SWTBotTreeItem kernelTrace = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, TEST_FILE_KERNEL.getName()); kernelTrace.contextMenu().menu("Open").click(); SWTBotUtils.activateEditor(fBot, TEST_FILE_KERNEL.getName()); tracesFolder.contextMenu().menu("Open As Experiment...", "Generic Experiment").click(); SWTBotUtils.activateEditor(fBot, "Experiment"); SWTBotTreeItem project = SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME); SWTBotTreeItem experiment = SWTBotUtils.getTraceProjectItem(fBot, project, "Experiments", "Experiment"); FileUtils.copyDirectory(TEST_FILE_KERNEL_CLASH, FileUtils.getFile(fTracesFolder, TEST_FILE_KERNEL.getName()), false); // false -> last modified times are copied file time stamps assertTrue(kernelTrace.contextMenu().menuItems().contains("Delete Supplementary Files...")); assertTrue(experiment.contextMenu().menuItems().contains("Delete Supplementary Files...")); refresh(() -> tracesFolder.contextMenu().menu("Refresh").click()); SWTBotShell shell = fBot.shell("Trace Changed"); shell.bot().button("No").click(); assertTrue(kernelTrace.contextMenu().menuItems().contains("Delete Supplementary Files...")); assertTrue(experiment.contextMenu().menuItems().contains("Delete Supplementary Files...")); SWTBotUtils.activateEditor(fBot, TEST_FILE_KERNEL.getName()); SWTBotUtils.activateEditor(fBot, "Experiment"); FileUtils.copyDirectory(TEST_FILE_KERNEL, FileUtils.getFile(fTracesFolder, TEST_FILE_KERNEL.getName()), true); // true -> last modified times are original file time stamps assertTrue(kernelTrace.contextMenu().menuItems().contains("Delete Supplementary Files...")); refresh(() -> tracesFolder.contextMenu().menu("Refresh").click()); shell = fBot.shell("Trace Changed"); shell.bot().button("Yes").click(); SWTBotUtils.waitUntil(treeItem -> !treeItem.contextMenu().menuItems().contains("Delete Supplementary Files..."), kernelTrace, "Supplementary Files did not get deleted"); assertEquals(0, fBot.editors().size()); }
Example #27
Source File: CoreSwtbotTools.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Open a specific Avaloq Prefrences Page. * * @param bot * to work with, must not be {@code null} * @param section * the name of the desired page (e.g. 'Database'), must not be {@code null} */ public static void openAvaloqPreferencesSection(final SWTWorkbenchBot bot, final String section) { Assert.isNotNull(bot, ARGUMENT_BOT); Assert.isNotNull(section, "section"); bot.menu("Window").menu("Preferences").click(); final SWTBotShell shell = bot.shell("Preferences"); shell.activate(); final SWTBotTreeItem item = bot.tree().getTreeItem("Avaloq"); CoreSwtbotTools.waitForItem(bot, item); CoreSwtbotTools.expandNode(bot.tree(), "Avaloq").select(section); }
Example #28
Source File: CtfTmfExperimentTrimmingTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Test setup */ @Before public void setup() { WaitUtils.waitForJobs(); SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME); tracesFolder.contextMenu().menu("Open As Experiment...", "Generic Experiment").click(); SWTBotUtils.activateEditor(fBot, "Experiment"); SWTBotTreeItem project = SWTBotUtils.selectProject(fBot, PROJECT_NAME); SWTBotTreeItem experimentItem = SWTBotUtils.getTraceProjectItem(fBot, project, "Experiments", "Experiment"); experimentItem.select(); TmfTraceManager traceManager = TmfTraceManager.getInstance(); ITmfTrace trace = traceManager.getActiveTrace(); assertTrue(String.valueOf(trace), trace instanceof TmfExperiment); TmfExperiment experiment = (TmfExperiment) trace; assertNotNull(experiment); ITmfProjectModelElement elem = TmfProjectRegistry.findElement(experiment.getResource(), true); assertTrue(elem instanceof TmfExperimentElement); fOriginalExperiment = experiment; TmfTimeRange traceCutRange = getTraceCutRange(experiment); assertNotNull(traceCutRange); fRequestedTraceCutRange = traceCutRange; ITmfTimestamp requestedTraceCutEnd = traceCutRange.getEndTime(); ITmfTimestamp requestedTraceCutStart = traceCutRange.getStartTime(); assertTrue(experiment.getTimeRange().contains(traceCutRange)); TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, requestedTraceCutStart, requestedTraceCutEnd, experiment)); experimentItem.contextMenu("Export Time Selection as New Trace...").click(); SWTBotShell shell = fBot.shell("Export trace section to...").activate(); SWTBot dialogBot = shell.bot(); assertEquals("Experiment", dialogBot.text().getText()); dialogBot.text().setText("Experiment-trimmed"); dialogBot.button("OK").click(); SWTBotEditor newExperiment = fBot.editorByTitle("Experiment-trimmed"); newExperiment.setFocus(); fNewExperiment = traceManager.getActiveTrace(); assertNotNull("No active trace", fNewExperiment); assertEquals("Incorrect active trace", "Experiment-trimmed", fNewExperiment.getName()); WaitUtils.waitForJobs(); }
Example #29
Source File: XMLAnalysesManagerPreferencePageTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Test the import of an invalid file */ @Test public void testImportInvalid() { // Import invalid analysis file SWTBot bot = openXMLAnalysesPreferences().bot(); importAnalysis(bot, 0, TEST_FILES_FOLDER + INVALID_FILES_FOLDER + FILE_IMPORT_INVALID + EXTENSION); // Check that the parsing error pop-up is displayed SWTBotShell popupShell = bot.shell("Import XML analysis file failed.").activate(); popupShell.bot().button("OK").click(); SWTBotUtils.pressOKishButtonInPreferences(bot); }
Example #30
Source File: DeleteApplicationWizardBot.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * click on delete */ @Override public void finish() { bot.waitUntil(Conditions.widgetIsEnabled(bot.button(Messages.delete))); SWTBotShell activeShell = bot.activeShell(); bot.button(Messages.delete).click(); bot.button(IDialogConstants.OK_LABEL).click(); bot.waitUntil(Conditions.shellIsActive(Messages.deleteDoneTitle)); bot.shell(Messages.deleteDoneTitle).activate(); bot.button(IDialogConstants.OK_LABEL).click(); bot.waitUntil(Conditions.shellCloses(activeShell)); }