Author: vpakan(a)redhat.com
Date: 2011-12-02 08:49:14 -0500 (Fri, 02 Dec 2011)
New Revision: 36880
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/CodeCompletionTest.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ContentAssistBot.java
Log:
Added test for Code Completion functionality for msgs[...
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 2011-12-02
13:32:34 UTC (rev 36879)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/CodeCompletionTest.java 2011-12-02
13:49:14 UTC (rev 36880)
@@ -14,7 +14,9 @@
import java.util.LinkedList;
import java.util.List;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.jboss.tools.jsf.ui.bot.test.JSFAutoTestCase;
+import org.jboss.tools.ui.bot.ext.Assertions;
import org.jboss.tools.ui.bot.ext.SWTJBTExt;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.Timing;
@@ -304,6 +306,46 @@
expectedProposals);
}
/**
+ * Test Code Completion functionality for msgs[
+ */
+ public void testCodeCompletionOfMsgsWithBrackets(){
+ initFaceletsPageTest();
+ SWTJBTExt.selectTextInSourcePane(SWTTestExt.bot,
+ FACELETS_TEST_PAGE,
+ "<h:message ",
+ 0,
+ 0,
+ 0);
+ editor.insertText("\n");
+ String textToInsert = "<h:outputText value=\"#{msg[";
+ final SWTBotShell[] shellsBefore = bot.shells();
+ editor.typeText(textToInsert);
+ bot.sleep(Timing.time2S());
+ // Check Content Assist invoked by typing
+ ContentAssistBot contentAssist = editor.contentAssist();
+ final List<String> caProposals = contentAssist.getProposalList(shellsBefore,
bot.shells(), true);
+ String useCodeAssist = "greeting";
+ assertTrue("Content assist has to contain item " + useCodeAssist +
+ " but it does not.",
+ caProposals.contains(useCodeAssist));
+ useCodeAssist = "prompt";
+ assertTrue("Content assist has to contain item " + useCodeAssist +
+ " but it does not.",
+ caProposals.contains(useCodeAssist));
+ // Check Content Assist invoked by Ctrl-Space
+ useCodeAssist = "greeting";
+ contentAssist.checkContentAssist(useCodeAssist, false);
+ useCodeAssist = "prompt";
+ contentAssist.checkContentAssist(useCodeAssist, true);
+ final String textToInsertAtEnd = "\"/>";
+ editor.insertText(editor.cursorPosition().line,
+ editor.cursorPosition().column + 2,
+ textToInsertAtEnd);
+ Assertions.assertSourceEditorContains(editor.getText(),
+ textToInsert + "'" + useCodeAssist + "']}" +
textToInsertAtEnd,
+ FACELETS_TEST_PAGE);
+ }
+ /**
* Initialize test which are using facelets test page
*/
private void initFaceletsPageTest() {
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ContentAssistBot.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ContentAssistBot.java 2011-12-02
13:32:34 UTC (rev 36879)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ContentAssistBot.java 2011-12-02
13:49:14 UTC (rev 36880)
@@ -95,10 +95,9 @@
}
}
/**
- * Logs proposal list contents, usual for debug purposes
- *
- * @param text
- */
+ * Returns proposal list
+ * @return
+ */
public List<String>getProposalList() {
List<String> result = null;
SWTBotShell shell = openProposalList();
@@ -108,6 +107,24 @@
return result;
}
+ /**
+ * Logs proposal list contents, when Content Assist window is already opened
+ * @param shellsBefore - list of shells before Content Assist was invoked
+ * @param shellsAfter - list of shells after Content Assist was invoked
+ * @param closeShell
+ * @return
+ */
+ public List<String>getProposalList(SWTBotShell[] shellsBefore, SWTBotShell[]
shellsAfter, boolean closeShell) {
+ List<String> result = null;
+ SWTBotShell caShell = getContentAssistShell(shellsBefore, shellsAfter);
+ SWTBotTable caTable = getProposalTable(caShell);
+ result = getTableItems(caTable);
+ if (closeShell) {
+ caShell.close();
+ }
+
+ return result;
+ }
// ------------------------------------------------------------
// Private
// ------------------------------------------------------------
Show replies by date