Author: dmaliarevich
Date: 2012-06-29 07:50:28 -0400 (Fri, 29 Jun 2012)
New Revision: 42303
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/el/
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/el/ElForBundleValueTest_Jbide10531.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/tools/SWTBotWebBrowser.java
Log:
https://issues.jboss.org/browse/JBIDE-10531 - SWTBotTest was added.
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-06-29
11:37:32 UTC (rev 42302)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2012-06-29
11:50:28 UTC (rev 42303)
@@ -92,6 +92,7 @@
import org.jboss.tools.vpe.ui.bot.test.editor.tags.ToolbarAndToolbarGroupTagTest;
import org.jboss.tools.vpe.ui.bot.test.editor.tags.TreeTagTest;
import org.jboss.tools.vpe.ui.bot.test.editor.tags.VirtualEarthTagTest;
+import org.jboss.tools.vpe.ui.bot.test.el.ElForBundleValueTest_Jbide10531;
import org.jboss.tools.vpe.ui.bot.test.jbide.JBIDE4556Test;
import org.jboss.tools.vpe.ui.bot.test.jbide.JBIDE9445Test_DuplicateSourceMenu;
import org.jboss.tools.vpe.ui.bot.test.jbide.Jbide10020_TestHotKeyForVpeRefresh;
@@ -220,7 +221,8 @@
VpeToolbarTest.class,
MultiSelectionTest.class,
SelectionSynchronizationTest.class,
- ScrollingSynchronizationTest.class
+ ScrollingSynchronizationTest.class,
+ ElForBundleValueTest_Jbide10531.class
})
public class VPEAllBotTests extends SWTBotTestCase{
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/el/ElForBundleValueTest_Jbide10531.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/el/ElForBundleValueTest_Jbide10531.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/el/ElForBundleValueTest_Jbide10531.java 2012-06-29
11:50:28 UTC (rev 42303)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.bot.test.el;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.helper.KeyboardHelper;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
+import org.jboss.tools.vpe.ui.bot.test.editor.VPEEditorTestCase;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
+import org.mozilla.interfaces.nsIDOMNode;
+
+public class ElForBundleValueTest_Jbide10531 extends VPEEditorTestCase {
+
+ private SWTBotExt botExt = null;
+ private SWTBotEditorExt jspTextEditor;
+ private SWTBotWebBrowser webBrowser;
+
+ private final String OUT1 = "<br> <h:outputText
value=\"#{Message['prompt_message'}\" /> \n"; //$NON-NLS-1$
+ private final String OUT2 = "<br> <h:outputText
value=\"#{Message[hello_message']}\" /> \n"; //$NON-NLS-1$
+ private final String OUT3 = "<br> <h:outputText
value=\"#{Message'[prompt_message']}\" /> \n"; //$NON-NLS-1$
+ private final String OUT4 = "<br> <h:outputText
value=\"#{Message[hello_message]}\" /> \n"; //$NON-NLS-1$
+
+ private final String OUT5 = "<br /> <h:outputText
value=\"#{msg['prompt'}\" /> \n"; //$NON-NLS-1$
+ private final String OUT6 = "<br /> <h:outputText
value=\"#{msg[greeting']}\" /> \n"; //$NON-NLS-1$
+ private final String OUT7 = "<br /> <h:outputText
value=\"#{msg'[prompt']}\" /> \n"; //$NON-NLS-1$
+ private final String OUT8 = "<br /> <h:outputText
value=\"#{msg[greeting]}\" /> \n"; //$NON-NLS-1$
+
+
+ public ElForBundleValueTest_Jbide10531() {
+ super();
+ botExt = new SWTBotExt();
+ }
+
+ public void testElForBundleValueInJSP() throws Throwable {
+ openPage();
+ util.waitForAll();
+ jspTextEditor = botExt.swtBotEditorExtByTitle(TEST_PAGE);
+ setEditor(jspTextEditor);
+ webBrowser = new SWTBotWebBrowser(TEST_PAGE, botExt);
+ setEditorText(jspTextEditor.getText());
+ jspTextEditor.setFocus();
+ Display d = bot.getDisplay();
+
+ jspTextEditor.insertText(13, 0, OUT4);
+ jspTextEditor.insertText(13, 0, OUT3);
+ jspTextEditor.insertText(13, 0, OUT2);
+ jspTextEditor.insertText(13, 0, OUT1);
+ util.sleep(TIME_1S);
+
+ KeyboardHelper.pressKeyCode(d, SWT.F5);
+ util.sleep(TIME_1S);
+ webBrowser.setFocus();
+ nsIDOMNode node = webBrowser.getDomNodeByTagName("TD", 0); //$NON-NLS-1$
+ util.sleep(TIME_1S);
+ webBrowser.containsNodeWithValue(node,
"#{Message['prompt_message'}"); //$NON-NLS-1$
+ webBrowser.containsNodeWithValue(node, "#{Message[hello_message']}");
//$NON-NLS-1$
+ webBrowser.containsNodeWithValue(node,
"#{Message'[prompt_message']}"); //$NON-NLS-1$
+ webBrowser.containsNodeWithValue(node, "#{Message[hello_message]}");
//$NON-NLS-1$
+ }
+
+ public void testElForBundleValueInXHTML() throws Throwable {
+ openPage(FACELETS_TEST_PAGE, FACELETS_TEST_PROJECT_NAME);
+ util.waitForAll();
+ jspTextEditor = botExt.swtBotEditorExtByTitle(FACELETS_TEST_PAGE);
+ setEditor(jspTextEditor);
+ webBrowser = new SWTBotWebBrowser(FACELETS_TEST_PAGE, botExt);
+ setEditorText(jspTextEditor.getText());
+ jspTextEditor.setFocus();
+ Display d = bot.getDisplay();
+
+ jspTextEditor.insertText(19, 0, OUT8);
+ jspTextEditor.insertText(19, 0, OUT7);
+ jspTextEditor.insertText(19, 0, OUT6);
+ jspTextEditor.insertText(19, 0, OUT5);
+ util.sleep(TIME_1S);
+
+ KeyboardHelper.pressKeyCode(d, SWT.F5);
+ util.sleep(TIME_1S);
+ webBrowser.setFocus();
+ nsIDOMNode node = webBrowser.getDomNodeByTagName("FORM", 0); //$NON-NLS-1$
+ util.sleep(TIME_1S);
+ webBrowser.containsNodeWithValue(node, "#{msg['prompt'}");
//$NON-NLS-1$
+ webBrowser.containsNodeWithValue(node, "#{msg[greeting']}");
//$NON-NLS-1$
+ webBrowser.containsNodeWithValue(node, "#{msg'[prompt']}");
//$NON-NLS-1$
+ webBrowser.containsNodeWithValue(node, "#{msg[greeting]}"); //$NON-NLS-1$
+ }
+}
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-06-29
11:37:32 UTC (rev 42302)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java 2012-06-29
11:50:28 UTC (rev 42303)
@@ -467,31 +467,25 @@
* @return
*/
public boolean containsNodeWithValue(nsIDOMNode node, String searchText) {
- boolean result = false;
+ boolean result = false;
+ String nodeValue = node.getNodeValue();
- String nodeValue = node.getNodeValue();
-
- if (nodeValue != null &&
SWTBotWebBrowser.stripTextFromSpecChars(nodeValue).equals(searchText)) {
- result = true;
- }
- else {
- nsIDOMNodeList children = node.getChildNodes();
-
- for (int i = 0; i < children.getLength() && !result; i++) {
-
- nsIDOMNode child = children.item(i);
-
- // leave out empty text nodes in test dom model
- if ((child.getNodeType() == Node.TEXT_NODE)
- && ((child.getNodeValue() == null) || (child.getNodeValue().trim()
- .length() == 0)))
- continue;
-
- result = containsNodeWithValue(child, searchText);
- }
- }
-
- return result;
+ if (nodeValue != null &&
SWTBotWebBrowser.stripTextFromSpecChars(nodeValue).equals(searchText)) {
+ result = true;
+ } else {
+ nsIDOMNodeList children = node.getChildNodes();
+ for (int i = 0; i < children.getLength() && !result; i++) {
+ nsIDOMNode child = children.item(i);
+ // leave out empty text nodes in test dom model
+ if ((child.getNodeType() == Node.TEXT_NODE)
+ && ((child.getNodeValue() == null) ||
+ (child.getNodeValue().trim().length() == 0))) {
+ continue;
+ }
+ result = containsNodeWithValue(child, searchText);
+ }
+ }
+ return result;
}
/**
* Returns Palette Viewer associated to JBoss Tools Palette