Search in sources :

Example 26 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.

the class ImportRPMsPageTest method setUpBeforeClass.

/**
 * Initialize the test project.
 *
 * @throws CoreException
 */
@BeforeClass
public static void setUpBeforeClass() throws CoreException {
    testProject = new TestCreaterepoProject();
    assertTrue(testProject.getProject().exists());
    bot = new SWTWorkbenchBot();
    try {
        bot.shell(ICreaterepoTestConstants.MAIN_SHELL).activate();
    } catch (WidgetNotFoundException e) {
    // cannot activate main shell, continue anyways
    }
    monitor = new NullProgressMonitor();
    TestUtils.openResourcePerspective(bot);
    navigator = TestUtils.enterProjectFolder(bot);
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) BeforeClass(org.junit.BeforeClass)

Example 27 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.

the class RepoFormEditorTest method setUpBeforeClass.

/**
 * Initialize the test project.
 *
 * @throws CoreException
 */
@BeforeClass
public static void setUpBeforeClass() throws CoreException {
    testProject = new TestCreaterepoProject();
    assertTrue(testProject.getProject().exists());
    bot = new SWTWorkbenchBot();
    try {
        bot.shell(ICreaterepoTestConstants.MAIN_SHELL).activate();
    } catch (WidgetNotFoundException e) {
    // cannot activate main shell, continue anyways
    }
    TestUtils.openResourcePerspective(bot);
    navigator = TestUtils.enterProjectFolder(bot);
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) BeforeClass(org.junit.BeforeClass)

Example 28 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.

the class CreaterepoDeltaPropertyPageTest method setUpBeforeClass.

/**
 * Initialize the test project.
 *
 * @throws CoreException
 */
@BeforeClass
public static void setUpBeforeClass() throws CoreException {
    testProject = new TestCreaterepoProject();
    assertTrue(testProject.getProject().exists());
    bot = new SWTWorkbenchBot();
    testProject.restoreDefaults();
    try {
        bot.shell(ICreaterepoTestConstants.MAIN_SHELL).activate();
    } catch (WidgetNotFoundException e) {
    // cannot activate main shell, continue anyways
    }
    TestUtils.openResourcePerspective(bot);
    navigator = TestUtils.enterProjectFolder(bot);
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) TestCreaterepoProject(org.eclipse.linuxtools.internal.rpm.createrepo.form.tests.TestCreaterepoProject) BeforeClass(org.junit.BeforeClass)

Example 29 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.

the class AbstractSWTBotTest method setUpWorkbench.

@BeforeClass
public static void setUpWorkbench() throws Exception {
    SWTWorkbenchBot 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
    }
    // Set C/C++ perspective.
    bot.perspectiveByLabel("C/C++").activate();
    bot.sleep(500);
    for (SWTBotShell sh : bot.shells()) {
        if (sh.getText().startsWith("C/C++")) {
            sh.activate();
            bot.sleep(500);
            break;
        }
    }
    // Turn off automatic building by default to avoid timing issues
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceDescription desc = workspace.getDescription();
    boolean isAutoBuilding = desc.isAutoBuilding();
    if (isAutoBuilding) {
        desc.setAutoBuilding(false);
        workspace.setDescription(desc);
    }
    projectExplorer = bot.viewByTitle("Project Explorer");
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) IWorkspaceDescription(org.eclipse.core.resources.IWorkspaceDescription) IWorkspace(org.eclipse.core.resources.IWorkspace) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) BeforeClass(org.junit.BeforeClass)

Example 30 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.

the class AbstractSWTBotTest method compareWithEachOther.

/**
 * Compare The selected items in PROJ_NAME with each other
 * @param The name of a tree item to select
 * @param The name of a second tree item to select
 */
public void compareWithEachOther(String first, String second) {
    SWTWorkbenchBot bot = new SWTWorkbenchBot();
    enterProjectFolder(bot);
    // Refresh and Select
    SWTBotTree treeBot = projectExplorer.bot().tree();
    treeBot.contextMenu("Refresh").click();
    treeBot.select(new String[] { first, second });
    // Workaround for context menu on multiple selections
    click(ContextMenuHelper.contextMenu(treeBot, "Compare With", "Each Other"));
    exitProjectFolder(bot);
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)

Aggregations

SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)37 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)15 BeforeClass (org.junit.BeforeClass)15 Test (org.junit.Test)10 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)8 SWTBotEclipseEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor)5 AbstractRefactoringSwtBotTest (org.eclipse.xtend.ide.tests.AbstractRefactoringSwtBotTest)5 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)5 DockerClient (com.spotify.docker.client.DockerClient)4 DockerConnection (org.eclipse.linuxtools.internal.docker.core.DockerConnection)4 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)4 SWTBotMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)4 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 SWTUtils (org.eclipse.linuxtools.internal.docker.ui.testutils.swt.SWTUtils)3 Before (org.junit.Before)3 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 IWorkspace (org.eclipse.core.resources.IWorkspace)2 IWorkspaceDescription (org.eclipse.core.resources.IWorkspaceDescription)2