use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project egit by eclipse.
the class SynchronizeViewRemoteAwareChangeSetModelTest method shouldShowRemoteFilesInSynchronization.
/**
* Make sure that files that are not part of the logical model because of
* remote file content will be taken into account in the comparison.
*
* @throws Exception
*/
@Test
public void shouldShowRemoteFilesInSynchronization() throws Exception {
// given
createMockLogicalRepository();
// when comparing file 'index.mocklogical' with branch 'stable'
String compareWithBranchActionLabel = util.getPluginLocalizedValue("ReplaceWithRefAction_label");
clickCompareWith(compareWithBranchActionLabel);
SWTBotShell compareShell = bot.shell("Compare");
SWTBotTree tree = compareShell.bot().tree();
for (SWTBotTreeItem item : tree.getTreeItem("Local").getItems()) {
if (item.getText().contains("stable")) {
tree.select(item);
break;
}
}
bot.button("Compare").click();
// then
SWTBotTree syncViewTree = bot.viewById(ISynchronizeView.VIEW_ID).bot().tree();
SWTBotTreeItem mockLogicalProjectItem = waitForNodeWithText(syncViewTree, MOCK_LOGICAL_PROJECT);
SWTBotTreeItem[] items = mockLogicalProjectItem.getItems();
assertEquals(4, items.length);
SWTBotTreeItem fileTree = items[0];
assertEquals("file1.txt", fileTree.getText());
fileTree = items[1];
assertEquals("file2.txt", fileTree.getText());
fileTree = items[2];
assertEquals("file3.txt", fileTree.getText());
fileTree = items[3];
assertEquals("index.mocklogical", fileTree.getText());
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project egit by eclipse.
the class ReplaceActionsTest method testReplaceWithPrevious.
@Test
public void testReplaceWithPrevious() throws Exception {
touchAndSubmit(null);
String initialContent = getTestFileContent();
String menuLabel = util.getPluginLocalizedValue("ReplaceWithPreviousVersionAction.label");
clickReplaceWith(menuLabel);
SWTBotShell confirm = bot.shell(UIText.DiscardChangesAction_confirmActionTitle);
executeReplace(confirm, UIText.DiscardChangesAction_discardChangesButtonText);
String replacedContent = getTestFileContent();
assertThat(replacedContent, not(initialContent));
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project egit by eclipse.
the class ReplaceActionsTest method testReplaceWithPreviousWithMerge.
@Test
public void testReplaceWithPreviousWithMerge() throws Exception {
Repository repo = lookupRepository(repositoryFile);
try (Git git = new Git(repo)) {
Calendar cal = Calendar.getInstance();
long time = cal.getTime().getTime();
PersonIdent sideCommitter = new PersonIdent("Side Committer", "side@example.org", time, 0);
// Make sure commit time stamps are different, otherwise the order
// in the dialog is not stable
time += 5000;
PersonIdent masterCommitter = new PersonIdent("Master Committer", "master@example.org", time, 0);
git.checkout().setCreateBranch(true).setName("side").call();
touch(PROJ1, "folder/test.txt", "side");
RevCommit sideCommit = git.commit().setAll(true).setMessage("Side commit").setCommitter(sideCommitter).call();
git.checkout().setName("master").call();
touch(PROJ1, "folder/test2.txt", "master");
git.commit().setAll(true).setMessage("Master commit").setCommitter(masterCommitter).call();
git.merge().include(sideCommit).call();
}
TestUtil.waitForJobs(100, 5000);
String contentAfterMerge = getTestFileContent();
assertEquals("side", contentAfterMerge);
String menuLabel = util.getPluginLocalizedValue("ReplaceWithPreviousVersionAction.label");
clickReplaceWith(menuLabel);
bot.shell(UIText.DiscardChangesAction_confirmActionTitle).bot().button(UIText.DiscardChangesAction_discardChangesButtonText).click();
SWTBotShell selectDialog = bot.shell(UIText.CommitSelectDialog_WindowTitle);
assertEquals(2, selectDialog.bot().table().rowCount());
selectDialog.close();
TestUtil.processUIEvents();
// we have closed, so nothing should have changed
String contentAfterClose = getTestFileContent();
assertEquals(contentAfterMerge, contentAfterClose);
clickReplaceWith(menuLabel);
bot.shell(UIText.DiscardChangesAction_confirmActionTitle).bot().button(UIText.DiscardChangesAction_discardChangesButtonText).click();
TestUtil.waitForJobs(100, 5000);
selectDialog = bot.shell(UIText.CommitSelectDialog_WindowTitle);
// Select first parent, which should be the master commit
SWTBotTable table = selectDialog.bot().table();
assertEquals("Master commit", table.cell(0, 1));
table.select(0);
executeReplace(selectDialog, IDialogConstants.OK_LABEL);
TestUtil.waitForJobs(100, 5000);
String replacedContent = getTestFileContent();
assertThat(replacedContent, not(contentAfterMerge));
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project egit by eclipse.
the class TagActionTest method testChangeTagMessage.
@Test
public void testChangeTagMessage() throws Exception {
SWTBotShell tagDialog = openTagDialog();
assertFalse("Ok should be disabled", tagDialog.bot().button(UIText.CreateTagDialog_CreateTagButton).isEnabled());
tagDialog.bot().textWithLabel(UIText.CreateTagDialog_tagName).setText("MessageChangeTag");
assertFalse("Ok should be disabled", tagDialog.bot().button(UIText.CreateTagDialog_CreateTagButton).isEnabled());
tagDialog.bot().styledTextWithLabel(UIText.CreateTagDialog_tagMessage).setText("Here's the first message");
tagDialog.bot().button(UIText.CreateTagDialog_CreateTagButton).click();
waitInUI();
assertTrue(lookupRepository(repositoryFile).getTags().keySet().contains("MessageChangeTag"));
tagDialog = openTagDialog();
tagDialog.bot().tableWithLabel(UIText.CreateTagDialog_existingTags).getTableItem("MessageChangeTag").select();
assertFalse("Ok should be disabled", tagDialog.bot().button(UIText.CreateTagDialog_CreateTagButton).isEnabled());
String oldText = tagDialog.bot().styledTextWithLabel(UIText.CreateTagDialog_tagMessage).getText();
assertEquals("Wrong message text", "Here's the first message", oldText);
tagDialog.bot().checkBox(UIText.CreateTagDialog_overwriteTag).click();
tagDialog.bot().styledTextWithLabel(UIText.CreateTagDialog_tagMessage).setText("New message");
tagDialog.bot().button(UIText.CreateTagDialog_CreateTagButton).click();
tagDialog = openTagDialog();
tagDialog.bot().tableWithLabel(UIText.CreateTagDialog_existingTags).getTableItem("MessageChangeTag").select();
String newText = tagDialog.bot().styledTextWithLabel(UIText.CreateTagDialog_tagMessage).getText();
assertEquals("Wrong message text", "New message", newText);
tagDialog.close();
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project egit by eclipse.
the class TagActionTest method testCreateTag.
@Test
public void testCreateTag() throws Exception {
SWTBotShell tagDialog = openTagDialog();
tagDialog.bot().textWithLabel(UIText.CreateTagDialog_tagName).setText("SomeTag");
assertFalse("Ok should be disabled", tagDialog.bot().button(UIText.CreateTagDialog_CreateTagButton).isEnabled());
tagDialog.bot().button(UIText.CreateTagDialog_clearButton).click();
tagDialog.bot().textWithLabel(UIText.CreateTagDialog_tagName).setText("AnotherTag");
assertFalse("Ok should be disabled", tagDialog.bot().button(UIText.CreateTagDialog_CreateTagButton).isEnabled());
tagDialog.bot().styledTextWithLabel(UIText.CreateTagDialog_tagMessage).setText("Here's the message text");
tagDialog.bot().button(UIText.CreateTagDialog_CreateTagButton).click();
waitInUI();
assertTrue(lookupRepository(repositoryFile).getTags().keySet().contains("AnotherTag"));
}
Aggregations