Author: jjankovi
Date: 2012-08-22 05:11:13 -0400 (Wed, 22 Aug 2012)
New Revision: 43150
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchiveViewReSwitchingTest.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.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/view/ProjectArchivesView.java
Log:
fixing archive bot tests
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchiveViewReSwitchingTest.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchiveViewReSwitchingTest.java 2012-08-22
08:53:19 UTC (rev 43149)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchiveViewReSwitchingTest.java 2012-08-22
09:11:13 UTC (rev 43150)
@@ -33,7 +33,7 @@
/* show all tested views */
console.show();
servers.show();
- errors .show();
+ errors.show();
/* create test project */
JavaProjectEntity project = new JavaProjectEntity();
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java 2012-08-22
08:53:19 UTC (rev 43149)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java 2012-08-22
09:11:13 UTC (rev 43150)
@@ -75,8 +75,8 @@
server.collapse();
server.expand();
boolean found = false;
- for (SWTBotTreeItem ti : server.getItems()) {
- if (ti.getText().contains(archive)) {
+ for (String node : server.getNodes()) {
+ if (node.contains(archive)) {
found = true;
break;
}
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
08:53:19 UTC (rev 43149)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/context/ArchiveContextMenu.java 2012-08-22
09:11:13 UTC (rev 43150)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.archives.ui.bot.test.context;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
@@ -19,8 +20,10 @@
import org.jboss.tools.archives.ui.bot.test.dialog.FolderCreatingDialog;
import org.jboss.tools.archives.ui.bot.test.dialog.NewJarDialog;
import org.jboss.tools.archives.ui.bot.test.dialog.UserLibrariesFilesetDialog;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.SWTBotFactory;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
/**
*
@@ -96,6 +99,7 @@
SWTBotMenu menu = new SWTBotMenu(ContextMenuHelper.
getContextMenu(tree, "Delete Archive", false));
menu.click();
+ handleDeleteDialog();
SWTBotFactory.getUtil().waitForNonIgnoredJobs();
}
@@ -121,4 +125,15 @@
return new ArchivePublishSettingsDialog();
}
+ private void handleDeleteDialog() {
+ SWTBotExt bot = SWTBotFactory.getBot();
+ try {
+ bot.waitForShell(IDELabel.Shell.DELETE_NODE);
+ bot.shell(IDELabel.Shell.DELETE_NODE)
+ .bot().button(IDELabel.Button.YES).click();
+ } catch (WidgetNotFoundException exc) {
+ //do nothing here
+ }
+ }
+
}
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
08:53:19 UTC (rev 43149)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/view/ProjectArchivesView.java 2012-08-22
09:11:13 UTC (rev 43150)
@@ -10,7 +10,10 @@
******************************************************************************/
package org.jboss.tools.archives.ui.bot.test.view;
+import java.util.List;
+
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.archives.ui.bot.test.context.ArchiveContextMenu;
@@ -42,7 +45,8 @@
public void buildArchiveNode(String... path) {
open.selectTreeNode(this.bot(), path);
- show().toolbarButton(IDELabel.ArchivesView.BUTTON_BUILD_ARCHIVE_NODE).click();
+ show();
+ toolbarButton(IDELabel.ArchivesView.BUTTON_BUILD_ARCHIVE_NODE).click();
}
public NewJarDialog createNewJarArchive(String project) {
@@ -109,11 +113,22 @@
public boolean itemExists(String... path) {
try {
this.bot().tree(0).getTreeItem(path[0]).collapse();
- TreeHelper.expandNode(bot, path);
+ TreeHelper.expandNode(bot(), path);
return true;
} catch (WidgetNotFoundException exc) {
return false;
}
}
+ private SWTBotToolbarButton toolbarButton(String toolbarToolTip) {
+ List<SWTBotToolbarButton> toolbarButtons = getToolbarButtons();
+ for (SWTBotToolbarButton button : toolbarButtons) {
+ if (button.isEnabled() && button.getToolTipText().equals(toolbarToolTip)) {
+ return button;
+ }
+ }
+ throw new WidgetNotFoundException("Toolbar button '" + toolbarToolTip +
"' was not " +
+ "found or enabled");
+ }
+
}
Show replies by date