org.eclipse.swtbot.swt.finder.SWTBot Java Examples

The following examples show how to use org.eclipse.swtbot.swt.finder.SWTBot. 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: XMLAnalysesManagerPreferencePageTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test the edit function
 */
@Test
public void testEdit() {
    // Import valid analysis files
    SWTBot bot = openXMLAnalysesPreferences().bot();
    importAnalysis(bot, FILES_EDIT.length, getRelativePaths(VALID_FILES_FOLDER, FILES_EDIT));

    // Open the editor
    SWTBotTable tablebot = bot.table(0);
    tablebot.select(FILES_EDIT);
    bot.button("Edit...").click();

    SWTBotUtils.pressOKishButtonInPreferences(bot);

    // Check that the editors were opened
    // No need to actually check that they are active
    for (String editFile : FILES_EDIT) {
        fBot.editorByTitle(editFile + EXTENSION).isActive();
    }
}
 
Example #2
Source File: FindDialogTestBase.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private static void search(String findText, SearchOptions options, SWTBotButton findButton, SWTBot bot) {
    // set the text to search
    SWTBotCombo findFieldCombo = bot.comboBox();
    findFieldCombo.setText(findText);
    assertTrue("Find combo", findFieldCombo.getText().equals(findText));

    // set the options
    SWTBotRadio directions = options.forwardSearch ? bot.radio("Forward").click() : bot.radio("Backward").click();
    assertTrue("direction", directions.isSelected());

    setCheckButton("Case sensitive", options.caseSensitive, bot);
    setCheckButton("Wrap search", options.wrapSearch, bot);
    setCheckButton("Whole word", options.wholeWord, bot);
    setCheckButton("Regular expression", options.regExSearch, bot);

    findButton.click();
}
 
Example #3
Source File: SarosView.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void waitUntilIsNotInSession() throws RemoteException {
  new SWTBot()
      .waitUntil(
          new DefaultCondition() {
            @Override
            public boolean test() throws Exception {
              return !isInSession();
            }

            @Override
            public String getFailureMessage() {
              return "leaving the session failed";
            }
          });
}
 
Example #4
Source File: SarosView.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void waitUntilIsConnected() throws RemoteException {
  new SWTBot()
      .waitUntil(
          new DefaultCondition() {
            @Override
            public boolean test() throws Exception {
              return isConnected();
            }

            @Override
            public String getFailureMessage() {
              return "unable to connect to server";
            }
          },
          SarosSWTBotPreferences.SAROS_DEFAULT_TIMEOUT);
}
 
Example #5
Source File: AbstractSWTTester.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void beforeAllTests() {
	super.beforeAllTests();

	final Display display = getDisplay();
	// Creating the shell must be done on the UI thread.
	display.syncExec(new Runnable() {
		@Override
		public void run() {
			// Create and open the shell.
			shell = new Shell(display);
			shell.setLayout(new FillLayout());
			shell.open();
		}
	});

	// Initialize static or otherwise shared resources here.

	// Set up the SWTBot for the shell.
	bot = new SWTBot(shell);

	return;
}
 
Example #6
Source File: SarosPreferences.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void createAccount(JID jid, String password) throws RemoteException {
  SWTBotShell preferencesShell = preCondition();

  preferencesShell
      .bot()
      .buttonInGroup(BUTTON_ADD_ACCOUNT, GROUP_TITLE_XMPP_JABBER_ACCOUNTS)
      .click();

  SWTBotShell configurationShell = new SWTBot().shell(SHELL_SAROS_CONFIGURATION);
  configurationShell.activate();

  preferencesShell.bot().buttonInGroup(GROUP_TITLE_CREATE_NEW_XMPP_JABBER_ACCOUNT).click();

  SWTBotShell createAccountShell = new SWTBot().shell(SHELL_CREATE_XMPP_JABBER_ACCOUNT);

  createAccountShell.activate();
  SuperBot.getInstance().confirmShellCreateNewXMPPAccount(jid, password);
  createAccountShell.bot().button(NEXT).click();
  createAccountShell.bot().button(FINISH).click();
  createAccountShell.bot().button(APPLY).click();
  createAccountShell.bot().button(APPLY_AND_CLOSE).click();

  preferencesShell.bot().waitUntil(SarosConditions.isShellClosed(preferencesShell));
}
 
Example #7
Source File: ContextMenusInPEView.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void paste(String target) throws RemoteException {
  ContextMenuHelper.clickContextMenu(tree, MENU_PASTE);
  SWTBotShell shell = new SWTBot().shell(SHELL_COPY_PROJECT);

  shell.activate();
  shell.bot().textWithLabel("Project name:").setText(target);
  shell.bot().button(OK).click();
  shell.bot().waitUntil(Conditions.shellCloses(shell), SarosSWTBotPreferences.SAROS_LONG_TIMEOUT);

  new SWTBot().sleep(1000);
  new SWTBot()
      .waitWhile(
          Conditions.shellIsActive("Progess Information"),
          SarosSWTBotPreferences.SAROS_LONG_TIMEOUT);
}
 
