Author: dmaliarevich
Date: 2010-02-23 07:35:38 -0500 (Tue, 23 Feb 2010)
New Revision: 20431
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExprotUnknownTagsWizardTest.java
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ImportUnknownTagsWizardTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2795, updating SWTBot Test for Export wizard.
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExprotUnknownTagsWizardTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExprotUnknownTagsWizardTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExprotUnknownTagsWizardTest.java 2010-02-23
12:35:38 UTC (rev 20431)
@@ -0,0 +1,86 @@
+package org.jboss.tools.vpe.ui.bot.test.wizard;
+
+import java.io.File;
+import java.net.URL;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
+import org.jboss.tools.vpe.editor.template.VpeAnyData;
+import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
+import org.jboss.tools.vpe.ui.bot.test.VPEAutoTestCase;
+import org.osgi.framework.Bundle;
+
+public class ExprotUnknownTagsWizardTest extends VPEAutoTestCase {
+
+ private final String STORED_TAGS_PATH = "storedTags.xml"; //$NON-NLS-1$
+
+ public ExprotUnknownTagsWizardTest() {
+ }
+
+ @Override
+ protected void closeUnuseDialogs() {
+
+ }
+
+ @Override
+ protected boolean isUnuseDialogOpened() {
+ return false;
+ }
+
+ public void _testExportWizard() throws Throwable {
+ /*
+ * Load templates and add them to the model
+ */
+ Bundle bundle = Platform.getBundle("org.jboss.tools.vpe.ui.bot.test");
//$NON-NLS-1$
+ URL url = bundle.getEntry("/resources"); //$NON-NLS-1$
+ url = FileLocator.resolve(url);
+ IPath path = new Path(url.getPath());
+ File file = path.append(STORED_TAGS_PATH).toFile();
+ assertTrue("File '" + file.getAbsolutePath() +"' does not
exist.", file.exists()); //$NON-NLS-1$ //$NON-NLS-2$
+ List<VpeAnyData> templates = VpeTemplateManager.getInstance().getAnyTemplates(new
Path(file.getAbsolutePath()));
+ VpeTemplateManager.getInstance().setAnyTemplates(templates);
+ /*
+ * Open wizard page
+ */
+ bot.menu("File").menu("Export...").click(); //$NON-NLS-1$
//$NON-NLS-2$
+ bot.shell("Export").activate(); //$NON-NLS-1$
+ SWTBotTree importTree = bot.tree();
+ importTree.expandNode("Other").select("Unknown tags templates");
//$NON-NLS-1$ //$NON-NLS-2$
+ bot.button(WidgetVariables.NEXT_BUTTON).click();
+ /*
+ * Check table values
+ */
+ String taglib = bot.table().cell(0, 0);
+ assertEquals("Wrong table value.", "taglibName:tagName",
taglib); //$NON-NLS-1$ //$NON-NLS-2$
+ taglib = bot.table().cell(1, 0);
+ assertEquals("Wrong table value.", "lib:tag", taglib);
//$NON-NLS-1$ //$NON-NLS-2$
+ assertFalse("Finish button should be disabled.", //$NON-NLS-1$
+ bot.button(WidgetVariables.FINISH_BUTTON).isEnabled());
+ /*
+ * Enter the path to store the tags.
+ */
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ JBT_TEST_PROJECT_NAME);
+ path = project.getLocation().append(STORED_TAGS_PATH);
+ bot.text().setText(path.toOSString());
+ /*
+ * Check that finish button is enabled and press it.
+ */
+ assertTrue("Finish button should be enabled.", //$NON-NLS-1$
+ bot.button(WidgetVariables.FINISH_BUTTON).isEnabled());
+ bot.button(WidgetVariables.FINISH_BUTTON).click();
+ /*
+ * Check that file has been created and saved.
+ */
+ file = new File(path.toOSString());
+ assertTrue("File '" + file.getAbsolutePath() +"' does not
exist.", file.exists()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ImportUnknownTagsWizardTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ImportUnknownTagsWizardTest.java 2010-02-23
11:10:07 UTC (rev 20430)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ImportUnknownTagsWizardTest.java 2010-02-23
12:35:38 UTC (rev 20431)
@@ -65,11 +65,10 @@
taglib = bot.table().cell(1, 0);
assertEquals("Wrong table value.", "taglibName:tagName",
taglib); //$NON-NLS-1$ //$NON-NLS-2$
/*
- * Check that finish button is enabled
+ * Check that finish button is enabled and press it.
*/
assertTrue("Finish button should be enabled.", //$NON-NLS-1$
- bot.button(WidgetVariables.FINISH_BUTTON).isEnabled());
- bot.sleep(5000);
+ bot.button(WidgetVariables.FINISH_BUTTON).isEnabled());
bot.button(WidgetVariables.FINISH_BUTTON).click();
/*
* Check that templates have been added to the preference page