Author: jpeterka
Date: 2010-10-12 11:49:57 -0400 (Tue, 12 Oct 2010)
New Revision: 25753
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ButtonIsDisabled.java
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
Log:
ButtonIsDisabled condition added
EclipseBot #createProject shell not found fixed
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 2010-10-12
15:37:25 UTC (rev 25752)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2010-10-12
15:49:57 UTC (rev 25753)
@@ -38,17 +38,18 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.hamcrest.Matcher;
+import org.jboss.tools.ui.bot.ext.condition.ButtonIsDisabled;
import org.jboss.tools.ui.bot.ext.entity.JavaClassEntity;
import org.jboss.tools.ui.bot.ext.entity.JavaProjectEntity;
import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.ServerServer;
import org.jboss.tools.ui.bot.ext.gen.IServer;
import org.jboss.tools.ui.bot.ext.gen.IServerRuntime;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.ServerServer;
import org.jboss.tools.ui.bot.ext.types.EntityType;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.types.IDELabel.PreferencesDialog;
import org.jboss.tools.ui.bot.ext.types.PerspectiveType;
import org.jboss.tools.ui.bot.ext.types.ViewType;
-import org.jboss.tools.ui.bot.ext.types.IDELabel.PreferencesDialog;
/**
* Provides Eclipse common operation based on SWTBot element operations
@@ -207,12 +208,15 @@
waitForShell(IDELabel.Shell.NEW_JAVA_PROJECT);
// JavaProjectWizard
+ SWTBotShell shell = bot.activeShell();
bot.textWithLabel(IDELabel.JavaProjectWizard.PROJECT_NAME).setText(
entity.getProjectName());
+
+ bot.waitWhile(new ButtonIsDisabled(IDELabel.Button.FINISH));
bot.button(IDELabel.Button.FINISH).click();
// Wait for shell closing JavaProjectWizard
- waitForClosedShell(IDELabel.Shell.NEW_JAVA_PROJECT);
+ waitForClosedShell(shell);
util.waitForNonIgnoredJobs();
}
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ButtonIsDisabled.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ButtonIsDisabled.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ButtonIsDisabled.java 2010-10-12
15:49:57 UTC (rev 25753)
@@ -0,0 +1,36 @@
+package org.jboss.tools.ui.bot.ext.condition;
+
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.utils.StringUtils;
+import org.eclipse.swtbot.swt.finder.utils.internal.Assert;
+import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+
+/**
+ * SWTBot Condition checking if a button is disabled
+ * @author jpeterka
+ *
+ */
+public class ButtonIsDisabled extends DefaultCondition {
+
+ private String text;
+
+ public ButtonIsDisabled(String text) {
+ Assert.isNotNull(text, "The button text was null"); //$NON-NLS-1$
+ Assert.isLegal(!StringUtils.isEmpty(text), "The button text was empty");
//$NON-NLS-1$
+ this.text = text;
+ }
+
+ public String getFailureMessage() {
+ return "The button '" + text + "' is not disabled";
//$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public boolean test() throws Exception {
+ try {
+ SWTBotButton button = bot.buttonWithLabel(text);
+ return !button.isEnabled();
+ } catch (WidgetNotFoundException e) {
+ }
+ return false;
+ }
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ButtonIsDisabled.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Show replies by date