Package org.eclipse.swtbot.swt.finder.widgets

Examples of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell


    getOrOpenView()
        .toolbarButton(
            myUtil
                .getPluginLocalizedValue("RepoViewCloneRepository.tooltip"))
        .click();
    SWTBotShell shell = bot.shell(UIText.GitCloneWizard_title);
    shell.bot().tree().select("Clone URI");

    shell.bot().button("Next >").click();    // for some reason, textWithLabel doesn't seem to work
    shell.bot()
        .textInGroup(UIText.RepositorySelectionPage_groupLocation, 0)
        .setText(repositoryFile.getPath());
    shell.bot().button(IDialogConstants.NEXT_LABEL).click();
    bot.waitUntil(widgetIsEnabled(shell.bot().tree()), 60000);
    shell.bot().button(IDialogConstants.NEXT_LABEL).click();
    waitInUI();
    // for some reason textWithLabel doesn't work; 0 is path text
    SWTBotText pathText = shell.bot().text(0);
    pathText.setText(pathText.getText() + "Cloned");
    shell.bot().button(IDialogConstants.FINISH_LABEL).click();
    refreshAndWait();
    assertHasClonedRepo();
  }
View Full Code Here


    // create a non-bare repository
    getOrOpenView()
        .toolbarButton(
            myUtil.getPluginLocalizedValue("RepoViewCreateRepository.tooltip"))
        .click();
    SWTBotShell shell = bot.shell(UIText.NewRepositoryWizard_WizardTitle);
    IPath newPath = new Path(getTestDirectory().getPath());
    shell.bot().textWithLabel(UIText.CreateRepositoryPage_DirectoryLabel)
        .setText(newPath.append("NewRepository").toOSString());
    shell.bot().button(IDialogConstants.FINISH_LABEL).click();
    refreshAndWait();
    File repoFile = new File(newPath.append("NewRepository").toFile(),
        Constants.DOT_GIT);
    myRepoViewUtil.getRootItem(getOrOpenView().bot().tree(), repoFile);
    assertFalse(myRepoViewUtil.lookupRepository(repoFile).isBare());

    // create a bare repository
    getOrOpenView()
        .toolbarButton(
            myUtil.getPluginLocalizedValue("RepoViewCreateRepository.tooltip"))
        .click();
    shell = bot.shell(UIText.NewRepositoryWizard_WizardTitle);
    newPath = new Path(getTestDirectory().getPath()).append("bare").append(
        "NewBareRepository");
    shell.bot().textWithLabel(UIText.CreateRepositoryPage_DirectoryLabel)
        .setText(newPath.toOSString());
    shell.bot().checkBox(UIText.CreateRepositoryPage_BareCheckbox).select();
    shell.bot().button(IDialogConstants.FINISH_LABEL).click();
    refreshAndWait();
    repoFile = newPath.toFile();
    myRepoViewUtil.getRootItem(getOrOpenView().bot().tree(), repoFile);
    assertTrue(myRepoViewUtil.lookupRepository(repoFile).isBare());
  }
View Full Code Here

    getOrOpenView()
        .toolbarButton(
            myUtil.getPluginLocalizedValue("RepoViewAddRepository.tooltip"))
        .click();

    SWTBotShell shell = bot
        .shell(UIText.RepositorySearchDialog_AddGitRepositories);

    shell.bot().checkBox(UIText.RepositorySearchDialog_DeepSearch_button)
        .deselect();

    shell.bot().textWithLabel(UIText.RepositorySearchDialog_directory)
        .setText(getTestDirectory().getPath());

    shell.bot().button(UIText.RepositorySearchDialog_Search).click();

    int max = 5000;
    int slept = 0;
    while (ModalContext.getModalLevel() > 0 && slept < max) {
      Thread.sleep(100);
      slept += 100;
    }

    TestUtil.waitUntilTreeHasNodeContainsText(shell.bot(), shell.bot()
        .tree(), "BareRepository1", 10000);
    TestUtil.waitUntilTreeHasNodeContainsText(shell.bot(), shell.bot()
        .tree(), "BareRepository2", 10000);
  }
