Search in sources :

Example 1 with SWTBotShell

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project translationstudio8 by heartsome.

the class CreateProjectDemo method createProject.

@Test
public void createProject() throws Exception {
    String projectName = "prjBot-001";
    bot.menu("File").menu("New").click();
    SWTBotShell shell = bot.shell("New");
    shell.activate();
    // From menu open File > New dialog, verify whether the dialog has been opened.
    bot.tree().select("Project");
    SWTBotAssert.assertEnabled(bot.button("Next >"));
    // After selecting Project, the Next button should be enabled.
    bot.button("Next >").click();
    bot.textWithLabel("Project name:").setText(projectName);
    SWTBotAssert.assertEnabled(bot.button("Finish"));
    // Enter the Project Name, then Finish button should be enabled.
    bot.button("Finish").click();
    SWTBotAssert.assertVisible(bot.tree().select(projectName));
// Click Finish button and verify whether the project's been successfully created.
}
Also used : SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test)

Example 2 with SWTBotShell

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project linuxtools by eclipse.

the class PreferencesTest method testPreferencesPage.

@Test
public void testPreferencesPage() {
    SWTWorkbenchBot bot = new SWTWorkbenchBot();
    // Set default tool for "timing" profiling.
    checkDefaultPreference(PROFILING_PREFS_CATEGORY, PROFILING_PREFS_TYPE);
    // Open preferences shell.
    // $NON-NLS-1$
    SWTBotMenu windowsMenu = bot.menu("Window");
    // $NON-NLS-1$
    windowsMenu.menu("Preferences").click();
    // $NON-NLS-1$
    SWTBotShell shell = bot.shell("Preferences");
    shell.activate();
    // Go to "Profiling Categories" preferences page.
    bot.text().setText(PROFILING_PREFS_CATEGORY);
    bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "C/C++", "Profiling", "Categories", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    PROFILING_PREFS_CATEGORY));
    // Get name of default tool to deselect.
    String defaultToolId = ProviderFramework.getProviderIdToRun(null, PROFILING_PREFS_TYPE);
    // $NON-NLS-1$
    String defaultToolName = ProviderFramework.getToolInformationFromId(defaultToolId, "name");
    // Workaround for BZ #344484.
    deselectSelectionByName(defaultToolName, bot);
    // Assert specified tool to select is what we expect and select it.
    SWTBotRadio stubRadio = bot.radio(STUB_LABEL);
    assertNotNull(stubRadio);
    assertEquals(STUB_TOOLTIP, stubRadio.getToolTipText());
    stubRadio.click();
    // $NON-NLS-1$
    bot.button("Apply").click();
    // $NON-NLS-1$
    bot.button("Apply and Close").click();
}
Also used : SWTBotRadio(org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio) SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test) AbstractTest(org.eclipse.linuxtools.profiling.tests.AbstractTest)

Example 3 with SWTBotShell

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project linuxtools by eclipse.

the class CreaterepoPreferencePageTest method openPreferencePage.

/**
 * Open the preference page.
 */
private static void openPreferencePage() {
    // open the preferences window
    bot.menu(ICreaterepoTestConstants.WINDOW).menu(ICreaterepoTestConstants.PREFERENCES).click();
    SWTBotShell shell = bot.shell(ICreaterepoTestConstants.PREFERENCES);
    shell.activate();
    bot.tree().select(ICreaterepoTestConstants.CREATEREPO_CATEGORY);
}
Also used : SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)

Example 4 with SWTBotShell

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project linuxtools by eclipse.

the class TestCreateSystemtapScript method cleanUp.

@After
public void cleanUp() {
    SWTBotShell[] shells = bot.shells();
    for (final SWTBotShell shell : shells) {
        String shellTitle = shell.getText();
        if (shellTitle.length() > 0 && !shellTitle.startsWith("SystemTap IDE") && !shellTitle.startsWith("Quick Access")) {
            UIThreadRunnable.syncExec(() -> {
                if (shell.widget.getParent() != null) {
                    shell.close();
                }
            });
        }
    }
    bot.closeAllEditors();
    mainShell.activate();
}
Also used : SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) After(org.junit.After)

Example 5 with SWTBotShell

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project linuxtools by eclipse.

the class TestCreateSystemtapScript method beforeClass.

@BeforeClass
public static void beforeClass() {
    SWTBotPreferences.TIMEOUT = 20000;
    bot = new SWTWorkbenchBot();
    try {
        bot.viewByTitle("Welcome").close();
        // hide Subclipse Usage stats popup if present/installed
        bot.shell("Subclipse Usage").activate();
        bot.button("Cancel").click();
    } catch (WidgetNotFoundException e) {
        // ignore
        e.printStackTrace();
    }
    prepareTreeSettings();
    // Set SystemTap IDE perspective.
    bot.perspectiveByLabel("SystemTap IDE").activate();
    bot.sleep(5000);
    for (SWTBotShell sh : bot.shells()) {
        if (sh.getText().contains("SystemTap IDE")) {
            mainShell = sh;
            sh.activate();
            bot.sleep(500);
            break;
        }
    }
    // Dismiss "Systemtap not installed" dialog(s) if present.
    try {
        SWTBotShell shell = bot.shell("Cannot Run SystemTap").activate();
        shell.close();
        shell = bot.shell("Cannot Run SystemTap").activate();
        shell.close();
    } catch (WidgetNotFoundException e) {
    // ignore
    }
    // Create a Systemtap project.
    clickMainMenu("File", "New", "Project...");
    SWTBotShell shell = bot.shell("New Project");
    shell.setFocus();
    shell.bot().text().setText("Project");
    bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "General", "Project"));
    bot.button("Next >").click();
    bot.textWithLabel("Project name:").setText(SYSTEMTAP_PROJECT_NAME);
    bot.button("Finish").click();
    bot.waitUntil(Conditions.shellCloses(shell));
    projectExplorer = bot.viewByTitle("Project Explorer");
    projectExplorer.setFocus();
    projectExplorer.bot().tree().select(SYSTEMTAP_PROJECT_NAME).contextMenu("Go Into").click();
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) BeforeClass(org.junit.BeforeClass)

Aggregations

SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)158 Test (org.junit.Test)82 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)46 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)40 Repository (org.eclipse.jgit.lib.Repository)18 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)11 SWTBotTable (org.eclipse.swtbot.swt.finder.widgets.SWTBotTable)11 File (java.io.File)10 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)9 SWTBotText (org.eclipse.swtbot.swt.finder.widgets.SWTBotText)9 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)7 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)7 SWTBotCombo (org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo)7 Path (org.eclipse.core.runtime.Path)6 JobJoiner (org.eclipse.egit.ui.test.JobJoiner)6 Shell (org.eclipse.swt.widgets.Shell)6 SWTBotButton (org.eclipse.swtbot.swt.finder.widgets.SWTBotButton)6 IProject (org.eclipse.core.resources.IProject)5 SWTBotEclipseEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor)5 ICondition (org.eclipse.swtbot.swt.finder.waits.ICondition)5