Author: jjankovi
Date: 2012-08-22 06:12:31 -0400 (Wed, 22 Aug 2012)
New Revision: 43155
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/DeletingArchiveTest.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/context/ArchiveContextMenu.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/explorer/ProjectArchivesExplorer.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/view/ProjectArchivesView.java
Log:
test for deleting archives via keyboard delete shortcut implemented
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/DeletingArchiveTest.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/DeletingArchiveTest.java 2012-08-22
10:10:01 UTC (rev 43154)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/DeletingArchiveTest.java 2012-08-22
10:12:31 UTC (rev 43155)
@@ -22,16 +22,16 @@
*/
public class DeletingArchiveTest extends ArchivesTestBase {
- private static String project = "pr3";
- private final String ARCHIVE_NAME_1 =
- project + "a.jar";
- private final String ARCHIVE_NAME_2 =
- project + "b.jar";
- private final String PATH_SUFFIX = " [/" + project + "]";
- private final String PATH_ARCHIVE_1 =
- ARCHIVE_NAME_1 + PATH_SUFFIX;
- private final String PATH_ARCHIVE_2 =
- ARCHIVE_NAME_2 + PATH_SUFFIX;
+ private static String project = "pr4";
+ private static final String ARCHIVE_NAME_AA =
+ project + "aa.jar";
+ private static final String ARCHIVE_NAME_AB =
+ project + "ab.jar";
+ private static final String ARCHIVE_NAME_BA =
+ project + "ba.jar";
+ private static final String ARCHIVE_NAME_BB =
+ project + "bb.jar";
+ private static final String PATH_SUFFIX = " [/" + project + "]";
@BeforeClass
public static void setup() {
@@ -44,11 +44,17 @@
/* prepare view for testing */
ProjectArchivesView view = viewForProject(project);
- /* delete archive in view */
- view.deleteArchive(project, PATH_ARCHIVE_1);
+ /* delete archive in view with context menu */
+ view.deleteArchive(true, project, ARCHIVE_NAME_AA + PATH_SUFFIX);
/* test archive was deleted */
- assertItemNotExistsInView(view, project, PATH_ARCHIVE_1);
+ assertItemNotExistsInView(view, project, ARCHIVE_NAME_AA + PATH_SUFFIX);
+
+ /* delete archive in view with keyboard shortcut */
+ view.deleteArchive(false, project, ARCHIVE_NAME_AB + PATH_SUFFIX);
+
+ /* test archive was deleted */
+ assertItemNotExistsInView(view, project, ARCHIVE_NAME_AB + PATH_SUFFIX);
}
@Test
@@ -57,11 +63,17 @@
/* prepare explorer for testing */
ProjectArchivesExplorer explorer = explorerForProject(project);
- /* delete archive in explorer */
- explorer.deleteArchive(PATH_ARCHIVE_2);
+ /* delete archive in explorer with context menu*/
+ explorer.deleteArchive(true, ARCHIVE_NAME_BA + PATH_SUFFIX);
/* test archive was deleted */
- assertItemNotExistsInExplorer(explorer, PATH_ARCHIVE_2);
+ assertItemNotExistsInExplorer(explorer, ARCHIVE_NAME_BA + PATH_SUFFIX);
+
+ /* delete archive in explorer with keyboard shortcut */
+ explorer.deleteArchive(false, ARCHIVE_NAME_BB + PATH_SUFFIX);
+
+ /* test archive was deleted */
+ assertItemNotExistsInExplorer(explorer, ARCHIVE_NAME_BB + PATH_SUFFIX);
}
}
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/context/ArchiveContextMenu.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/context/ArchiveContextMenu.java 2012-08-22
10:10:01 UTC (rev 43154)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/context/ArchiveContextMenu.java 2012-08-22
10:12:31 UTC (rev 43155)
@@ -11,6 +11,7 @@
package org.jboss.tools.archives.ui.bot.test.context;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
@@ -94,11 +95,17 @@
}
public void deleteArchive(SWTBotTree tree,
- SWTBotTreeItem item) {
- ContextMenuHelper.prepareTreeItemForContextMenu(tree, item);
- SWTBotMenu menu = new SWTBotMenu(ContextMenuHelper.
+ SWTBotTreeItem item, boolean withContextMenu) {
+ if (withContextMenu) {
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree, item);
+ SWTBotMenu menu = new SWTBotMenu(ContextMenuHelper.
getContextMenu(tree, "Delete Archive", false));
- menu.click();
+ menu.click();
+ } else {
+ item.select();
+ item.pressShortcut(Keystrokes.DELETE);
+ }
+
handleDeleteDialog();
SWTBotFactory.getUtil().waitForNonIgnoredJobs();
}
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/explorer/ProjectArchivesExplorer.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/explorer/ProjectArchivesExplorer.java 2012-08-22
10:10:01 UTC (rev 43154)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/explorer/ProjectArchivesExplorer.java 2012-08-22
10:12:31 UTC (rev 43155)
@@ -82,10 +82,10 @@
return contextTool.editArchive(tree, treeItem);
}
- public void deleteArchive(String archive) {
+ public void deleteArchive(boolean withContextMenu, String archive) {
SWTBotTree tree = this.bot().tree();
SWTBotTreeItem treeItem = explorer.getNode(archive);
- contextTool.deleteArchive(tree, treeItem);
+ contextTool.deleteArchive(tree, treeItem, withContextMenu);
}
public ArchivePublishSettingsDialog publishToServer(
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/view/ProjectArchivesView.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/view/ProjectArchivesView.java 2012-08-22
10:10:01 UTC (rev 43154)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/view/ProjectArchivesView.java 2012-08-22
10:12:31 UTC (rev 43155)
@@ -91,10 +91,10 @@
return contextTool.editArchive(tree, treeItem);
}
- public void deleteArchive(String... pathToArchive) {
+ public void deleteArchive(boolean withContextMenu, String... pathToArchive) {
SWTBotTree tree = this.bot().tree();
SWTBotTreeItem treeItem = TreeHelper.expandNode(this.bot(), pathToArchive);
- contextTool.deleteArchive(tree, treeItem);
+ contextTool.deleteArchive(tree, treeItem, withContextMenu);
}
public ArchivePublishSettingsDialog publishToServer(boolean returnDialog,