View Full Code Here

        + " - " + "origin";
    String dialogTitle = NLS.bind(UIText.PushResultDialog_title,
        destinationString);

    // first time: expect new branch
    SWTBotShell confirmed = bot.shell(dialogTitle);
    SWTBotTreeItem[] treeItems = confirmed.bot().tree().getAllItems();
    boolean newBranch = false;
    for (SWTBotTreeItem item : treeItems) {
      newBranch = item.getText().contains(
          UIText.PushResultTable_statusOkNewBranch);
      if (newBranch)
        break;
    }
    confirmed.close();
    assertTrue("New branch expected", newBranch);
    // second time: expect up to date
    selectNode(tree, useRemote, false);

    runPush(tree);

    confirmed = bot.shell(dialogTitle);
    treeItems = confirmed.bot().tree().getAllItems();
    boolean uptodate = false;
    for (SWTBotTreeItem item : treeItems) {
      uptodate = item.getText().contains(
          UIText.PushResultTable_statusUpToDate);
      if (uptodate)
        break;
    }
    confirmed.close();
    assertTrue("Up to date expected", uptodate);
    // touch and run again: expect new branch
    String objectIdBefore = repository.getRef(repository.getFullBranch())
        .getLeaf().getObjectId().name();
    objectIdBefore = objectIdBefore.substring(0, 7);
    touchAndSubmit(null);

    selectNode(tree, useRemote, false);

    runPush(tree);

    confirmed = bot.shell(dialogTitle);
    treeItems = confirmed.bot().tree().getAllItems();
    newBranch = false;
    for (SWTBotTreeItem item : treeItems) {
      newBranch = item.getText().contains(objectIdBefore);
      if (newBranch)
        break;
    }
    confirmed.close();
    assertTrue("New branch expected", newBranch);
  }
View Full Code Here

        destinationString);

    selectNode(tree, useRemote, true);
    runFetch(tree);

    SWTBotShell confirm = bot.shell(dialogTitle);
    assertEquals("Wrong result tree row count", 0, confirm.bot().tree()
        .rowCount());
    confirm.close();

    deleteAllProjects();
    shareProjects(clonedRepositoryFile2);
    String objid = repository.getRef("refs/heads/master").getTarget()
        .getObjectId().name();
    objid = objid.substring(0, 7);
    touchAndSubmit(null);
    // push from other repository
    PushOperationUI op =new PushOperationUI(repository, "origin", false);
    op.start();

    String pushdialogTitle = NLS.bind(UIText.PushResultDialog_title,
        op.getDestinationString());

    bot.shell(pushdialogTitle).close();

    deleteAllProjects();

    refreshAndWait();

    selectNode(tree, useRemote, true);
    runFetch(tree);

    confirm = bot.shell(dialogTitle);
    SWTBotTreeItem[] treeItems = confirm.bot().tree().getAllItems();
    boolean found = false;
    for (SWTBotTreeItem item : treeItems) {
      found = item.getText().contains(objid);
      if (found)
        break;
    }
    assertTrue(found);
    confirm.close();

    selectNode(tree, useRemote, true);
    runFetch(tree);

    confirm = bot.shell(dialogTitle);
    assertEquals("Wrong result tree row count", 0, confirm.bot().tree()
        .rowCount());
  }
View Full Code Here

    localItem.getNode(0).select();

    ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil
        .getPluginLocalizedValue("CreateBranchCommand"));

    SWTBotShell createPage = bot
        .shell(UIText.CreateBranchWizard_NewBranchTitle);
    createPage.activate();
    // getting text with label doesn't work
    createPage.bot().textWithId("BranchName").setText("newLocal");
    createPage.bot().checkBox(UIText.CreateBranchPage_CheckoutButton)
        .deselect();
    createPage.bot().button(IDialogConstants.FINISH_LABEL).click();
    refreshAndWait();

    localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(),
        repositoryFile);
    localItem.expand();
View Full Code Here

  private void checkoutWithDoubleClick(SWTBotTree tree, String branch)
      throws Exception {
    myRepoViewUtil.getLocalBranchesItem(tree, repositoryFile).expand()
        .getNode(branch).doubleClick();
    SWTBotShell shell = bot
        .shell(UIText.RepositoriesView_CheckoutConfirmationTitle);
    shell.bot().button(IDialogConstants.OK_LABEL).click();
    refreshAndWait();
  }
