[jbosstools-commits] JBoss Tools SVN: r42866 - trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Aug 6 12:01:19 EDT 2012


Author: vpakan at redhat.com
Date: 2012-08-06 12:01:18 -0400 (Mon, 06 Aug 2012)
New Revision: 42866

Modified:
   trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AddRemoveJSFCapabilitiesTest.java
   trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/CodeCompletionTest.java
Log:
Fixes for JBT 3.4

Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AddRemoveJSFCapabilitiesTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AddRemoveJSFCapabilitiesTest.java	2012-08-06 15:47:49 UTC (rev 42865)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AddRemoveJSFCapabilitiesTest.java	2012-08-06 16:01:18 UTC (rev 42866)
@@ -195,9 +195,16 @@
         IDELabel.Menu.ADD_JSF_CAPABILITIES).click();
     } catch (WidgetNotFoundException wnfe){
       // From 3.1.0.RC1 version this menu is moved to Configure submenu
-      new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,
-        IDELabel.Menu.PACKAGE_EXPLORER_CONFIGURE, false)).menu(
-        IDELabel.Menu.ADD_JSF_CAPABILITIES).click();
+      try{
+        new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,
+            IDELabel.Menu.PACKAGE_EXPLORER_CONFIGURE, false)).menu(
+            IDELabel.Menu.ADD_JSF_CAPABILITIES).click();
+      }catch (WidgetNotFoundException wnfex){
+        // sometimes context menu is not created properly after first click
+        new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,
+            IDELabel.Menu.PACKAGE_EXPLORER_CONFIGURE, false)).menu(
+            IDELabel.Menu.ADD_JSF_CAPABILITIES).click();
+      }
     }
  
     delay();

Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/CodeCompletionTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/CodeCompletionTest.java	2012-08-06 15:47:49 UTC (rev 42865)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/CodeCompletionTest.java	2012-08-06 16:01:18 UTC (rev 42866)
@@ -57,14 +57,13 @@
         0, 
         expectedProposals);
     // Check content assist for #{msg. prefix
-    expectedProposals.clear();
-    expectedProposals.add("name : String - Person");
-    ContentAssistHelper.checkContentAssistContent(SWTTestExt.bot, 
+    ContentAssistHelper.checkContentAssistAutoProposal(SWTTestExt.bot, 
         FACELETS_TEST_PAGE,
         textForSelection, 
         16, 
         0, 
-        expectedProposals);
+        0,
+        "name");
   }
   /**
    * Test Code Completion functionality for resource
@@ -138,12 +137,18 @@
         0);
     String contentAssistToUse = "jsfc";
     ContentAssistBot contentAssist = editor.contentAssist();
+    SWTBotShell[] shellsBeforeCA = bot.shells();
     contentAssist.checkContentAssist(contentAssistToUse, true);
     editor.save();
+    SWTBotShell caShell = contentAssist.getContentAssistShell(shellsBeforeCA, bot.shells());
+    if (caShell != null){
+      caShell.close();  
+    }    
     String expectedInsertedText = "<input " + contentAssistToUse + "=\"\"";
     assertTrue("Editor has to contain text '" + expectedInsertedText + "' but it doesn't\n" +
         "Editor Text is\n" + editor.getText(),
       editor.getText().contains(expectedInsertedText));
+    // hide Code Assist Window automatically opened when typing text
     // check jsfc attribute value Content Assist menu Content
     ContentAssistHelper.checkContentAssistContent(SWTTestExt.bot, 
         FACELETS_TEST_PAGE,
@@ -189,29 +194,21 @@
         0);
     String textToInsert = "<ez:";
     compositeComponentContainerEditor.insertText(textToInsert);
-    SWTJBTExt.selectTextInSourcePane(SWTTestExt.bot, 
+    // Check content assist menu content for "<ez:"
+    String expectedInsertedText = "input action=\"\" value=\"\"></ez:input>";
+    ContentAssistHelper.checkContentAssistAutoProposal(SWTTestExt.bot, 
         JSF2_TEST_PAGE,
         textToInsert, 
         textToInsert.length(), 
         0, 
-        0);
-    // Check content assist menu content for "<ez:"
-    contentAssist.checkContentAssist("ez:input", true);
-    bot.sleep(Timing.time2S());
+        0,
+        expectedInsertedText);
     compositeComponentContainerEditor.save();
-    String currentLineText = compositeComponentContainerEditor.getTextOnCurrentLine();
-    String expectedInsertedText = "<ez:input value=\"\" action=\"\"></ez:input>";
-    if (!currentLineText.toLowerCase().contains(expectedInsertedText.toLowerCase())){
-      expectedInsertedText = "<ez:input action=\"\" value=\"\"></ez:input>";
-      assertTrue("Inserted text should be " + expectedInsertedText + " but is not.\n" 
-          + "Current line text is " + currentLineText,
-        currentLineText.toLowerCase().contains(expectedInsertedText.toLowerCase()));
-    }
     // Check content assist menu content for Composite Components attributes    
     ContentAssistHelper.checkContentAssistContent(SWTTestExt.bot, 
         JSF2_TEST_PAGE,
         expectedInsertedText, 
-        10, 
+        6, 
         0, 
         getCompositeComponentsAttributesProposalList());
     // Open Composite Component definition file
@@ -240,7 +237,7 @@
     contentAssist.checkContentAssist("cc.attrs", true);
     bot.sleep(Timing.time2S());
     compositeComponentDefEditor.save();
-    currentLineText = compositeComponentDefEditor.getTextOnCurrentLine();
+    String currentLineText = compositeComponentDefEditor.getTextOnCurrentLine();
     expectedInsertedText = "#{cc.attrs}";
     assertTrue("Inserted text should be " + expectedInsertedText + " but is not.\n" 
         + "Current line text is " + currentLineText,



More information about the jbosstools-commits mailing list