Search in sources :

Example 46 with SWTBotShell

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

the class FetchAndMergeActionTest method mergeBranch.

private void mergeBranch(String branchToMerge, boolean squash) throws Exception {
    SWTBotShell mergeDialog = openMergeDialog();
    TestUtil.navigateTo(mergeDialog.bot().tree(), new String[] { LOCAL_BRANCHES, branchToMerge }).select();
    if (squash)
        mergeDialog.bot().radio(UIText.MergeTargetSelectionDialog_MergeTypeSquashButton).click();
    mergeDialog.bot().button(UIText.MergeTargetSelectionDialog_ButtonMerge).click();
    bot.shell(UIText.MergeAction_MergeResultTitle).close();
}
Also used : SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)

Example 47 with SWTBotShell

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

the class FetchAndMergeActionTest method testFetchFromOriginThenMerge.

@Test
public void testFetchFromOriginThenMerge() throws Exception {
    touchAndSubmit(null);
    deleteAllProjects();
    shareProjects(childRepositoryFile);
    String oldContent = getTestFileContent();
    fetch();
    final String title = NLS.bind(UIText.FetchResultDialog_title, childRepositoryFile.getParentFile().getName() + " - origin");
    bot.waitUntil(Conditions.shellIsActive(title));
    SWTBotShell confirm = bot.shell(title);
    SWTBotTree tree = confirm.bot().tree();
    String branch = tree.getAllItems()[0].getText();
    assertTrue("Wrong result", branch.contains(initialCommitId.substring(0, 7)));
    confirm.close();
    String newContent = getTestFileContent();
    assertEquals(oldContent, newContent);
    fetch();
    bot.waitUntil(Conditions.shellIsActive(title));
    confirm = bot.shell(title);
    int count = confirm.bot().tree().rowCount();
    confirm.close();
    assertEquals("Wrong result count", 0, count);
    newContent = getTestFileContent();
    assertEquals(oldContent, newContent);
    SWTBotShell mergeDialog = openMergeDialog();
    SWTBotTreeItem remoteBranches = TestUtil.expandAndWait(mergeDialog.bot().tree().getTreeItem(REMOTE_BRANCHES));
    TestUtil.getChildNode(remoteBranches, "origin/master").select();
    mergeDialog.bot().button(UIText.MergeTargetSelectionDialog_ButtonMerge).click();
    bot.shell(UIText.MergeAction_MergeResultTitle).close();
    newContent = getTestFileContent();
    assertFalse(oldContent.equals(newContent));
}
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) Test(org.junit.Test)

Example 48 with SWTBotShell

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

the class FetchAndMergeActionTest method openMergeDialog.

private SWTBotShell openMergeDialog() throws Exception {
    SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
    getProjectItem(projectExplorerTree, PROJ1).select();
    String menuString = util.getPluginLocalizedValue("MergeAction_label");
    ContextMenuHelper.clickContextMenu(projectExplorerTree, "Team", menuString);
    Repository repo = lookupRepository(childRepositoryFile);
    SWTBotShell dialog = bot.shell(NLS.bind(UIText.MergeTargetSelectionDialog_TitleMergeWithBranch, repo.getBranch()));
    return dialog;
}
Also used : Repository(org.eclipse.jgit.lib.Repository) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)

Example 49 with SWTBotShell

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

the class FetchAndMergeActionTest method createNewBranch.

private void createNewBranch(String newBranch, boolean checkout) {
    SWTBotShell newBranchDialog = openCreateBranchDialog();
    newBranchDialog.bot().textWithId("BranchName").setText(newBranch);
    if (!checkout)
        newBranchDialog.bot().checkBox(UIText.CreateBranchPage_CheckoutButton).deselect();
    newBranchDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
}
Also used : SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)

Example 50 with SWTBotShell

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

the class SynchronizeViewPushTest method shouldUpdateTrackingBranchOnPush.

@Test
public void shouldUpdateTrackingBranchOnPush() throws Exception {
    makeChangesAndCommit(PROJ1);
    Repository repository = lookupRepository(repositoryFile);
    ObjectId headId = repository.resolve(Constants.HEAD);
    String trackingBranch = Constants.R_REMOTES + "origin/master";
    launchSynchronization(Constants.HEAD, trackingBranch, false);
    SWTBotView viewBot = bot.viewById(ISynchronizeView.VIEW_ID);
    SWTBotToolbarButton pushButton = viewBot.toolbarButton(UIText.GitActionContributor_Push);
    JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.PUSH, 30, TimeUnit.SECONDS);
    pushButton.click();
    TestUtil.openJobResultDialog(jobJoiner.join());
    String destinationString = repositoryFile.getParentFile().getName() + " - " + "origin";
    SWTBotShell resultDialog = bot.shell(NLS.bind(UIText.PushResultDialog_title, destinationString));
    resultDialog.close();
    Repository remoteRepository = lookupRepository(childRepositoryFile);
    ObjectId masterOnRemote = remoteRepository.resolve("master");
    assertThat("Expected push to update branch on remote repository", masterOnRemote, is(headId));
    ObjectId trackingId = repository.resolve(trackingBranch);
    assertThat("Expected tracking branch to be updated", trackingId, is(headId));
}
Also used : Repository(org.eclipse.jgit.lib.Repository) ObjectId(org.eclipse.jgit.lib.ObjectId) JobJoiner(org.eclipse.egit.ui.test.JobJoiner) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) SWTBotToolbarButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton) Test(org.junit.Test)

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