[jbosstools-commits] JBoss Tools SVN: r35897 - in trunk: jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates and 4 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Oct 21 08:12:18 EDT 2011


Author: vpakan at redhat.com
Date: 2011-10-21 08:12:17 -0400 (Fri, 21 Oct 2011)
New Revision: 35897

Added:
   trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/CreateNewTemplateFromJSFProject.java
Modified:
   trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java
   trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java
   trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
   trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
   trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/selectionbar/SelectionBarTest.java
Log:
Added test for JSF template created from JSF project and small fixes for JBT 3.2.2. testing.

Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java	2011-10-21 10:50:14 UTC (rev 35896)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java	2011-10-21 12:12:17 UTC (rev 35897)
@@ -16,6 +16,7 @@
 import org.jboss.tools.jsf.ui.bot.test.smoke.MarkersTest;
 import org.jboss.tools.jsf.ui.bot.test.smoke.OpenOnTest;
 import org.jboss.tools.jsf.ui.bot.test.smoke.WebXmlEditorTest;
+import org.jboss.tools.jsf.ui.bot.test.templates.CreateNewTemplateFromJSFProject;
 import org.jboss.tools.jsf.ui.bot.test.templates.SetTemplateForUnknownTagTest;
 import org.jboss.tools.jsf.ui.bot.test.templates.UnknownTemplateTest;
 import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
@@ -46,7 +47,8 @@
   CodeCompletionTest.class,
   FacesConfigCodeCompletionTest.class,
   MarkersTest.class,
-  WebXmlEditorTest.class
+  WebXmlEditorTest.class,
+  CreateNewTemplateFromJSFProject.class
 })
 public class JSFAllBotTests{
 }
\ No newline at end of file

Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/CreateNewTemplateFromJSFProject.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/CreateNewTemplateFromJSFProject.java	                        (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/CreateNewTemplateFromJSFProject.java	2011-10-21 12:12:17 UTC (rev 35897)
@@ -0,0 +1,90 @@
+ /*******************************************************************************
+  * Copyright (c) 2007-2011 Red Hat, Inc.
+  * Distributed under license by Red Hat, Inc. All rights reserved.
+  * This program is made available under the terms of the
+  * Eclipse Public License v1.0 which accompanies this distribution,
+  * and is available at http://www.eclipse.org/legal/epl-v10.html
+  *
+  * Contributor:
+  *     Red Hat, Inc. - initial API and implementation
+  ******************************************************************************/
+
+package org.jboss.tools.jsf.ui.bot.test.templates;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.jsf.ui.bot.test.JSFAutoTestCase;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
+/**
+ * Test creating new JSF project template from existing project
+ * @author Vladimir Pakan
+ *
+ */
+public class CreateNewTemplateFromJSFProject extends JSFAutoTestCase{
+  
+  private static final String TEST_PAGE_NAME = "CreateNewTemplateFromJSFProject.jsp";
+  private static final String TEMPLATE_NAME = "JsfTestTemplate";
+  private static final String TEMPLATE_IMPLEMENTATION = "JSF 1.2";
+  private static final String TEMPLATE_TEST_PROJECT_NAME = "newTemplateProject";
+	
+	public void testCreateNewJSFProject() {
+		createJspPage(CreateNewTemplateFromJSFProject.TEST_PAGE_NAME);
+    openWebProjects();
+    delay();
+    SWTBot webProjects = bot.viewByTitle(WidgetVariables.WEB_PROJECTS).bot();
+    SWTBotTree tree = webProjects.tree();
+    
+    ContextMenuHelper.prepareTreeItemForContextMenu(tree,
+      tree.getTreeItem(JBT_TEST_PROJECT_NAME));
+
+    new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,
+        IDELabel.Menu.WEB_PROJECT_JBT_JSF, false)).menu(
+          IDELabel.Menu.SAVE_AS_TEMPLATE).click();
+    // create template
+    bot.shell(IDELabel.Shell.ADD_JSF_PROJECT_TEMPLATE).activate();
+    bot.textWithLabel(IDELabel.AddJSFProjectTemplateDialog.NAME_TEXT_LABEL)
+      .setText(CreateNewTemplateFromJSFProject.TEMPLATE_NAME);
+    bot.comboBoxWithLabel(IDELabel.AddJSFProjectTemplateDialog.IMPLEMENTATION_COMBO_LABEL)
+      .setText(CreateNewTemplateFromJSFProject.TEMPLATE_IMPLEMENTATION);
+    bot.button(IDELabel.Button.FINISH).click();
+    // create project using newly created template
+    SWTBot wiz = open
+      .newObject(ActionItem.NewObject.JBossToolsWebJSFJSFProject.LABEL);
+    wiz.textWithLabel(IDELabel.NewJsfProjectDialog.PROJECT_NAME_LABEL)
+      .setText(CreateNewTemplateFromJSFProject.TEMPLATE_TEST_PROJECT_NAME);
+    wiz.comboBoxWithLabel(IDELabel.NewJsfProjectDialog.JSF_ENVIRONMENT_LABEL)
+      .setSelection(CreateNewTemplateFromJSFProject.TEMPLATE_IMPLEMENTATION);
+    wiz.comboBoxWithLabel(IDELabel.NewJsfProjectDialog.TEMPLATE_LABEL)
+      .setSelection(CreateNewTemplateFromJSFProject.TEMPLATE_NAME);
+    wiz.button(IDELabel.Button.NEXT).click();
+    wiz.comboBoxWithLabel(IDELabel.NewJsfProjectDialog.RUNTIME_LABEL)
+      .setSelection(SWTTestExt.configuredState.getServer().name); //$NON-NLS-1$ //$NON-NLS-2$
+    open.finish(wiz);
+    waitForBlockingJobsAcomplished(60 * 1000L, BUILDING_WS);
+    packageExplorer.selectProject(CreateNewTemplateFromJSFProject.TEMPLATE_TEST_PROJECT_NAME);
+    packageExplorer.bot().menu(IDELabel.Menu.FILE).menu(IDELabel.Menu.REFRESH).click();
+    bot.sleep(Timing.time3S());
+    packageExplorer.selectTreeItem(CreateNewTemplateFromJSFProject.TEST_PAGE_NAME,
+        new String[]{CreateNewTemplateFromJSFProject.TEMPLATE_TEST_PROJECT_NAME,
+          "WebContent.pages"}).doubleClick();
+    packageExplorer.deleteProject(CreateNewTemplateFromJSFProject.TEMPLATE_TEST_PROJECT_NAME, true);
+        
+	}
+
+	@Override
+	protected void closeUnuseDialogs() {
+		// not used
+	}
+
+	@Override
+	protected boolean isUnuseDialogOpened() {
+		return false;
+	}
+	
+}


Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/CreateNewTemplateFromJSFProject.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java	2011-10-21 10:50:14 UTC (rev 35896)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java	2011-10-21 12:12:17 UTC (rev 35897)
@@ -124,6 +124,11 @@
         }
       }
     }