Example #8
Source File: TraceTypePreferencePageTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private static void setTraceTypePreferences(@NonNull String button, @NonNull String... pathToCheck) {
    SWTBot bot = openTraceTypePreferences().bot();
    SWTBotTree treeBot = bot.tree(1);
    if (!button.isEmpty()) {
        bot.button(button).click();
    }

    if (pathToCheck.length > 0) {
        SWTBotTreeItem treeItem = treeBot.expandNode(pathToCheck);
        assertNotNull("Tree item not null", treeItem);
        treeItem.select();
        bot.button(CHECK_SELECTED).click();
    }
    bot.button("Apply").click();
    SWTBotUtils.pressOKishButtonInPreferences(fBot);
}
 
Example #9
Source File: SWTBotTableCombo.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Gets the table item matching the given name.
 *
 * @param itemText the text on the node.
 * @return the table item with the specified text.
 * @throws WidgetNotFoundException if the node was not found.
 * @since 1.3
 */
public SWTBotTableItem getTableItem(final String itemText) throws WidgetNotFoundException {
	try {
		new SWTBot().waitUntil(new DefaultCondition() {
			public String getFailureMessage() {
				return "Could not find node with text " + itemText; //$NON-NLS-1$
			}

			public boolean test() throws Exception {
				return getItem(itemText) != null;
			}
		});
	} catch (TimeoutException e) {
		throw new WidgetNotFoundException("Timed out waiting for table item " + itemText, e); //$NON-NLS-1$
	}
	return new SWTBotTableItem(getItem(itemText));
}
 
Example #10
Source File: FlameChartViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * 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 #11
Source File: ProjectExplorerTracesFolderTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
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 #12
Source File: SWTBotTimeGraphEntry.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected SWTBotRootMenu contextMenu(final Control control) throws WidgetNotFoundException {
    Rectangle bounds = absoluteLocation();
    if (bounds == null) {
        return null;
    }
    UIThreadRunnable.syncExec(new VoidResult() {
        @Override
        public void run() {
            final Event event = new Event();
            event.time = (int) System.currentTimeMillis();
            event.display = control.getDisplay();
            event.widget = control;
            event.x = bounds.x + widget.getTimeDataProvider().getNameSpace() / 2;
            event.y = bounds.y + bounds.height / 2;
            control.notifyListeners(SWT.MenuDetect, event);
        }
    });
    select();

    WaitForObjectCondition<Menu> waitForMenu = Conditions.waitForPopupMenu(control);
    new SWTBot().waitUntilWidgetAppears(waitForMenu);
    return new SWTBotRootMenu(waitForMenu.get(0));
}
 
