[jbosstools-commits] JBoss Tools SVN: r39673 - in trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test: editor/tags and 2 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Mar 20 14:31:23 EDT 2012


Author: vpakan at redhat.com
Date: 2012-03-20 14:31:19 -0400 (Tue, 20 Mar 2012)
New Revision: 39673

Added:
   trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/SelectTagTest.java
   trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/palette/RichFacesComponentTest.java
Modified:
   trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
   trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/AudioTagTest.java
   trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/CanvasTagTest.java
   trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CodeCompletionTest.java
Log:
Added test for rich:select tag and extend code completion tests for richFaces components. Change copyright year to 2012.

Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java	2012-03-20 18:21:34 UTC (rev 39672)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java	2012-03-20 18:31:19 UTC (rev 39673)
@@ -79,6 +79,7 @@
 import org.jboss.tools.vpe.ui.bot.test.editor.tags.PanelTagTest;
 import org.jboss.tools.vpe.ui.bot.test.editor.tags.PickListTagTest;
 import org.jboss.tools.vpe.ui.bot.test.editor.tags.ProgressTagTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.tags.SelectTagTest;
 import org.jboss.tools.vpe.ui.bot.test.editor.tags.SpacerTagTest;
 import org.jboss.tools.vpe.ui.bot.test.editor.tags.SummaryTagTest;
 import org.jboss.tools.vpe.ui.bot.test.editor.tags.TogglePanelAndToogleControlTagTest;
@@ -93,6 +94,7 @@
 import org.jboss.tools.vpe.ui.bot.test.palette.ImportTagsFromTLDFileTest;
 import org.jboss.tools.vpe.ui.bot.test.palette.ManagePaletteGroupsTest;
 import org.jboss.tools.vpe.ui.bot.test.palette.PaletteEditorTest;
+import org.jboss.tools.vpe.ui.bot.test.palette.RichFacesComponentTest;
 import org.jboss.tools.vpe.ui.bot.test.smoke.CodeCompletionTest;
 import org.jboss.tools.vpe.ui.bot.test.smoke.EditorSynchronizationTest;
 import org.jboss.tools.vpe.ui.bot.test.smoke.JSPPageCreationTest;
@@ -204,7 +206,9 @@
   CanvasTagTest.class,
   CommandTagTest.class,
   DetailsTagTest.class,
-  SummaryTagTest.class
+  SummaryTagTest.class,
+  SelectTagTest.class,
+  RichFacesComponentTest.class
 })
 public class VPEAllBotTests extends SWTBotTestCase{
 

Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/AudioTagTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/AudioTagTest.java	2012-03-20 18:21:34 UTC (rev 39672)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/AudioTagTest.java	2012-03-20 18:31:19 UTC (rev 39673)
@@ -17,6 +17,7 @@
  *
  */
 public class AudioTagTest extends AbstractTagTest{
+  private static final String AUDIO_TAG_TEXT = "<audio/>";
   @Override
   protected void initTestPage() {
     initTestPage(TestPageType.HTML,
@@ -27,8 +28,7 @@
         "    <title>Insert title here</title>\n" +
         "  </head>\n" +
         "  <body>\n" +
-        "    <audio>\n" +
-        "    </audio>\n" +
+        "    " + AudioTagTest.AUDIO_TAG_TEXT + "\n" +
         "  </body>\n" +
         "</html>\n");
   }
@@ -39,6 +39,12 @@
     assertProbelmsViewNoErrors(botExt);
     // visual representation contains AUDIO tag
     assertVisualEditorContains(getVisualEditor(), "AUDIO", null, null, getTestPageFileName());
+    // test tag selection
+    getVisualEditor().selectDomNode(getVisualEditor().getDomNodeByTagName("AUDIO",0), 0);
+    final String selectedText = getSourceEditor().getSelection();
+    assertTrue("Selected text in Source Pane has to be '" + AudioTagTest.AUDIO_TAG_TEXT + "'" +
+        "\nbut it is '" + selectedText + "'",
+      selectedText.trim().equals(AudioTagTest.AUDIO_TAG_TEXT));
   }
 
 }

Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/CanvasTagTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/CanvasTagTest.java	2012-03-20 18:21:34 UTC (rev 39672)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/CanvasTagTest.java	2012-03-20 18:31:19 UTC (rev 39673)
@@ -17,6 +17,7 @@
  *
  */
 public class CanvasTagTest extends AbstractTagTest{
+  private static final String CANVAS_TAG_TEXT = "<canvas id=\"myCanvas\"></canvas>";
   @Override
   protected void initTestPage() {
     initTestPage(TestPageType.HTML,
@@ -27,7 +28,7 @@
         "    <title>Insert title here</title>\n" +
         "  </head>\n" +
         "  <body>\n" +
-        "    <canvas id=\"myCanvas\"></canvas>\n" +
+        "    " + CanvasTagTest.CANVAS_TAG_TEXT + "\n" +
         "  </body>\n" +
         "</html>\n");
   }
@@ -38,6 +39,12 @@
     assertProbelmsViewNoErrors(botExt);
     // visual representation contains CANVAS tag
     assertVisualEditorContains(getVisualEditor(), "CANVAS", null, null, getTestPageFileName());
+    // test tag selection
+    getVisualEditor().selectDomNode(getVisualEditor().getDomNodeByTagName("CANVAS",0), 0);
+    final String selectedText = getSourceEditor().getSelection();
+    assertTrue("Selected text in Source Pane has to be '" + CanvasTagTest.CANVAS_TAG_TEXT + "'" +
+        "\nbut it is '" + selectedText + "'",
+      selectedText.trim().equals(CanvasTagTest.CANVAS_TAG_TEXT));
   }
 
 }

