use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project egit by eclipse.
the class TestUtil method botForShellStartingWith.
public static SWTBotShell botForShellStartingWith(final String titlePrefix) {
SWTWorkbenchBot bot = new SWTWorkbenchBot();
Matcher<Shell> matcher = new TypeSafeMatcher<Shell>() {
@Override
protected boolean matchesSafely(Shell item) {
String title = item.getText();
return title != null && title.startsWith(titlePrefix);
}
@Override
public void describeTo(Description description) {
description.appendText("Shell with title starting with '" + titlePrefix + "'");
}
};
Shell shell = bot.widget(matcher);
return new SWTBotShell(shell);
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project egit by eclipse.
the class GitCloneWizardHttpsTest method canCloneARemoteRepo.
@Test
public void canCloneARemoteRepo() throws Exception {
destRepo = new File(ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(), "test" + System.nanoTime());
importWizard.openWizard();
RepoPropertiesPage propertiesPage = importWizard.openRepoPropertiesPage();
propertiesPage.setURI(r.getSecureUri());
propertiesPage.setUser("agitter");
propertiesPage.setPassword("letmein");
propertiesPage.setStoreInSecureStore(false);
SWTBotShell wizardShell = bot.activeShell();
RepoRemoteBranchesPage remoteBranches = propertiesPage.nextToRemoteBranches();
bot.waitUntil(shellIsActive(UIText.EGitCredentialsProvider_information));
// SSL trust dialog
bot.checkBox(1).select();
bot.button("OK").click();
bot.waitUntil(new ActiveShell(wizardShell, "import wizard shell"));
cloneRepo(destRepo, remoteBranches);
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project egit by eclipse.
the class SharingWizardTest method createProject.
private static String createProject(String projectName) throws CoreException {
bot.menu("File").menu("New").menu("Project...").click();
SWTBotShell createProjectDialogShell = bot.shell("New Project");
SWTBotTreeItem item = bot.tree().getTreeItem("General");
TestUtil.expandAndWait(item).getNode("Project").select();
bot.button("Next >").click();
bot.textWithLabel("Project name:").setText(projectName);
String path = bot.textWithLabel("Location:").getText();
bot.button("Finish").click();
bot.waitUntil(Conditions.shellCloses(createProjectDialogShell), 10000);
ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
return path;
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project egit by eclipse.
the class SharingWizardTest method shareProjectWithExternalRepo.
@Test
public void shareProjectWithExternalRepo() throws Exception {
String repoName = "ExternalRepositoryForShare";
createProject(projectName0);
String location1 = createProject(projectName1);
String location2 = createProject(projectName2);
createProject(projectName3);
ExistingOrNewPage existingOrNewPage = sharingWizard.openWizard(projectName1, projectName2);
SWTBotShell createRepoDialog = existingOrNewPage.clickCreateRepository();
String repoDir = RepositoryUtil.getDefaultRepositoryDir();
File repoFolder = new File(repoDir, repoName);
createRepoDialog.bot().textWithLabel(UIText.CreateRepositoryPage_DirectoryLabel).setText(repoFolder.getAbsolutePath());
createRepoDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
SWTBotCombo combo = bot.comboBoxWithLabel(UIText.ExistingOrNewPage_ExistingRepositoryLabel);
assertTrue(combo.getText().startsWith(repoName));
Repository targetRepo = lookupRepository(new File(repoFolder, Constants.DOT_GIT));
assertTrue(combo.getText().endsWith(targetRepo.getDirectory().getPath()));
assertEquals(targetRepo.getWorkTree().getPath(), bot.textWithLabel(UIText.ExistingOrNewPage_WorkingDirectoryLabel).getText());
String[][] contents = new String[2][3];
contents[0][0] = projectName1;
contents[0][1] = new Path(location1).toString();
contents[0][2] = new Path(targetRepo.getWorkTree().getPath()).append(projectName1).toString();
contents[1][0] = projectName2;
contents[1][1] = new Path(location2).toString();
contents[1][2] = new Path(targetRepo.getWorkTree().getPath()).append(projectName2).toString();
existingOrNewPage.assertTableContents(contents);
existingOrNewPage.setRelativePath("a/b");
contents[0][2] = new Path(targetRepo.getWorkTree().getPath()).append("a/b").append(projectName1).toString();
contents[1][2] = new Path(targetRepo.getWorkTree().getPath()).append("a/b").append(projectName2).toString();
existingOrNewPage.assertTableContents(contents);
SWTBotShell shell = bot.activeShell();
bot.button(IDialogConstants.FINISH_LABEL).click();
bot.waitUntil(Conditions.shellCloses(shell));
ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
String location1Path = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName1).getLocation().toString();
assertEquals(contents[0][2], location1Path);
String location2Path = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName2).getLocation().toString();
assertEquals(contents[1][2], location2Path);
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project egit by eclipse.
the class PushToUpstreamTest method pushToUpstream.
private void pushToUpstream() {
SWTBotTree project = selectProject();
JobJoiner joiner = JobJoiner.startListening(JobFamilies.PUSH, 20, TimeUnit.SECONDS);
ContextMenuHelper.clickContextMenu(project, getPushToUpstreamMenuPath());
TestUtil.openJobResultDialog(joiner.join());
SWTBotShell resultDialog = TestUtil.botForShellStartingWith("Push Results");
resultDialog.close();
}
Aggregations