use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView in project egit by eclipse.
the class TestUtil method showView.
public static SWTBotView showView(final String viewId) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
try {
workbenchPage.showView(viewId);
processUIEvents();
} catch (PartInitException e) {
throw new RuntimeException("Showing view with ID " + viewId + " failed.", e);
}
}
});
SWTWorkbenchBot bot = new SWTWorkbenchBot();
SWTBotView viewbot = bot.viewById(viewId);
assertNotNull("View with ID " + viewId + " not found via SWTBot.", viewbot);
return viewbot;
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView in project egit by eclipse.
the class StagingViewTester method openStagingView.
public static StagingViewTester openStagingView() throws Exception {
// This is needed so that we can find staging entries by full path.
Activator.getDefault().getPreferenceStore().setValue(UIPreferences.STAGING_VIEW_FILENAME_MODE, false);
SWTBotView view = TestUtil.showView(StagingView.VIEW_ID);
TestUtil.joinJobs(org.eclipse.egit.core.JobFamilies.INDEX_DIFF_CACHE_UPDATE);
TestUtil.processUIEvents();
return new StagingViewTester(view);
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView in project egit by eclipse.
the class GitRepositoriesViewBranchHandlingTest method testCreateCheckoutDeleteLocalBranch.
@Test
public void testCreateCheckoutDeleteLocalBranch() throws Exception {
final SWTBotView view = getOrOpenView();
SWTBotTreeItem localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(), repositoryFile);
TestUtil.expandAndWait(localItem);
assertEquals("Wrong number of children", 1, localItem.getNodes().size());
assertEquals("master", localItem.getNodes().get(0));
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);
TestUtil.expandAndWait(localItem);
assertEquals("Wrong number of children", 2, localItem.getNodes().size());
localItem.getNode(0).select();
assertCheckoutNotAvailable(view);
localItem.getNode(1).select();
ContextMenuHelper.clickContextMenuSync(view.bot().tree(), myUtil.getPluginLocalizedValue("CheckoutCommand"));
TestUtil.joinJobs(JobFamilies.CHECKOUT);
assertCheckoutNotAvailable(view);
localItem.getNode(0).select();
ContextMenuHelper.clickContextMenuSync(view.bot().tree(), myUtil.getPluginLocalizedValue("CheckoutCommand"));
TestUtil.joinJobs(JobFamilies.CHECKOUT);
refreshAndWait();
localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(), repositoryFile);
localItem.getNode(1).select();
ContextMenuHelper.clickContextMenuSync(view.bot().tree(), myUtil.getPluginLocalizedValue("RepoViewDeleteBranch.label"));
refreshAndWait();
localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(), repositoryFile);
TestUtil.expandAndWait(localItem);
assertEquals("Wrong number of children", 1, localItem.getNodes().size());
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView in project egit by eclipse.
the class GitRepositoriesViewRepoHandlingTest method testShowIn.
@Test
public void testShowIn() throws Exception {
clearView();
deleteAllProjects();
shareProjects(repositoryFile);
refreshAndWait();
assertProjectExistence(PROJ1, true);
assertEmpty();
getOrOpenView().show();
SWTBotView view = TestUtil.showExplorerView();
SWTBotTree explorerTree = view.bot().tree();
SWTBotTreeItem projectItem = getProjectItem(explorerTree, PROJ1).select();
ContextMenuHelper.clickContextMenuSync(explorerTree, "Show In", viewName);
refreshAndWait();
assertHasRepo(repositoryFile);
SWTBotTree viewerTree = getOrOpenView().bot().tree();
TableCollection selection = viewerTree.selection();
assertEquals("Selection should contain one element: " + selection, 1, selection.rowCount());
String nodeText = selection.get(0).get(0);
assertTrue("Node text should contain project name", projectItem.getText().startsWith(nodeText));
view.show();
SWTBotTreeItem item = TestUtil.expandAndWait(projectItem);
item = TestUtil.expandAndWait(item.getNode(FOLDER));
item.getNode(FILE1).select();
ContextMenuHelper.clickContextMenuSync(explorerTree, "Show In", viewName);
selection = viewerTree.selection();
assertTrue("Selection should contain one eelement", selection.rowCount() == 1);
nodeText = selection.get(0).get(0);
assertEquals("Node text should contain file name", FILE1, nodeText);
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView in project egit by eclipse.
the class GitRepositoriesViewTestBase method getOrOpenView.
protected SWTBotView getOrOpenView() throws Exception {
SWTBotView view = TestUtil.showView(RepositoriesView.VIEW_ID);
TestUtil.joinJobs(JobFamilies.REPO_VIEW_REFRESH);
return view;
}
Aggregations