[jbosstools-commits] JBoss Tools SVN: r43542 - in trunk: jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test and 3 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Sun Sep 9 14:54:52 EDT 2012
Author: vpakan at redhat.com
Date: 2012-09-09 14:54:51 -0400 (Sun, 09 Sep 2012)
New Revision: 43542
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java
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/templates/SetTemplateForUnknownTagTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/UnknownTemplateTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java
Log:
Fixes for JBT 4.0.0.Alpha1
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/META-INF/MANIFEST.MF 2012-09-08 22:04:10 UTC (rev 43541)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/META-INF/MANIFEST.MF 2012-09-09 18:54:51 UTC (rev 43542)
@@ -15,7 +15,9 @@
org.eclipse.swtbot.junit4_x;bundle-version="2.0.0",
org.jboss.tools.jsf.ui;bundle-version="3.2.0",
org.jboss.tools.ui.bot.ext,
- org.eclipse.gef
+ org.eclipse.gef,
+ org.jboss.tools.vpe.ui.bot.test;bundle-version="3.4.0",
+ org.jboss.tools.jst.ui.bot.test
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.jboss.tools.ui.bot.test,
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java 2012-09-08 22:04:10 UTC (rev 43541)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java 2012-09-09 18:54:51 UTC (rev 43542)
@@ -11,6 +11,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.jboss.tools.ui.bot.test.WidgetVariables;
import org.jboss.tools.vpe.ui.bot.test.VPEAutoTestCase;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
public abstract class JSFAutoTestCase extends VPEAutoTestCase {
@@ -118,5 +119,40 @@
protected static String stripCSSText(String editorText){
return editorText.replaceAll("\n", "").replaceAll("\t", "").replaceAll("\r", "").replaceAll(" ", "");
}
-
+ /**
+ * Asserts if Visual Editor contains node with value valueToContain
+ * @param webBrowser
+ * @param valueToContain
+ * @param fileName
+ */
+ protected static void assertVisualEditorContainsNodeWithValue (SWTBotWebBrowser webBrowser,
+ String valueToContain,
+ String fileName){
+ assertTrue("Visual Representation of file " + fileName
+ + " has to contain node with "
+ + valueToContain
+ + " value but it doesn't",
+ webBrowser.containsNodeWithValue(webBrowser,
+ valueToContain));
+
+ }
+
+ /**
+ * Asserts if Visual Editor doesn't contain node with particular attributes
+ * @param webBrowser
+ * @param valueToContain
+ * @param fileName
+ */
+ protected static void assertVisualEditorNotContainNodeWithValue (SWTBotWebBrowser webBrowser,
+ String valueToContain,
+ String fileName){
+
+ assertFalse("Visual Representation of file " + fileName
+ + " cannot contain node with "
+ + valueToContain
+ + " value but it does",
+ webBrowser.containsNodeWithValue(webBrowser,
+ valueToContain));
+
+ }
}
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-09-08 22:04:10 UTC (rev 43541)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/CodeCompletionTest.java 2012-09-09 18:54:51 UTC (rev 43542)
@@ -194,32 +194,29 @@
0);
String textToInsert = "<ez:";
compositeComponentContainerEditor.insertText(textToInsert);
+ SWTJBTExt.selectTextInSourcePane(SWTTestExt.bot,
+ JSF2_TEST_PAGE,
+ textToInsert,
+ textToInsert.length(),
+ 0,
+ 0);
// Check content assist menu content for "<ez:"
- String expectedInsertedText = "input action=\"\" value=\"\"></ez:input>";
- try{
- ContentAssistHelper.checkContentAssistAutoProposal(SWTTestExt.bot,
- JSF2_TEST_PAGE,
- textToInsert,
- textToInsert.length(),
- 0,
- 0,
- expectedInsertedText);
- } catch (AssertionError ae){
- // because order of attributes is not guaranteed check
- // it has to be checked with different order
- expectedInsertedText = "input value=\"\" action=\"\"></ez:input>";
- final String textOnCurrentLine = compositeComponentContainerEditor.getTextOnCurrentLine();
- assertTrue("Text on current line should contain:\n" +
- "<ez:" + expectedInsertedText +
- "\nbut is:\n" + textOnCurrentLine
- , textOnCurrentLine.contains("<ez:" + expectedInsertedText));
- }
+ contentAssist.checkContentAssist("ez:input", true);
+ bot.sleep(Timing.time2S());
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,
- 6,
+ 10,
0,
getCompositeComponentsAttributesProposalList());
// Open Composite Component definition file
@@ -248,7 +245,7 @@
contentAssist.checkContentAssist("cc.attrs", true);
bot.sleep(Timing.time2S());
compositeComponentDefEditor.save();
- String currentLineText = compositeComponentDefEditor.getTextOnCurrentLine();
+ currentLineText = compositeComponentDefEditor.getTextOnCurrentLine();
expectedInsertedText = "#{cc.attrs}";
assertTrue("Inserted text should be " + expectedInsertedText + " but is not.\n"
+ "Current line text is " + currentLineText,
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/SetTemplateForUnknownTagTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/SetTemplateForUnknownTagTest.java 2012-09-08 22:04:10 UTC (rev 43541)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/SetTemplateForUnknownTagTest.java 2012-09-09 18:54:51 UTC (rev 43542)
@@ -16,8 +16,11 @@
import org.jboss.tools.jsf.ui.bot.test.JSFAutoTestCase;
import org.jboss.tools.jsf.ui.bot.test.UnknownTagDialogVariables;
import org.jboss.tools.ui.bot.ext.CompareUtils;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTJBTExt;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.test.WidgetVariables;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
public class SetTemplateForUnknownTagTest extends JSFAutoTestCase {
@@ -25,13 +28,14 @@
private static final String TAG_URI = "http://java.sun.com/jsf/html";//$NON-NLS-1$
private static final String DISPALY_TAG = "b";//$NON-NLS-1$
private static final String CHILDREN_ALLOWS = "yes";//$NON-NLS-1$
+ private static final String TEMPLATE_VALUE = "myValue";
public void testSetTemplateForUnknownTag() throws Throwable{
openTestPage();
setEditor(bot.editorByTitle(TEST_PAGE).toTextEditor());
setEditorText(getEditor().getText());
getEditor().navigateTo(13, 0);
- getEditor().insertText("<h:unknowntag></h:unknowntag>");//$NON-NLS-1$
+ getEditor().insertText("<" + SetTemplateForUnknownTagTest.TAG_NAME + "></" + SetTemplateForUnknownTagTest.TAG_NAME + ">");//$NON-NLS-1$
getEditor().save();
getEditor().navigateTo(13,5);
setUpTemplate();
@@ -49,7 +53,7 @@
bot.textWithLabel(UnknownTagDialogVariables.TAG_URI_FIELD).setText(TAG_URI);
bot.textWithLabel(UnknownTagDialogVariables.DISPLAY_TAG).setText(DISPALY_TAG);
bot.checkBoxWithLabel(UnknownTagDialogVariables.ALLOW_CHILDREN_CHECKBOX).click();
- bot.textWithLabel(UnknownTagDialogVariables.VALUE_FIELD).setText("myValue");//$NON-NLS-1$
+ bot.textWithLabel(UnknownTagDialogVariables.VALUE_FIELD).setText(SetTemplateForUnknownTagTest.TEMPLATE_VALUE);//$NON-NLS-1$
bot.textWithLabel(UnknownTagDialogVariables.TAG_STYLE_FIELD).setText("color:red");//$NON-NLS-1$
bot.buttonWithTooltip(UnknownTagDialogVariables.EDIT_TAG_STYLE_TIP).click();
String returnValue = setStyles();
@@ -60,7 +64,11 @@
+ "Expected: " + "font-family:Arial;color:black;"
+ "Value: " + returnValue
,CompareUtils.compareStyleAttributes("font-family:Arial;color:black;", returnValue));//$NON-NLS-1$
- checkVPE("templates/SetTemplateForUnknownTag.xml");//$NON-NLS-1$
+ bot.toolbarButtonWithTooltip(SWTJBTExt.isRunningOnMacOs() ?
+ IDELabel.ToolbarButton.REFRESH_MAC_OS: IDELabel.ToolbarButton.REFRESH).click();
+ assertVisualEditorContainsNodeWithValue(new SWTBotWebBrowser(TEST_PAGE, new SWTBotExt()),
+ SetTemplateForUnknownTagTest.TEMPLATE_VALUE,
+ TEST_PAGE);
}
private void editTemplate() throws Throwable{
@@ -84,7 +92,14 @@
bot.shell(WidgetVariables.PREF_FILTER_SHELL_TITLE).activate();
bot.button(WidgetVariables.OK_BUTTON).click();
}
- checkVPE("templates/EditedTemplateForUnknownTag.xml"); //$NON-NLS-1$
+ bot.toolbarButtonWithTooltip(SWTJBTExt.isRunningOnMacOs() ?
+ IDELabel.ToolbarButton.REFRESH_MAC_OS: IDELabel.ToolbarButton.REFRESH).click();
+ assertVisualEditorNotContainNodeWithValue(new SWTBotWebBrowser(TEST_PAGE, new SWTBotExt()),
+ SetTemplateForUnknownTagTest.TEMPLATE_VALUE,
+ TEST_PAGE);
+ assertVisualEditorNotContainNodeWithValue(new SWTBotWebBrowser(TEST_PAGE, new SWTBotExt()),
+ SetTemplateForUnknownTagTest.TAG_NAME,
+ TEST_PAGE);
}
private void removeTemplate() throws Throwable{
@@ -95,7 +110,14 @@
bot.button(WidgetVariables.REMOVE_BUTTON).click();
bot.shell(WidgetVariables.PREF_FILTER_SHELL_TITLE).activate();
bot.button(WidgetVariables.OK_BUTTON).click();
- checkVPE("templates/RemoveUnknownTemplate.xml"); //$NON-NLS-1$
+ bot.toolbarButtonWithTooltip(SWTJBTExt.isRunningOnMacOs() ?
+ IDELabel.ToolbarButton.REFRESH_MAC_OS: IDELabel.ToolbarButton.REFRESH).click();
+ assertVisualEditorNotContainNodeWithValue(new SWTBotWebBrowser(TEST_PAGE, new SWTBotExt()),
+ SetTemplateForUnknownTagTest.TEMPLATE_VALUE,
+ TEST_PAGE);
+ assertVisualEditorContainsNodeWithValue(new SWTBotWebBrowser(TEST_PAGE, new SWTBotExt()),
+ SetTemplateForUnknownTagTest.TAG_NAME,
+ TEST_PAGE);
}
private String setStyles(){
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/UnknownTemplateTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/UnknownTemplateTest.java 2012-09-08 22:04:10 UTC (rev 43541)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/UnknownTemplateTest.java 2012-09-09 18:54:51 UTC (rev 43542)
@@ -1,6 +1,8 @@
package org.jboss.tools.jsf.ui.bot.test.templates;
import org.jboss.tools.jsf.ui.bot.test.JSFAutoTestCase;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
public class UnknownTemplateTest extends JSFAutoTestCase {
@@ -13,9 +15,15 @@
getEditor().navigateTo(13, 0);
- getEditor().insertText("<h:unknowntag></h:unknowntag>"); //$NON-NLS-1$
+ final String unknownTag = "h:unknowntag";
- checkVPE("templates/UnknownTemplate.xml"); //$NON-NLS-1$
+ getEditor().insertText("<" + unknownTag + "></" + unknownTag + "h:unknowntag>"); //$NON-NLS-1$
+ getEditor().save();
+ waitForBlockingJobsAcomplished(VISUAL_UPDATE);
+
+ assertVisualEditorContainsNodeWithValue(new SWTBotWebBrowser(TEST_PAGE, new SWTBotExt()),
+ unknownTag,
+ TEST_PAGE);
}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java 2012-09-08 22:04:10 UTC (rev 43541)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java 2012-09-09 18:54:51 UTC (rev 43542)
@@ -488,6 +488,15 @@
return result;
}
/**
+ * Returns true if visual editor contains node with value searchText
+ * @param webBrowser
+ * @param searchText
+ * @return
+ */
+ public boolean containsNodeWithValue(SWTBotWebBrowser webBrowser, String searchText) {
+ return containsNodeWithValue(webBrowser.getMozillaEditor().getDomDocument(), searchText);
+ }
+ /**
* Returns Palette Viewer associated to JBoss Tools Palette
* @return
*/
More information about the jbosstools-commits
mailing list