Example #13
Source File: SWTBotUtils.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Open the preferences dialog and return the corresponding shell. See also
 * {@link #pressOKishButtonInPreferences(SWTBot)} to close the dialog.
 *
 * @param bot
 *            a given workbench bot
 * @param text
 *            an alternative text for the preferences dialog, useful when a
 *            specific preference page was previously selected
 * @return the preferences shell
 */
public static SWTBotShell openPreferences(SWTBot bot, String text) {
    SWTBotShell mainShell = focusMainWindow(bot.shells());
    if (SWTUtils.isMac()) {
        // On Mac, the Preferences menu item is under the application name.
        // For some reason, we can't access the application menu anymore so
        // we use the keyboard shortcut.
        try {
            mainShell.pressShortcut(KeyStroke.getInstance(IKeyLookup.COMMAND_NAME + "+"), KeyStroke.getInstance(","));
        } catch (ParseException e) {
            fail();
        }
    } else {
        mainShell.bot().menu(WINDOW_MENU).menu(PREFERENCES_MENU_ITEM).click();
    }

    if (text != null) {
        return anyShellOf(bot, PREFERENCES_SHELL, text).activate();
    }
    return bot.shell(PREFERENCES_SHELL).activate();
}
 
Example #14
Source File: WidgetUtil.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
public static SWTBotTreeItem getTreeItemWithRegex(
    final SWTBotTree tree, final String... regexNodes) {

  try {
    new SWTBot()
        .waitUntil(
            new DefaultCondition() {
              @Override
              public String getFailureMessage() {
                return "Could not find node matching " + Arrays.asList(regexNodes);
              }

              @Override
              public boolean test() throws Exception {
                return getTreeItem(tree.getAllItems(), regexNodes) != null;
              }
            });
    return getTreeItem(tree.getAllItems(), regexNodes);

  } catch (TimeoutException e) {
    throw new WidgetNotFoundException(
        "Timed out waiting for tree item matching " + Arrays.asList(regexNodes),
        e); //$NON-NLS-1$
  }
}
 
Example #15
Source File: XMLAnalysesManagerPreferencePageTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test the export function
 */
@Test
public void testExport() {
    // Import valid analysis file
    SWTBot bot = openXMLAnalysesPreferences().bot();
    final String fileNameXml = FILE_EXPORT + EXTENSION;
    importAnalysis(bot, 1, TEST_FILES_FOLDER + VALID_FILES_FOLDER + fileNameXml);

    // Setup target folder
    File targetDirectory = new File(TEMP_DIRECTORY);
    DirectoryDialogFactory.setOverridePath(targetDirectory.getAbsolutePath());

    // Export
    SWTBotTable tableBot = bot.table(0);
    tableBot.select(FILE_EXPORT);
    bot.button("Export").click();

    // Check that the file was created
    File targetFile = new File(targetDirectory, fileNameXml);
    assertTrue(targetFile.toString(), targetFile.exists());

    SWTBotUtils.pressOKishButtonInPreferences(bot);
}
 
Example #16
Source File: ConditionBuilder.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public ICondition create() {
    return new ICondition() {

        @Override
        public boolean test() throws Exception {
            return test.get();
        }

        @Override
        public void init(SWTBot bot) {
        }

        @Override
        public String getFailureMessage() {
            return failureMessageSupplier.get();
        }
    };
}
 
Example #17
Source File: SWTBotUtils.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Get the tree item from a parent tree item at the specified location
 *
 * @param bot
 *            the SWTBot
 * @param treeItem
 *            the treeItem to find the tree item under
 * @param nodeNames
 *            the path to the tree item, in the form of node names (from
 *            parent to child).
 * @return the tree item
 */
public static SWTBotTreeItem getTreeItem(SWTBot bot, SWTBotTreeItem treeItem, String... nodeNames) {
    if (nodeNames.length == 0) {
        return treeItem;
    }

    SWTBotTreeItem currentNode = treeItem;
    for (int i = 0; i < nodeNames.length; i++) {
        bot.waitUntil(ConditionHelpers.treeItemHasChildren(treeItem));
        currentNode.expand();

        String nodeName = nodeNames[i];
        try {
            bot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(nodeName, currentNode));
        } catch (TimeoutException e) {
            // FIXME: Sometimes in a JFace TreeViewer, it expands to
            // nothing. Need to find out why.
            currentNode.collapse();
            currentNode.expand();
            bot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(nodeName, currentNode));
        }

        SWTBotTreeItem newNode = currentNode.getNode(nodeName);
        currentNode = newNode;
    }

    return currentNode;
}
 
Example #18
Source File: TmfPerspectiveManagerTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static void setSwitchToPerspectivePreference(String value) {
    SWTBotUtils.openPreferences(fBot);
    SWTBot shellBot = fBot.shell("Preferences").bot();
    shellBot.tree().expandNode("Tracing", "Perspectives").select();
    shellBot.radioInGroup(value, "Open the associated perspective when a trace is opened").click();
    SWTBotUtils.pressOKishButtonInPreferences(fBot);
}
 
Example #19
Source File: NewC.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
private void confirmShellNewFile(String fileName) {
  SWTBotShell shell = new SWTBot().shell(SHELL_NEW_FILE);
  shell.activate();
  shell.bot().textWithLabel(LABEL_FILE_NAME).setText(fileName);
  shell.bot().button(FINISH).click();
  shell.bot().waitUntil(Conditions.shellCloses(shell), SarosSWTBotPreferences.SAROS_LONG_TIMEOUT);
}
 
Example #20
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 #21
Source File: SWTBotTestUtil.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public static void selectExpressionProposal(final SWTBot bot, final String storageExpressionName,
        final String returnType, final int index) {
    bot.toolbarButtonWithId(SWTBOT_ID_EXPRESSIONVIEWER_DROPDOWN, index).click();
    final SWTBotShell proposalShell = bot.shellWithId(SWTBOT_ID_EXPRESSIONVIEWER_PROPOSAL_SHELL);
    final SWTBot proposalBot = proposalShell.bot();
    final SWTBotTable proposalTAble = proposalBot.tableWithId(SWTBOT_ID_EXPRESSIONVIEWER_PROPOSAL_TABLE);
    final int row = proposalTAble.indexOf(storageExpressionName + " -- " + returnType, 0);
    if (row == -1) {
        throw new WidgetNotFoundException(storageExpressionName + " not found in proposals");
    }
    proposalTAble.select(row);
    proposalTAble.pressShortcut(Keystrokes.CR);
    bot.waitUntil(Conditions.shellCloses(proposalShell));
}
 