Added: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/SelectTagTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/SelectTagTest.java	                        (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/SelectTagTest.java	2012-03-20 18:31:19 UTC (rev 39673)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+
+ * Copyright (c) 2007-2012 Exadel, Inc. and 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
+ *
+ * Contributors:
+ *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.bot.test.editor.tags;
+
+import org.jboss.tools.ui.bot.ext.Timing;
+
+/**
+ * Tests Rich Faces Select Tag behavior 
+ * @author vlado pakan
+ *
+ */
+public class SelectTagTest extends AbstractTagTest{
+  @Override
+  protected void initTestPage() {
+    initTestPage(TestPageType.XHTML,
+        "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
+            "<html xmlns=\"http://www.w3.org/1999/xhtml\"\n" +
+            "  xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n" +
+            "  xmlns:f=\"http://java.sun.com/jsf/core\"\n" +
+            "  xmlns:rich=\"http://richfaces.org/rich\">\n" + 
+            "  <head>\n" +
+            "  </head>\n" +
+            "  <body>\n" +
+            "    <f:view>\n" +
+        "          <rich:select/>\n" +
+        "    </f:view>\n" +
+        "  </body>\n" + 
+        "</html>");
+  }
+
+  @Override
+  protected void verifyTag() {
+    assertVisualEditorContains(getVisualEditor(),
+      "SELECT", 
+      null,
+      null,
+      getTestPageFileName());
+    // check tag selection
+    getVisualEditor().selectDomNode(getVisualEditor().getDomNodeByTagName("SELECT",0), 0);
+    bot.sleep(Timing.time3S());
+    String selectedText = getSourceEditor().getSelection();
+    final String expectedSelectedText = "<rich:select/>";
+    assertTrue("Selected text in Source Pane has to be '" + expectedSelectedText + "'" +
+      "\nbut it is '" + selectedText + "'",
+      selectedText.trim().equals(expectedSelectedText));
+  }
+
+}


Property changes on: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/SelectTagTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/palette/RichFacesComponentTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/palette/RichFacesComponentTest.java	                        (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/palette/RichFacesComponentTest.java	2012-03-20 18:31:19 UTC (rev 39673)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+
+ * Copyright (c) 2007-2012 Exadel, Inc. and 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
+ *
+ * Contributors:
+ *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.bot.test.palette;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.vpe.ui.bot.test.VPEAutoTestCase;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
+
+/**
+ * Tests if some richFaces components are present in JBoss Palette  
+ * @author vlado pakan
+ *
+ */
+public class RichFacesComponentTest extends VPEAutoTestCase {
+  private SWTBotExt botExt = null;
+  
+  public RichFacesComponentTest() {
+    super();
+    botExt = new SWTBotExt();
+  }
+  /**
+   * Check if some richFaces components are present in JBoss Tools Palette 
+   */
+	public void testRichFacesComponents(){
+	  openPage();
+    openPalette();	
+    StringBuffer sbMissingComponents = new StringBuffer("");
+    for (String componentLabel : RichFacesComponentTest.getRichFacesComponentsToCheck()){
+      if (!SWTBotWebBrowser.paletteContainsPaletteEntry(botExt,componentLabel)){
+        if (sbMissingComponents.length() != 0){
+          sbMissingComponents.append("\n");
+        }
+        sbMissingComponents.append(componentLabel);
+      }
+    }
+    assertTrue("There are these missing richFaces components within JBoss Tools Palette: " + sbMissingComponents,
+        sbMissingComponents.length() == 0);
+	}
+	@Override
+	protected void closeUnuseDialogs() {
+
+	}
+
+	@Override
+	protected boolean isUnuseDialogOpened() {
+		return false;
+	}
+  /**
+   * Returns list of richFaces tags to check for presence within JBoss Tools Palette	
+   * @return
+   */
+	private static List<String> getRichFacesComponentsToCheck(){
+	  LinkedList<String> result = new LinkedList<String>();
+	  
+	  result.add("editor");
+	  result.add("pickList");
+	  result.add("calendar");
+	  result.add("tree");
+	  result.add("inplaceSelect");
+	  result.add("notifyMessage");
+	  result.add("tooltip");
+	  result.add("select");
+	  	  
+	  return result;	  
+	}
+	
+}


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

Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CodeCompletionTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CodeCompletionTest.java	2012-03-20 18:21:34 UTC (rev 39672)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/CodeCompletionTest.java	2012-03-20 18:31:19 UTC (rev 39673)
@@ -28,8 +28,10 @@
  */
 public class CodeCompletionTest extends VPEEditorTestCase{
   static final private String HTML_PAGE_NAME = "CodeComletionPage.html";
+  static final private String XHTML_PAGE_NAME = "CodeComletionPage.xhtml";
   private SWTBotEditorExt editor;
   private SWTBotEditorExt htmlEditor;
+  private SWTBotEditorExt xhtmlEditor;
   private String originalEditorText;
   @Override
   public void setUp() throws Exception {
@@ -42,11 +44,17 @@
   public void tearDown() throws Exception {
     if (editor != null){
       editor.setText(originalEditorText);
-      editor.saveAndClose();
+      editor.save();
+      editor.close();
     }
     if (htmlEditor != null){
+      htmlEditor.save();
       htmlEditor.close();
     }
+    if (xhtmlEditor != null){
+      xhtmlEditor.save();
+      xhtmlEditor.close();
+    }
     super.tearDown();
   }
   /**
@@ -125,6 +133,45 @@
         sbMissingProposals.length() == 0 );
   }
   /**
+   * Tests Code Completion for RichFaces tags
+   */
+  public void testCodeCompletionOfRichFacesTags(){
+    createXhtmlPage(CodeCompletionTest.XHTML_PAGE_NAME);
+    SWTBotExt botExt = new SWTBotExt();
+    SWTBotEditorExt xhtmlEditor = botExt.swtBotEditorExtByTitle(CodeCompletionTest.XHTML_PAGE_NAME);
+    xhtmlEditor.setText("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
+        "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"\n" +
+        "  xmlns:h=\"http://java.sun.com/jsf/html\"\n" +
+        "  xmlns:f=\"http://java.sun.com/jsf/core\"\n" +
+        "  xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n" +
+        "  xmlns:a4j=\"http://richfaces.org/a4j\"\n" +
+        "  xmlns:rich=\"http://richfaces.org/rich\">\n" +
+        "  <rich:\n" +
+        "</ui:composition>");
+    xhtmlEditor.save();
+    bot.sleep(Timing.time2S());
+    final String tagToSelect = "<rich:";
+    SWTJBTExt.selectTextInSourcePane(botExt,
+        CodeCompletionTest.XHTML_PAGE_NAME,
+        tagToSelect,
+        tagToSelect.length(),
+        0,
+        0);
+    List<String> proposals = xhtmlEditor.contentAssist().getProposalList();
+    StringBuffer sbMissingProposals = new StringBuffer("");
+    for (String expectedItem : getRichFacesProposalList()){
+      if (!proposals.contains(expectedItem)){
+        if (sbMissingProposals.length() != 0){
+          sbMissingProposals.append(",");
+        }
+        sbMissingProposals.append(expectedItem);
+      }
+    }
+    assertTrue("There are missing Code Assist proposals for these HTML 5 tags: " + sbMissingProposals.toString(),
+        sbMissingProposals.length() == 0 );
+
+  }
+  /**
    * Returns list of expected Content Assist proposals for jsp page within <f:view> tag
    * @return
    */
@@ -233,7 +280,7 @@
     return result;
   } 
   /**
-   * Returns list of HTML% tags which should be in Code Assist proposals 
+   * Returns list of HTML 5 tags which should be in Code Assist proposals 
    * @return
    */
   private static List<String> getHTML5ProposalList() {
@@ -263,4 +310,17 @@
     result.add("video");
     return result;
   }
+  
+  /**
+   * Returns list of richFaces tags which should be in Code Assist proposals 
+   * @return
+   */
+  private static List<String> getRichFacesProposalList() {
+    List<String> result = new LinkedList<String>();
+    result.add("rich:calendar");
+    result.add("rich:tree");
+    result.add("rich:inplaceSelect");
+    result.add("rich:select");
+    return result;
+  }
 }
\ No newline at end of file



More information about the jbosstools-commits mailing list