View Full Code Here

        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();
    // start wizard from .git
    myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().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();
    shell.bot().label("Import Projects"); // wait for import projects page
    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);
  }
View Full Code Here

    // start wizard from PROJ2
    myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().getNode(
        PROJ2).select();
    ContextMenuHelper.clickContextMenu(tree, myUtil
        .getPluginLocalizedValue("ImportProjectsCommand"));
    SWTBotShell shell = bot.shell(wizardTitle);
    shell = bot.shell(wizardTitle);
    // try import existing project first
    bot.radio(UIText.GitSelectWizardPage_ImportExistingButton).click();
    TableCollection selected = shell.bot().tree().selection();
    String wizardNode = selected.get(0, 0);
    // wizard directory should be PROJ2
    assertEquals(PROJ2, wizardNode);
    shell.bot().button(IDialogConstants.NEXT_LABEL).click();
    shell.bot().text(" " + UIText.GitProjectsImportPage_NoProjectsMessage);
    assertEquals(0, shell.bot().tree().getAllItems().length);
    shell.bot().button(IDialogConstants.BACK_LABEL).click();
    // import as general
    shell.bot().radio(UIText.GitSelectWizardPage_ImportAsGeneralButton).click();
    shell.bot().button(IDialogConstants.NEXT_LABEL).click();
    assertEquals(PROJ2, shell.bot().textWithLabel(
        UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText());
    // switch to a sub directory and see if this is used
    shell.bot().button(IDialogConstants.BACK_LABEL).click();
    shell.bot().tree().getAllItems()[0].expand().getNode(PROJ2).expand()
        .getNode(FOLDER).select();
    shell.bot().button(IDialogConstants.NEXT_LABEL).click();
    String name = shell.bot().textWithLabel(
        UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText();
    assertEquals(FOLDER, name);
    shell.bot().button(IDialogConstants.BACK_LABEL).click();
    // switch back to the root directory
    shell.bot().tree().getAllItems()[0].expand().getNode(PROJ2).select();
    shell.bot().button(IDialogConstants.NEXT_LABEL).click();
    assertEquals(PROJ2, shell.bot().textWithLabel(
        UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText());

    shell.bot().button(IDialogConstants.FINISH_LABEL).click();
    bot.waitUntil(Conditions.shellCloses(shell));
    assertProjectExistence(PROJ2, true);
    assertProjectIsShared(PROJ2, true);
  }
View Full Code Here

    // start wizard from PROJ1
    myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().getNode(
        PROJ1).select();
    ContextMenuHelper.clickContextMenu(tree, myUtil
        .getPluginLocalizedValue("ImportProjectsCommand"));
    SWTBotShell shell = bot.shell(wizardTitle);
    shell = bot.shell(wizardTitle);
    // try import existing project first
    bot.radio(UIText.GitSelectWizardPage_ImportExistingButton).click();
    SWTBotButton button = shell.bot().button(IDialogConstants.NEXT_LABEL);
    // Set focus on the next button. If this is not done, Wizard Framework restores
    // the focus to the "Import as &General Project" radio button. Setting the focus on
    // the radio button selects the button and causes the test to fail.
    // See also SWTBot Bug 337465
    button.setFocus();
    button.click();
    shell.bot().text(UIText.WizardProjectsImportPage_ImportProjectsDescription);
    shell.bot().tree().getAllItems()[0].check();
    // add to working set
    shell.bot().checkBox("Add project to working sets").select();
    // create new working set
    shell.bot().button("Select...").click();
    SWTBotShell workingSetDialog = bot.shell("Select Working Sets");
    workingSetDialog.bot().button("New...").click();
    SWTBotShell newDialog = bot.shell("New Working Set");
    newDialog.bot().table().select("Java");
    newDialog.bot().button(IDialogConstants.NEXT_LABEL).click();
    newDialog.bot().text(0).setText(workingSetName);
    newDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
    workingSetDialog.bot().table().getTableItem(workingSetName).check();
    workingSetDialog.bot().button(IDialogConstants.OK_LABEL).click();
    shell.bot().button(IDialogConstants.FINISH_LABEL).click();
    bot.waitUntil(Conditions.shellCloses(shell));
    assertProjectExistence(PROJ1, true);
View Full Code Here

TOP

Related Classes of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.