+    System.out.println(sb.toString());
+    for (String item : list1){
+      System.out.println("result.add(\"" + item.replaceAll("\"", "\\\"") + "\");");
+    }
+
     return sb.toString();
   }
   

Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java	2011-10-21 10:50:14 UTC (rev 35896)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java	2011-10-21 12:12:17 UTC (rev 35897)
@@ -83,6 +83,7 @@
     public static final String PASTE = "Paste";
     public static final String UNDO = "Undo";
     public static final String CLOSE_ALL = "Close All";
+    public static final String SAVE_AS_TEMPLATE = "Save As Template...";
 	}
 
 	public class Button {
@@ -164,6 +165,7 @@
 	  public static final String ADD_SVN_REPOSITORY = "Add SVN Repository";
 	  public static final String REPOSITORY_LOCATION_PROPERTIES = "Repository Location Properties";
 	  public static final String SECURE_STORAGE = "Secure Storage";
+	  public static final String ADD_JSF_PROJECT_TEMPLATE = "Add JSF Project Template";
 	}
 
 	public class EntityGroup {
@@ -411,7 +413,7 @@
      public static final String JBOSS_EAP_5_0 = "JBoss Enterprise Application Platform 5.0 Runtime";
      public static final String JBOSS_EAP_5_x = "JBoss Enterprise Application Platform 5.x Runtime";
      public static final String JBOSS_AS_5_1 = "JBoss 5.1 Runtime";
-     public static final String JBOSS_AS_6_0 = "JBoss 6.x Runtime";
+     public static final String JBOSS_AS_6_0 = "JBoss 6.0 Runtime";
        
    }
    public static final class ServerType {
@@ -689,7 +691,7 @@
      public static final String PROJECT_NAME_LABEL = "Project Name*";
      public static final String JSF_ENVIRONMENT_LABEL = "JSF Environment*";
      public static final String TEMPLATE_LABEL = "Template*";
-     public static final String RUNTIME_LABEL = "Runtime*";
+     public static final String RUNTIME_LABEL = "Runtime:*";
      public static final String HOME_DIRECTORY_LABEL = "Home Directory";
    }
    
@@ -719,4 +721,9 @@
      public static final String ADD_SERVLET_MAPPING_DIALOG_URL_PATTERN_LABEL = "URL-Pattern:*";
      
    }
+   
+   public static class AddJSFProjectTemplateDialog{
+     public static final String NAME_TEXT_LABEL = "Name:*";
+     public static final String IMPLEMENTATION_COMBO_LABEL = "Implementation:*";
+   }
  }

Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java	2011-10-21 10:50:14 UTC (rev 35896)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java	2011-10-21 12:12:17 UTC (rev 35897)
@@ -432,8 +432,7 @@
 	 * @param projectName
 	 */
 	protected void openPage(String pageName, String projectName) {
-		SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
-				.bot();
+	  SWTBot innerBot = packageExplorer.show().bot();
 		SWTBotTree tree = innerBot.tree();
 		tree.expandNode(projectName).expandNode("WebContent")
 				.expandNode("pages").getNode(pageName).doubleClick(); //$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/editor/selectionbar/SelectionBarTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/selectionbar/SelectionBarTest.java	2011-10-21 10:50:14 UTC (rev 35896)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/selectionbar/SelectionBarTest.java	2011-10-21 12:12:17 UTC (rev 35897)
@@ -84,6 +84,7 @@
 	     * Send key press event to fire VPE listeners
 	     */
 	    KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_LEFT);
+	    bot.sleep(Timing.time3S());
 	    /*
 	     * Click on the tag in the selection bar 
 	     */



More information about the jbosstools-commits mailing list