Example #22
Source File: SWTBotImportWizardUtils.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * 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 #23
Source File: XMLAnalysesManagerPreferencePageTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * 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 #24
Source File: SuperBot.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void confirmShellAddProjectWithNewProject(String projectName) throws RemoteException {

  SWTBot bot = new SWTBot();
  bot.waitUntil(
      Conditions.shellIsActive(SHELL_ADD_PROJECTS), SarosSWTBotPreferences.SAROS_LONG_TIMEOUT);

  SWTBotShell shell = bot.shell(SHELL_ADD_PROJECTS);
  shell.activate();

  shell.bot().radio(RADIO_CREATE_NEW_PROJECT).click();
  shell.bot().textWithLabel("Project name", 0).setText(projectName);
  shell.bot().button(FINISH).click();
  shell.bot().waitUntil(Conditions.shellCloses(shell));
}
 
Example #25
Source File: XMLAnalysesManagerPreferencePageTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test the deletion of files
 */
@Test
public void testDelete() {
    // Import valid analysis file
    SWTBot bot = openXMLAnalysesPreferences().bot();
    importAnalysis(bot, FILES_DELETE.length, getRelativePaths(VALID_FILES_FOLDER, FILES_DELETE));

    SWTBotTable tablebot = bot.table(0);

    // Open editor for first file
    tablebot.select(FILES_DELETE[0]);
    bot.button("Edit...").click();

    // Delete files
    tablebot.select(FILES_DELETE);
    bot.button("Delete").click();

    // Check that the confirmation pop-up is displayed
    SWTBotShell deleteShell = bot.shell("Delete XML file(s)").activate();
    deleteShell.bot().button("Yes").click();

    // Check that the files do not exist anymore
    for (String deleteFile : FILES_DELETE) {
        assertFalse(deleteFile, tablebot.containsItem(deleteFile));
    }

    // Check that the opened editor was closed
    fBot.editors().forEach(editor -> {
        if (editor != null) {
            if (editor.getTitle().equals(FILES_DELETE[0] + EXTENSION)) {
                fail("Editor is still open: " + FILES_DELETE[0] + EXTENSION);
            }
        }
    });

    SWTBotUtils.pressOKishButtonInPreferences(bot);
}
 
Example #26
Source File: ContextMenusInContactListArea.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void addContact(JID jid) throws RemoteException {
  if (!sarosView.isInContactList(jid)) {
    getTreeItem().select();
    ContextMenuHelper.clickContextMenu(tree, CM_ADD_CONTACT);
    SuperBot.getInstance().confirmShellAddContact(jid);
    // wait for tree update in saros session view
    new SWTBot().sleep(500);
  }
}
 
Example #27
Source File: SuperBot.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void confirmShellNewSharedFile(String decision) {
  SWTBot bot = new SWTBot();
  SWTBotShell shell = bot.shell(SHELL_NEW_FILE_SHARED);
  shell.activate();
  shell.bot().button(decision).click();
  bot.waitUntil(Conditions.shellCloses(shell));
}
 
Example #28
Source File: FetchRemoteTracesTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static void openRemoteProfilePreferences() {
    SWTBotShell preferencesShell = SWTBotUtils.openPreferences(fBot);

    // The first tree is the preference "categories" on the left side
    SWTBot bot = preferencesShell.bot();
    SWTBotTree tree = bot.tree(0);
    SWTBotTreeItem treeNode = tree.getTreeItem("Tracing");
    treeNode.select();
    treeNode.expand();
    bot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable("Remote Profiles", treeNode));
    treeNode = treeNode.getNode("Remote Profiles");
    treeNode.select();
}
 
Example #29
Source File: ICEResourcePageTester.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Checks that non-text files that lack an associated IVizService are
 * rendered in the browser.
 */
@Test
public void checkBrowser() {
	// This test can use the shared editor.

	// Create a temporary ICEResource that should be opened in the
	// ICEResourcePage's browser.
	File file = null;
	try {
		file = createTemporaryFile("dsarif.html", "frneticpny");
	} catch (IOException e) {
		fail("ICEResourcePageTester error: "
				+ "Failed to create temporary test file \"" + "dsarif.html"
				+ "\".");
	}
	ICEResource resource = createICEResource(file);

	// Add and show the resource.
	sharedResources.add(resource);
	doubleClickResource(resource);

	// Verify that the file was opened in the browser.
	SWTBot bot = new SWTBot(sharedPage.getPartControl());

	// Remove the resource from the Resources View.
	sharedResources.remove(resource);

	// Delete the temporary file (optional, as they are removed after each
	// test).

	return;
}
 
Example #30
Source File: CtfTmfExperimentTrimmingTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * 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();
}