Search in sources :

Example 6 with TableCollection

use of org.eclipse.swtbot.swt.finder.utils.TableCollection in project egit by eclipse.

the class GitRepositoriesViewTest method testImportWizard.

/**
 * Import wizard golden path test
 *
 * @throws Exception
 */
@Test
public void testImportWizard() throws Exception {
    removeSmartImportWizardToForceGitImportWizardUsage();
    deleteAllProjects();
    assertProjectExistence(PROJ1, false);
    SWTBotTree tree = getOrOpenView().bot().tree();
    SWTBotTreeItem item = myRepoViewUtil.getRootItem(tree, repositoryFile);
    String wizardTitle = NLS.bind(UIText.GitCreateProjectViaWizardWizard_WizardTitle, repositoryFile.getPath());
    // start wizard from root item
    item.select();
    ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("ImportProjectsCommand"));
    SWTBotShell shell = bot.shell(wizardTitle);
    bot.radio(UIText.GitSelectWizardPage_ImportExistingButton).click();
    TableCollection selected = shell.bot().tree().selection();
    String wizardNode = selected.get(0, 0);
    // wizard directory should be working dir
    assertEquals(myRepoViewUtil.getWorkdirItem(tree, repositoryFile).getText(), wizardNode);
    shell.close();
    tree = getOrOpenView().bot().tree();
    // start wizard from .git
    TestUtil.expandAndWait(myRepoViewUtil.getWorkdirItem(tree, repositoryFile)).getNode(Constants.DOT_GIT).select();
    ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("ImportProjectsCommand"));
    shell = bot.shell(wizardTitle);
    selected = shell.bot().tree().selection();
    wizardNode = selected.get(0, 0);
    // wizard directory should be .git
    assertEquals(Constants.DOT_GIT, wizardNode);
    shell.bot().button(IDialogConstants.NEXT_LABEL).click();
    // wait for import projects page
    shell.bot().label("Import Projects");
    assertEquals(0, shell.bot().tree().getAllItems().length);
    shell.bot().button(IDialogConstants.BACK_LABEL).click();
    // go to project with .project
    shell.bot().tree().getAllItems()[0].getNode(PROJ1).select();
    // next is 1
    shell.bot().button(IDialogConstants.NEXT_LABEL).click();
    bot.button(UIText.WizardProjectsImportPage_deselectAll).click();
    assertEquals(1, shell.bot().tree().getAllItems().length);
    assertTrue(!shell.bot().button(IDialogConstants.FINISH_LABEL).isEnabled());
    shell.bot().button(UIText.WizardProjectsImportPage_selectAll).click();
    assertTrue(shell.bot().button(IDialogConstants.FINISH_LABEL).isEnabled());
    shell.bot().button(IDialogConstants.FINISH_LABEL).click();
    bot.waitUntil(Conditions.shellCloses(shell));
    assertProjectExistence(PROJ1, true);
    assertProjectIsShared(PROJ1, true);
}
Also used : SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) TableCollection(org.eclipse.swtbot.swt.finder.utils.TableCollection) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test)

Aggregations

TableCollection (org.eclipse.swtbot.swt.finder.utils.TableCollection)6 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)4 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)3 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)3 Test (org.junit.Test)3 Repository (org.eclipse.jgit.lib.Repository)1 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)1 TableRow (org.eclipse.swtbot.swt.finder.utils.TableRow)1