[jbosstools-commits] JBoss Tools SVN: r42986 - in trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext: view and 1 other directory.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Sat Aug 11 19:05:21 EDT 2012
Author: ldimaggio
Date: 2012-08-11 19:05:20 -0400 (Sat, 11 Aug 2012)
New Revision: 42986
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/ExampleTest.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java
Log:
Updated to run on Eclipse Juno
https://issues.jboss.org/browse/JBQA-6462
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/ExampleTest.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/ExampleTest.java 2012-08-11 22:59:44 UTC (rev 42985)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/ExampleTest.java 2012-08-11 23:05:20 UTC (rev 42986)
@@ -110,7 +110,7 @@
bot.waitForShell("New Project Example");
bot.shell("New Project Example").bot().button(IDELabel.Button.FINISH).click();
- //bot.sleep(Timing.time5S());
+ bot.sleep(Timing.time5S());
/* Temporary fix needed by - https://issues.jboss.org/browse/JBIDE-11781
* Close the Quick Fix shell/dialog - or the project explorer cannot find the
* webservice_producer|client projects in the project explorer - ldimaggi - May 2012 */
@@ -120,7 +120,7 @@
catch (Exception E) {
log.info("Condition from https://issues.jboss.org/browse/JBIDE-11781 not found " + E.getMessage());
}
- //bot.sleep(Timing.time5S());
+ bot.sleep(Timing.time5S());
for (String project : getProjectNames()) {
assertTrue(String.format("Example project '%s' was not found in project explorer",project),projectExplorer.existsResource(project));
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2012-08-11 22:59:44 UTC (rev 42985)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2012-08-11 23:05:20 UTC (rev 42986)
@@ -66,6 +66,7 @@
import org.jboss.tools.ui.bot.ext.types.ViewType;
import org.jboss.tools.ui.bot.ext.view.PackageExplorer;
import org.jboss.tools.ui.bot.ext.view.RemoteSystems;
+import org.jboss.tools.ui.bot.ext.view.ViewBase;
import org.junit.Assert;
/**
@@ -1239,8 +1240,7 @@
*/
public void runTreeItemAsJavaApplication(SWTBotTreeItem treeItem) {
treeItem.select();
- treeItem.click();
-
+ treeItem.click();
//SWTEclipseExt.getMenuFromSubmenu(
// bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.RUN_AS),
// IDELabel.Menu.RUN_AS_JAVA_APPLICATION).click();
@@ -1248,15 +1248,43 @@
//System.out.println("runJavaApplication!!!");
//bot.sleep(30000l);
//System.out.println (treeItem.contextMenu("Run As").menu("2 Java Application").getText());
-
- bot.sleep(Timing.time30S());
//treeItem.contextMenu("Run As").menu("2 Java Application").click();
+
SWTUtilExt.menuWithRegex("(.*) Java Application", treeItem.contextMenu(IDELabel.Menu.RUN_AS)).click();
-
+
//runJavaApplication("helloworld_testclient","org.jboss.soa.esb.samples.quickstart.helloworld.test.SendJMSMessage"," ");
bot.sleep(Timing.time30S()); // This is needed to enable the test to run successfully to completion
-
}
+
+
+ /**
+ * ldimaggi - Aug 2012 - https://issues.jboss.org/browse/JBQA-6462
+ *
+ * New method written to deal with instability of treeItem.contextMenu with Eclipse Juno
+ *
+ * Initial attempts to us prepareTreeItemForContextMenu also failed with Juno
+ *
+ * // src, package, class
+ * ContextMenuHelper.prepareTreeItemForContextMenu(theTree, theTree.getTreeItem ("helloworld_testclient").getItems()[0].getItems()[0].getItems()[1]);
+ * new SWTBotMenu(ContextMenuHelper.getContextMenu(theTree, IDELabel.Menu.RUN_AS, false)).click();
+ *
+ * This new method creates a new run config for the Java application.
+ *
+ */
+ public void runTreeItemAsJavaApplication2(SWTBotTreeItem treeItem) {
+ treeItem.select();
+ treeItem.click();
+ bot.sleep(Timing.time3S());
+ bot.menu("Run").menu("Run Configurations...").click();
+ bot.sleep(Timing.time3S());
+ bot.tree(0).getTreeItem("Java Application").select().doubleClick();
+ bot.sleep(Timing.time3S());
+ bot.button("Run").click();
+ bot.sleep(Timing.time3S());
+ }
+
+
+
/**
* runs java application (run configuration)
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java 2012-08-11 22:59:44 UTC (rev 42985)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java 2012-08-11 23:05:20 UTC (rev 42986)
@@ -19,6 +19,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton;
import org.hamcrest.core.IsAnything;
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.View.GeneralConsole;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
@@ -86,19 +87,33 @@
* String contained in name of console to switch on
*/
public boolean switchConsole(String containedInonsoleName) {
- SWTBotView consoleView = show();
- SWTBotToolbarDropDownButton button = consoleView
- .toolbarDropDownButton(IDELabel.ConsoleView.BUTTON_DISPLAY_SELECTED_CONSOLE_TOOLTIP);
- if (button.isEnabled()) {
- for (SWTBotMenu menu : button.menuItems(new IsAnything<MenuItem>())) {
- if (menu.getText().contains(containedInonsoleName)) {
- log.info("Switching consoleView to display '"
- + menu.getText() + "'. console");
- menu.click();
- return true;
- }
+
+ /*
+ * ldimaggi - Aug 2012 - https://issues.jboss.org/browse/JBQA-6462
+ * Thanks to Lucia Jelinkova for supplying this workaround to the Eclipse bug where SWTBot
+ * cannot handle/find buttons in a toolbar - https://issues.jboss.org/browse/JBQA-6489,
+ * Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=375598 for a detailed description.
+ */
+ for (SWTBotToolbarButton button : SWTBotFactory.getConsole().getToolbarButtons()){
+ if (button.isEnabled() && IDELabel.ConsoleView.BUTTON_DISPLAY_SELECTED_CONSOLE_TOOLTIP.equals(button.getToolTipText())){
+ button.click(); // To switch the console
+ button.click(); // To switch the console
+ return true;
}
}
+
+// SWTBotView consoleView = show();
+// SWTBotToolbarDropDownButton button = consoleView.toolbarDropDownButton(IDELabel.ConsoleView.BUTTON_DISPLAY_SELECTED_CONSOLE_TOOLTIP);
+// if (button.isEnabled()) {
+// for (SWTBotMenu menu : button.menuItems(new IsAnything<MenuItem>())) {
+// if (menu.getText().contains(containedInonsoleName)) {
+// log.info("Switching consoleView to display '"
+// + menu.getText() + "'. console");
+// menu.click();
+// return true;
+// }
+// }
+// }
return false;
}
More information about the jbosstools-commits
mailing list