Search in sources :

Example 36 with SWTBotTreeItem

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

the class BuildDockerImageShortcutSWTBotTest method getRunAsdockerImageBuildContextMenu.

/**
 * @return the {@link SWTBotMenu} for the "Run as > Docker Image Build"
 *         shortcut
 */
private SWTBotMenu getRunAsdockerImageBuildContextMenu(final String projectName, final String dockerFileName) {
    final SWTBotTreeItem fooProjectTreeItem = SWTUtils.getTreeItem(this.projectExplorerViewRule.getProjectExplorerBotView(), projectName);
    assertThat(fooProjectTreeItem).isNotNull();
    SWTUtils.syncExec(() -> fooProjectTreeItem.expand());
    final SWTBotTreeItem dockerfileTreeItem = SWTUtils.getTreeItem(fooProjectTreeItem, dockerFileName);
    assertThat(dockerfileTreeItem).isNotNull();
    SWTUtils.select(dockerfileTreeItem);
    final SWTBotMenu runAsDockerImageBuildMenu = SWTUtils.getContextMenu(this.projectExplorerViewRule.getProjectExplorerBotView().bot().tree(), "Run As", "1 Docker Image Build");
    return runAsDockerImageBuildMenu;
}
Also used : SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)

Example 37 with SWTBotTreeItem

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

the class DockerComposeSWTBotTest method shouldValidateLaunchConfiguration.

@Test
@RunWithProject("foo")
// ignored for now because the "Run" menu from the toolbar remains
@Ignore
public // found.
void shouldValidateLaunchConfiguration() throws CoreException {
    // given
    final DockerClient client = MockDockerClientFactory.build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    final IFile dockerComposeScript = projectInit.getProject().getFile("docker-compose.yml");
    LaunchConfigurationUtils.createDockerComposeUpLaunchConfiguration(dockerConnection, dockerComposeScript);
    // when
    bot.toolbarDropDownButtonWithTooltip("Run").menuItem("Run Configurations...").click();
    final SWTBotTreeItem dockerComposeTreeItem = SWTUtils.expand(bot.tree(), "Docker Compose");
    SWTUtils.select(dockerComposeTreeItem, "Docker Compose [foo]");
    // verify that the config is set and the form can be closed with the
    // "OK" button
    ComboAssertions.assertThat(bot.comboBox(0)).isEnabled().itemSelected("Test");
    TextAssertions.assertThat(bot.text(2)).isEnabled().textEquals("/foo");
    ButtonAssertions.assertThat(bot.button("Run")).isEnabled();
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) IFile(org.eclipse.core.resources.IFile) DockerClient(com.spotify.docker.client.DockerClient) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) Ignore(org.junit.Ignore) Test(org.junit.Test) RunWithProject(org.eclipse.linuxtools.internal.docker.ui.testutils.RunWithProject)

Example 38 with SWTBotTreeItem

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

the class IsProjectNotExist method test.

/** (non-Javadoc)
	 * @see org.eclipse.swtbot.swt.finder.waits.ICondition#test()
	 */
public boolean test() throws Exception {
    boolean result = true;
    SWTBotTreeItem[] items = ProjectTreeView.getTree().getAllItems();
    for (SWTBotTreeItem item : items) {
        if (projectName.equals(item.getText())) {
            result = false;
            break;
        }
    }
    return result;
}
Also used : SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)

Example 39 with SWTBotTreeItem

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

the class ProjectFile method openFile.

/**
	 * @param from
	 *            打开文件的入口:右键菜单、双击,请使用 TS 类提供的常量;
	 */
public void openFile(Entry from) {
    assertTrue("参数错误,Excel 数据行 row 为 null。", row != null);
    getDataFile();
    SWTBotTreeItem item = select();
    assertTrue("如下选择类型不是文件:" + selectType, selectType == TsUIConstants.ResourceType.FILE);
    switch(from) {
        case DOUBLE_CLICK:
            {
                item.doubleClick();
                break;
            }
        case CONTEXT_MENU:
            {
                view.ctxMenuOpenFile().click();
                break;
            }
        default:
            {
                assertTrue("参数错误,无此入口:" + from, false);
            }
    }
    HSBot.bot().waitUntil(new IsFileOpenedInEditor(fileName));
}
Also used : IsFileOpenedInEditor(net.heartsome.test.swtbot.waits.IsFileOpenedInEditor) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)

Example 40 with SWTBotTreeItem

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem in project gfm_viewer by satyagraha.

the class ProjectBot method createSimpleProject.

public static ProjectBot createSimpleProject() {
    String projectName = "Project_" + System.currentTimeMillis();
    bot.menu("File").menu("New").menu("Project...").click();
    SWTBotShell shell = bot.shell("New Project");
    shell.activate();
    bot.tree().expandNode("General").select("Project");
    bot.button("Next >").click();
    bot.textWithLabel("Project name:").setText(projectName);
    bot.button("Finish").click();
    SWTUtils.sleep(2000);
    SWTBotTree projectsTree = bot.viewByTitle("Project Explorer").bot().tree();
    SWTBotTreeItem projectTree = projectsTree.getTreeItem(projectName);
    return new ProjectBot(projectTree);
}
Also used : SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)

Aggregations

SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)63 Test (org.junit.Test)38 DockerConnection (org.eclipse.linuxtools.internal.docker.core.DockerConnection)20 DockerClient (com.spotify.docker.client.DockerClient)19 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)9 Path (org.eclipse.core.runtime.Path)7 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)7 IDockerConnectionStorageManager (org.eclipse.linuxtools.docker.core.IDockerConnectionStorageManager)6 SWTBotEclipseEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)5 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)5 IEditorReference (org.eclipse.ui.IEditorReference)5 Ignore (org.junit.Ignore)5 IResource (org.eclipse.core.resources.IResource)4 File (java.io.File)3 IFile (org.eclipse.core.resources.IFile)3 ProjectExplorerTreeItemAppearsCondition (org.eclipse.linuxtools.changelog.ui.tests.utils.ProjectExplorerTreeItemAppearsCondition)3 TCPConnectionSettings (org.eclipse.linuxtools.internal.docker.core.TCPConnectionSettings)3 UnixSocketConnectionSettings (org.eclipse.linuxtools.internal.docker.core.UnixSocketConnectionSettings)2