Author: vpakan(a)redhat.com
Date: 2011-02-10 08:52:11 -0500 (Thu, 10 Feb 2011)
New Revision: 29102
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/RichFacesTagsTest.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContextMenuHelper.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/FileRenameHelper.java
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/EditingActionsTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VisualEditorContextMenuTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/formattingbar/FormattingBarTest.java
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/wizard/ExternalizeStringsDialogTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ImportUnknownTagsWizardTest.java
Log:
Fixes for JBDS 4.0.0.CR3 and Test Tuning
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 2011-02-10
07:45:08 UTC (rev 29101)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java 2011-02-10
13:52:11 UTC (rev 29102)
@@ -82,6 +82,7 @@
bot.menu("Edit").menu("Delete").click(); //$NON-NLS-1$
//$NON-NLS-2$
editor.setText(editorText);
editor.save();
+ delay();
}
super.tearDown();
}
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContextMenuHelper.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContextMenuHelper.java 2011-02-10
07:45:08 UTC (rev 29101)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContextMenuHelper.java 2011-02-10
13:52:11 UTC (rev 29102)
@@ -149,6 +149,11 @@
private static void hide(final Menu menu , boolean hideRecursively) {
if (menu != null){
menu.notifyListeners(SWT.Hide, new Event());
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
if (menu.getParentMenu() != null && hideRecursively) {
hide(menu.getParentMenu(),hideRecursively);
}
@@ -538,6 +543,11 @@
menu.setVisible(false);
}
});
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
/**
@@ -552,6 +562,11 @@
menu.setVisible(false);
}
});
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
/**
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/FileRenameHelper.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/FileRenameHelper.java 2011-02-10
07:45:08 UTC (rev 29101)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/FileRenameHelper.java 2011-02-10
13:52:11 UTC (rev 29102)
@@ -95,7 +95,7 @@
return "Renamed File " + newFileName + " was not found.";
}
// Editor Title was renamed
- bot.sleep(Timing.time2S());
+ bot.sleep(Timing.time5S());
try{
bot.editorByTitle(newFileName);
}catch (WidgetNotFoundException wnfe) {
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 2011-02-10
07:45:08 UTC (rev 29101)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2011-02-10
13:52:11 UTC (rev 29102)
@@ -35,6 +35,7 @@
import org.jboss.tools.vpe.ui.bot.test.editor.selectionbar.SelectionBarTest;
import org.jboss.tools.vpe.ui.bot.test.editor.tags.CoreHTMLTagsTest;
import org.jboss.tools.vpe.ui.bot.test.editor.tags.JSFTagsTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.tags.RichFacesTagsTest;
import org.jboss.tools.vpe.ui.bot.test.jbide.JBIDE4556Test;
import org.jboss.tools.vpe.ui.bot.test.palette.CancelTagLibDefenitionTest;
import org.jboss.tools.vpe.ui.bot.test.palette.ImportTagsFromTLDFileTest;
@@ -54,7 +55,10 @@
public class VPEAllBotTests extends SWTBotTestCase{
public static Test suite(){
TestSuite suite = new TestSuite("VPE All Tests"); //$NON-NLS-1$
- suite.addTestSuite(NewXHTMLPageWizardTest.class);
+ suite.addTestSuite(VisualEditorContextMenuTest.class);
+ suite.addTestSuite(EditingActionsTest.class);
+ suite.addTestSuite(NewXHTMLPageWizardTest.class);
+ suite.addTestSuite(ExternalizeStringsDialogTest.class);
suite.addTestSuite(CancelTagLibDefenitionTest.class);
suite.addTestSuite(ImportTagsFromTLDFileTest.class);
suite.addTestSuite(ToggleCommentTest.class);
@@ -76,15 +80,11 @@
suite.addTestSuite(RenameXHTMLFileTest.class);
suite.addTestSuite(ImportUnknownTagsWizardTest.class);
suite.addTestSuite(VPESourceCodeTemplatesPreferencePageTest.class);
- suite.addTestSuite(ExternalizeStringsDialogTest.class);
suite.addTestSuite(JspFileEditingTest.class);
- suite.addTestSuite(XhtmlFilePerformanceTest.class);
suite.addTestSuite(ManagePaletteGroupsTest.class);
suite.addTestSuite(PaletteEditorTest.class);
suite.addTestSuite(ToolbarTextFormattingTest.class);
- suite.addTestSuite(VisualEditorContextMenuTest.class);
suite.addTestSuite(InsertActionsTest.class);
- suite.addTestSuite(EditingActionsTest.class);
suite.addTestSuite(TextEditingActionsTest.class);
suite.addTestSuite(PromptForTagAttributesDuringTagInsertTest.class);
suite.addTestSuite(IncludedTagLibsTest.class);
@@ -100,6 +100,8 @@
suite.addTestSuite(TextSelectionTest.class);
suite.addTestSuite(CoreHTMLTagsTest.class);
suite.addTestSuite(JSFTagsTest.class);
+ suite.addTestSuite(RichFacesTagsTest.class);
+ suite.addTestSuite(XhtmlFilePerformanceTest.class);
return new TestSetup(suite);
}
}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/EditingActionsTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/EditingActionsTest.java 2011-02-10
07:45:08 UTC (rev 29101)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/EditingActionsTest.java 2011-02-10
13:52:11 UTC (rev 29102)
@@ -148,10 +148,12 @@
*/
private nsIDOMNode initJspPageBeforeInserting(String pageText , String nodeText) {
+ jspEditor.show();
jspEditor.setText(pageText);
jspEditor.save();
botExt.sleep(Timing.time3S());
nsIDOMNode node = webBrowser.getDomNodeByTagName(nodeText, 0);
+ webBrowser.setFocus();
webBrowser.selectDomNode(node, 0);
botExt.sleep(Timing.time1S());
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VisualEditorContextMenuTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VisualEditorContextMenuTest.java 2011-02-10
07:45:08 UTC (rev 29101)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VisualEditorContextMenuTest.java 2011-02-10
13:52:11 UTC (rev 29102)
@@ -63,12 +63,12 @@
final SWTBotEclipseEditor jspTextEditor =
botExt.editorByTitle(VisualEditorContextMenuTest.TEST_PAGE_NAME)
.toTextEditor();
final SWTBotWebBrowser webBrowser = new
SWTBotWebBrowser(VisualEditorContextMenuTest.TEST_PAGE_NAME,botExt);
+ checkEditMenuFunctionality(webBrowser, jspTextEditor);
+ checkInsertMenuFunctionality(webBrowser, jspTextEditor);
checkContextMenuOfEmptyPage(webBrowser, jspTextEditor);
checkContextMenuOfPlainText(webBrowser, jspTextEditor);
checkContextMenuOfComponent(webBrowser, jspTextEditor);
checkInsertMenuContent(webBrowser);
- checkEditMenuFunctionality(webBrowser, jspTextEditor);
- checkInsertMenuFunctionality(webBrowser, jspTextEditor);
jspTextEditor.close();
}
/**
@@ -165,9 +165,8 @@
* @param expectedMenuLabels
*/
private void checkMenuContent(SWTBotWebBrowser webBrowser , String[]
expectedMenuLabels){
-
webBrowser.setFocus();
- bot.sleep(Timing.time1S());
+ bot.sleep(Timing.time2S());
String[] menuLabels =
ContextMenuHelper.getMenuItemLabels(webBrowser.getTopMenu(webBrowser.getSelectedDomNode(),
SWTBotWebBrowser.INSERT_AROUND_MENU_LABEL));
assertMenuContent(menuLabels , expectedMenuLabels);
@@ -416,15 +415,20 @@
* @param jspTextEditor
*/
private void checkEditMenuFunctionality(SWTBotWebBrowser webBrowser ,
SWTBotEclipseEditor jspTextEditor){
- jspTextEditor.setFocus();
- jspTextEditor.selectRange(6, 9, 0);
+ jspTextEditor.setText(VisualEditorContextMenuTest.PAGE_TEXT);
+ jspTextEditor.save();
+ botExt.sleep(Timing.time2S());
webBrowser.setFocus();
+ botExt.sleep(Timing.time5S());
// Test Cut
nsIDOMNode calendarNode = webBrowser.getDomNodeByTagName("INPUT",0);
+ botExt.sleep(Timing.time2S());
webBrowser.selectDomNode(calendarNode,0);
- botExt.sleep(Timing.time1S());
+ botExt.sleep(Timing.time2S());
webBrowser.clickContextMenu(calendarNode, IDELabel.Menu.CUT);
- botExt.sleep(Timing.time1S());
+ botExt.sleep(Timing.time2S());
+ jspTextEditor.save();
+ botExt.sleep(Timing.time2S());
String sourceEditorText = jspTextEditor.getText();
assertTrue ("Source Editor should not contain text
'<rich:calendar></rich:calendar>'\nSource Editor Text: " +
sourceEditorText,
@@ -433,8 +437,11 @@
webBrowser.setFocus();
nsIDOMNode inputTextNode = webBrowser.getDomNodeByTagName("INPUT",0);
webBrowser.selectDomNode(inputTextNode,0);
+ botExt.sleep(Timing.time2S());
webBrowser.clickContextMenu(inputTextNode, IDELabel.Menu.PASTE);
- botExt.sleep(Timing.time1S());
+ botExt.sleep(Timing.time2S());
+ jspTextEditor.save();
+ botExt.sleep(Timing.time2S());
sourceEditorText = jspTextEditor.getText();
assertTrue ("Source Editor should contain text
'<rich:calendar></rich:calendar>'\nSource Editor Text: " +
sourceEditorText,
@@ -442,14 +449,16 @@
// Test Copy
calendarNode = webBrowser.getDomNodeByTagName("INPUT",0);
webBrowser.setFocus();
- calendarNode = webBrowser.getDomNodeByTagName("INPUT",0);
webBrowser.selectDomNode(calendarNode,0);
+ botExt.sleep(Timing.time2S());
webBrowser.clickContextMenu(calendarNode, IDELabel.Menu.COPY);
+ botExt.sleep(Timing.time2S());
inputTextNode = webBrowser.getDomNodeByTagName("INPUT",1);
webBrowser.selectDomNode(inputTextNode,0);
- botExt.sleep(Timing.time1S());
+ botExt.sleep(Timing.time2S());
webBrowser.clickContextMenu(inputTextNode, IDELabel.Menu.PASTE);
- botExt.sleep(Timing.time1S());
+ botExt.sleep(Timing.time2S());
+ jspTextEditor.save();
sourceEditorText = jspTextEditor.getText();
assertTrue ("Source Editor should not contain text
'<h:inputText/>'\nSource Editor Text: " +
sourceEditorText,
@@ -458,16 +467,18 @@
jspTextEditor.setFocus();
jspTextEditor.setText(VisualEditorContextMenuTest.PAGE_TEXT);
jspTextEditor.save();
+ bot.sleep(Timing.time2S());
jspTextEditor.selectRange(6, 9, 0);
- bot.sleep(Timing.time1S());
+ bot.sleep(Timing.time2S());
webBrowser.setFocus();
// Test Cut
calendarNode = webBrowser.getDomNodeByTagName("INPUT",0);
webBrowser.selectDomNode(calendarNode,0);
- botExt.sleep(Timing.time1S());
+ botExt.sleep(Timing.time2S());
webBrowser.setFocus();
KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_X,KeyEvent.VK_CONTROL);
- botExt.sleep(Timing.time1S());
+ jspTextEditor.save();
+ botExt.sleep(Timing.time2S());
sourceEditorText = jspTextEditor.getText();
assertTrue ("Source Editor should not contain text
'<rich:calendar></rich:calendar>'\nSource Editor Text: " +
sourceEditorText,
@@ -476,23 +487,29 @@
webBrowser.setFocus();
inputTextNode = webBrowser.getDomNodeByTagName("INPUT",0);
webBrowser.selectDomNode(inputTextNode,0);
+ botExt.sleep(Timing.time2S());
KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_V,KeyEvent.VK_CONTROL);
- botExt.sleep(Timing.time1S());
+ jspTextEditor.save();
+ botExt.sleep(Timing.time2S());
sourceEditorText = jspTextEditor.getText();
assertTrue ("Source Editor should contain text
'<rich:calendar></rich:calendar>'\nSource Editor Text: " +
sourceEditorText,
sourceEditorText.contains("<rich:calendar></rich:calendar>"));
// Test Copy
- calendarNode = webBrowser.getDomNodeByTagName("INPUT",0);
webBrowser.setFocus();
+ botExt.sleep(Timing.time2S());
calendarNode = webBrowser.getDomNodeByTagName("INPUT",0);
+ botExt.sleep(Timing.time2S());
webBrowser.selectDomNode(calendarNode,0);
+ botExt.sleep(Timing.time2S());
KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_C,KeyEvent.VK_CONTROL);
inputTextNode = webBrowser.getDomNodeByTagName("INPUT",1);
+ botExt.sleep(Timing.time2S());
webBrowser.selectDomNode(inputTextNode,0);
- botExt.sleep(Timing.time1S());
+ botExt.sleep(Timing.time2S());
KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_V,KeyEvent.VK_CONTROL);
- botExt.sleep(Timing.time1S());
+ jspTextEditor.save();
+ botExt.sleep(Timing.time2S());
sourceEditorText = jspTextEditor.getText();
assertTrue ("Source Editor should not contain text
'<h:inputText/>'\nSource Editor Text: " +
sourceEditorText,
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/formattingbar/FormattingBarTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/formattingbar/FormattingBarTest.java 2011-02-10
07:45:08 UTC (rev 29101)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/formattingbar/FormattingBarTest.java 2011-02-10
13:52:11 UTC (rev 29102)
@@ -37,124 +37,4 @@
botExt = new SWTBotExt();
}
- public void testEditStyleButton() throws Throwable {
- /*
- * Open test page
- */
- openPage();
- jspEditor = botExt.swtBotEditorExtByTitle(TEST_PAGE);
- /*
- * Set cursor to some html tag
- */
- jspEditor.insertText(7, 6, ""); //$NON-NLS-1$
- bot.sleep(Timing.time2S());
- /*
- * Style formatting should be disabled
- */
- assertFalse("Style formatting should be disabled", bot //$NON-NLS-1$
- .toolbarButtonWithTooltip(VpeUIMessages.EDIT_STYLE_ATTRIBUTE)
- .isEnabled());
- /*
- * Add some html text
- */
- jspEditor.insertText(10, 0, DIV_TEXT);
- /*
- * Put the cursor
- */
- jspEditor.insertText(10, 2, ""); //$NON-NLS-1$
- bot.sleep(Timing.time2S());
- /*
- * Check the button
- */
- assertTrue("Style formatting should be enabled", bot //$NON-NLS-1$
- .toolbarButtonWithTooltip(VpeUIMessages.EDIT_STYLE_ATTRIBUTE)
- .isEnabled());
- /*
- * Open the dialog
- */
- bot.toolbarButtonWithTooltip(VpeUIMessages.EDIT_STYLE_ATTRIBUTE).click();
- bot.shell(JstUIMessages.CSS_STYLE_EDITOR_TITLE).setFocus();
- bot.shell(JstUIMessages.CSS_STYLE_EDITOR_TITLE).activate();
- /*
- * Press OK with no changes
- */
- assertTrue("(OK) button should be enabled.", //$NON-NLS-1$
- bot.button(WidgetVariables.OK_BUTTON).isEnabled());
- bot.button(WidgetVariables.OK_BUTTON).click();
- /*
- * Check base style values
- */
- jspEditor.insertText(10, 4, STYLE_TEXT);
- jspEditor.insertText(10, 2, ""); //$NON-NLS-1$
- bot.sleep(Timing.time2S());
- /*
- * Check the button
- */
- assertTrue("Style formatting should be enabled", bot //$NON-NLS-1$
- .toolbarButtonWithTooltip(VpeUIMessages.EDIT_STYLE_ATTRIBUTE)
- .isEnabled());
- /*
- * Open the dialog
- */
- bot.toolbarButtonWithTooltip(VpeUIMessages.EDIT_STYLE_ATTRIBUTE).click();
- bot.shell(JstUIMessages.CSS_STYLE_EDITOR_TITLE).setFocus();
- bot.shell(JstUIMessages.CSS_STYLE_EDITOR_TITLE).activate();
- /*
- * Press OK with no changes
- */
- assertTrue("(OK) button should be enabled.", //$NON-NLS-1$
- bot.button(WidgetVariables.OK_BUTTON).isEnabled());
- bot.button(WidgetVariables.OK_BUTTON).click();
- /*
- * Check the updated style text
- */
- jspEditor.selectRange(10, 4, 38);
- assertEquals("Style string should be updated", STYLE_TEXT2,
jspEditor.getSelection()); //$NON-NLS-1$
- /*
- * Check the button
- */
- assertTrue("Style formatting should be enabled", bot //$NON-NLS-1$
- .toolbarButtonWithTooltip(VpeUIMessages.EDIT_STYLE_ATTRIBUTE)
- .isEnabled());
- /*
- * Open the dialog
- */
- bot.toolbarButtonWithTooltip(VpeUIMessages.EDIT_STYLE_ATTRIBUTE).click();
- bot.shell(JstUIMessages.CSS_STYLE_EDITOR_TITLE).setFocus();
- bot.shell(JstUIMessages.CSS_STYLE_EDITOR_TITLE).activate();
- bot.comboBoxWithLabel("font-size:").setText("20"); //$NON-NLS-1$
//$NON-NLS-2$
- /*
- * Press OK with no changes
- */
- assertTrue("(OK) button should be enabled.", //$NON-NLS-1$
- bot.button(WidgetVariables.OK_BUTTON).isEnabled());
- bot.button(WidgetVariables.OK_BUTTON).click();
- /*
- * Check the updated style text
- */
- jspEditor.selectRange(10, 4, 37);
- assertEquals("Style string should be updated", STYLE_TEXT3,
jspEditor.getSelection()); //$NON-NLS-1$
- /*
- * Check the button
- */
- assertTrue("Style formatting should be enabled", bot //$NON-NLS-1$
- .toolbarButtonWithTooltip(VpeUIMessages.EDIT_STYLE_ATTRIBUTE)
- .isEnabled());
- /*
- * Open the dialog
- */
- bot.toolbarButtonWithTooltip(VpeUIMessages.EDIT_STYLE_ATTRIBUTE).click();
- bot.shell(JstUIMessages.CSS_STYLE_EDITOR_TITLE).setFocus();
- bot.shell(JstUIMessages.CSS_STYLE_EDITOR_TITLE).activate();
- bot.comboBoxWithLabel("font-size:").setText("8"); //$NON-NLS-1$
//$NON-NLS-2$
- /*
- * Press OK with no changes
- */
- assertTrue("(Cancel) button should be enabled.", //$NON-NLS-1$
- bot.button(WidgetVariables.CANCEL_BUTTON).isEnabled());
- bot.button(WidgetVariables.CANCEL_BUTTON).click();
- jspEditor.selectRange(10, 4, 37);
- assertEquals("Style string should be updated", STYLE_TEXT3,
jspEditor.getSelection()); //$NON-NLS-1$
- }
-
}
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/RichFacesTagsTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/RichFacesTagsTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/RichFacesTagsTest.java 2011-02-10
13:52:11 UTC (rev 29102)
@@ -0,0 +1,170 @@
+/*******************************************************************************
+
+ * Copyright (c) 2007-2011 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.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.Timing;
+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;
+/**
+ * Tests Rich Faces Tags behavior
+ * @author vlado pakan
+ *
+ */
+public class RichFacesTagsTest extends VPEEditorTestCase {
+
+ private static final String TEST_PAGE_NAME = "RichFacesTagsTest.jsp";
+
+ private SWTBotEditorExt jspEditor;
+ private SWTBotWebBrowser webBrowser;
+ private SWTBotExt botExt;
+
+ public RichFacesTagsTest() {
+ super();
+ botExt = new SWTBotExt();
+ }
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ eclipse.maximizeActiveShell();
+ createJspPage(RichFacesTagsTest.TEST_PAGE_NAME);
+ jspEditor = botExt.swtBotEditorExtByTitle(RichFacesTagsTest.TEST_PAGE_NAME);
+ webBrowser = new SWTBotWebBrowser(RichFacesTagsTest.TEST_PAGE_NAME,botExt);
+ }
+
+ @Override
+ protected void closeUnuseDialogs() {
+
+ }
+
+ @Override
+ protected boolean isUnuseDialogOpened() {
+ return false;
+ }
+ @Override
+ protected void tearDown() throws Exception {
+ jspEditor.close();
+ super.tearDown();
+ }
+ /**
+ * Tests rich:comboBox Tag
+ */
+ public void testComboBoxTag(){
+ final String defaultLabel = "DefaultLabel";
+ jspEditor.setText("<%@ taglib
uri=\"http://java.sun.com/jsf/html\"
prefix=\"h\" %>\n" +
+ "<%@ taglib
uri=\"http://java.sun.com/jsf/core\"
prefix=\"f\" %>\n" +
+ "<%@ taglib
uri=\"http://richfaces.org/rich\"
prefix=\"rich\" %>\n" +
+ "<html>\n" +
+ " <head>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <h:form>\n" +
+ " <rich:comboBox id=\"comboBox\"
defaultLabel=\"" + defaultLabel + "\">\n" +
+ " <f:selectItem itemValue=\"item 1\"/>\n" +
+ " <f:selectItem itemValue=\"item 2\"/>\n" +
+ " </rich:comboBox>\n" +
+ " </h:form>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>");
+ jspEditor.save();
+ bot.sleep(Timing.time3S());
+ assertVisualEditorContains(webBrowser,
+ "INPUT",
+ new String[]{"type","class","value"},
+ new String[]{"text","rich-combobox-font-disabled
rich-combobox-input-inactive",defaultLabel},
+ RichFacesTagsTest.TEST_PAGE_NAME);
+ assertVisualEditorContains(webBrowser,
+ "INPUT",
+ new String[]{"type","class"},
+ new String[]{"text","rich-combobox-font-inactive
rich-combobox-button-background rich-combobox-button-inactive"},
+ RichFacesTagsTest.TEST_PAGE_NAME);
+ assertVisualEditorContains(webBrowser,
+ "INPUT",
+ new String[]{"type","class"},
+ new String[]{"text","rich-combobox-font-inactive
rich-combobox-button-icon-inactive rich-combobox-button-inactive"},
+ RichFacesTagsTest.TEST_PAGE_NAME);
+ assertVisualEditorContains(webBrowser,
+ "DIV",
+ new String[]{"class"},
+ new String[]{"rich-combobox-strut rich-combobox-font"},
+ RichFacesTagsTest.TEST_PAGE_NAME);
+ // check tag selection
+ webBrowser.selectDomNode(webBrowser.getDomNodeByTagName("INPUT"), 0);
+ bot.sleep(Timing.time3S());
+ String selectedText = jspEditor.getSelection();
+ final String hasToStartWith = "<rich:comboBox";
+ assertTrue("Selected text in Source Pane has to start with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().startsWith(hasToStartWith));
+ final String hasToEndWith = "</rich:comboBox>";
+ assertTrue("Selected text in Source Pane has to end with '" +
hasToEndWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().endsWith(hasToEndWith));
+
+ }
+ /**
+ * Tests rich:comboBox Tag
+ */
+ public void testInplaceInputTag(){
+ final String defaultLabel = "DefaultLabel";
+ jspEditor.setText("<%@ taglib
uri=\"http://java.sun.com/jsf/html\"
prefix=\"h\" %>\n" +
+ "<%@ taglib
uri=\"http://java.sun.com/jsf/core\"
prefix=\"f\" %>\n" +
+ "<%@ taglib
uri=\"http://richfaces.org/rich\"
prefix=\"rich\" %>\n" +
+ "<html>\n" +
+ " <head>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <rich:inplaceInput defaultLabel=\"" + defaultLabel+
"\"/>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>");
+ jspEditor.save();
+ bot.sleep(Timing.time3S());
+ assertVisualEditorContains(webBrowser,
+ "SPAN",
+ new String[]{"vpe-user-toggle-id","title","class"},
+ new String[]{"false","rich:inplaceInput defaultLabel:
DefaultLabel","rich-inplace rich-inplace-view"},
+ RichFacesTagsTest.TEST_PAGE_NAME);
+ assertVisualEditorContainsNodeWithValue(webBrowser,
+ defaultLabel,
+ RichFacesTagsTest.TEST_PAGE_NAME);
+ // check tag selection
+ webBrowser.selectDomNode(webBrowser.getDomNodeByTagName("SPAN",2), 0);
+ bot.sleep(Timing.time3S());
+ String selectedText = jspEditor.getSelection();
+ final String expectedSelectedText = "<rich:inplaceInput
defaultLabel=\"" + defaultLabel+ "\"/>";
+ assertTrue("Selected text in Source Pane has to be '" +
expectedSelectedText + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().equals(expectedSelectedText));
+ webBrowser.mouseClickOnNode(webBrowser.getDomNodeByTagName("SPAN",2));
+ bot.sleep(Timing.time3S());
+ selectedText = jspEditor.getSelection();
+ assertVisualEditorContains(webBrowser,
+ "SPAN",
+ new String[]{"vpe-user-toggle-id","class"},
+ new String[]{"true","rich-inplace rich-inplace-edit"},
+ RichFacesTagsTest.TEST_PAGE_NAME);
+ assertVisualEditorContains(webBrowser,
+ "INPUT",
+ new String[]{"type","class","value"},
+ new String[]{"text","rich-inplace-field",defaultLabel},
+ RichFacesTagsTest.TEST_PAGE_NAME);
+ 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/RichFacesTagsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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 2011-02-10
07:45:08 UTC (rev 29101)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java 2011-02-10
13:52:11 UTC (rev 29102)
@@ -55,9 +55,11 @@
import org.jboss.tools.vpe.editor.mozilla.MozillaEventAdapter;
import org.jboss.tools.vpe.ui.palette.PaletteAdapter;
import org.jboss.tools.vpe.xulrunner.util.XPCOM;
+import org.mozilla.interfaces.nsIDOMAbstractView;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMEvent;
import org.mozilla.interfaces.nsIDOMEventTarget;
+import org.mozilla.interfaces.nsIDOMMouseEvent;
import org.mozilla.interfaces.nsIDOMNamedNodeMap;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
@@ -100,6 +102,9 @@
public static final String H_FORM_TAG_MENU_LABEL = "<h:form>";
public static final String RICH_CALENDAR_TAG_MENU_LABEL =
"<rich:calendar>";
+ private static final String MOUSE_CLICK_EVENT_TYPE="click"; //$NON-NLS-1$^M
+ private static final String CONTEXT_MENU_EVENT_TYPE="contextmenu";
//$NON-NLS-1$^M
+
private Display display;
private IVisualEditor visualEditor;
private MozillaEditor mozillaEditor;
@@ -611,7 +616,7 @@
public void initEvent(String arg0, boolean arg1, boolean arg2) {
}
public String getType() {
- return "contextmenu";
+ return SWTBotWebBrowser.CONTEXT_MENU_EVENT_TYPE;
}
public double getTimeStamp() {
return 0;
@@ -639,6 +644,7 @@
getMozillaEventAdapter().handleEvent(domEvent);
}
});
+ bot.sleep(Timing.time2S());
// Get Top Menu
return UIThreadRunnable.syncExec(new WidgetResult<Menu>() {
public Menu run() {
@@ -791,4 +797,122 @@
protected static String stripTextFromSpecChars(String inputText){
return inputText.replaceAll("\n", " ").replaceAll("\t",
"").trim();
}
+
+ public void mouseClickOnNode(final nsIDOMNode node){
+ // Create DOM Event
+ final nsIDOMMouseEvent domMouseEvent = new DomMouseEvent(node);
+ // Simulate Context Menu Event
+ display.syncExec(new Runnable() {
+ public void run() {
+ getMozillaEventAdapter().handleEvent(domMouseEvent);
+ }
+ });
+ }
+
+ private class DomMouseEvent implements nsIDOMMouseEvent {
+ private nsIDOMNode node = null;
+ public DomMouseEvent (nsIDOMNode node){
+ this.node = node;
+ }
+ @Override
+ public int getDetail() {
+ return 0;
+ }
+ @Override
+ public nsIDOMAbstractView getView() {
+ return null;
+ }
+ @Override
+ public void initUIEvent(String arg0, boolean arg1, boolean arg2,
+ nsIDOMAbstractView arg3, int arg4) {
+ }
+ @Override
+ public boolean getBubbles() {
+ return false;
+ }
+ @Override
+ public boolean getCancelable() {
+ return false;
+ }
+ @Override
+ public nsIDOMEventTarget getCurrentTarget() {
+ return node != null ? XPCOM.queryInterface(node,nsIDOMEventTarget.class) : null;
+ }
+ @Override
+ public int getEventPhase() {
+ return 0;
+ }
+ @Override
+ public nsIDOMEventTarget getTarget() {
+ return node != null ? XPCOM.queryInterface(node,nsIDOMEventTarget.class) : null;
+ }
+ @Override
+ public double getTimeStamp() {
+ return 0;
+ }
+ @Override
+ public String getType() {
+ return SWTBotWebBrowser.MOUSE_CLICK_EVENT_TYPE;
+ }
+ @Override
+ public void initEvent(String arg0, boolean arg1, boolean arg2) {
+ }
+ @Override
+ public void preventDefault() {
+ }
+ @Override
+ public void stopPropagation() {
+ }
+ @Override
+ public nsIDOMMouseEvent queryInterface(String arg0) {
+ return this;
+ }
+ @Override
+ public boolean getAltKey() {
+ return false;
+ }
+ @Override
+ public int getButton() {
+ return 0;
+ }
+ @Override
+ public int getClientX() {
+ return 0;
+ }
+ @Override
+ public int getClientY() {
+ return 0;
+ }
+ @Override
+ public boolean getCtrlKey() {
+ return false;
+ }
+ @Override
+ public boolean getMetaKey() {
+ return false;
+ }
+ @Override
+ public nsIDOMEventTarget getRelatedTarget() {
+ return null;
+ }
+ @Override
+ public int getScreenX() {
+ return 0;
+ }
+ @Override
+ public int getScreenY() {
+ return 0;
+ }
+ @Override
+ public boolean getShiftKey() {
+ return false;
+ }
+ @Override
+ public void initMouseEvent(String arg0, boolean arg1, boolean arg2,
+ nsIDOMAbstractView arg3, int arg4, int arg5, int arg6, int arg7,
+ int arg8, boolean arg9, boolean arg10, boolean arg11, boolean arg12,
+ int arg13, nsIDOMEventTarget arg14) {
+ }
+ }
+
}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java 2011-02-10
07:45:08 UTC (rev 29101)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java 2011-02-10
13:52:11 UTC (rev 29102)
@@ -910,10 +910,12 @@
* Select some text
*/
editor.navigateTo(pos);
+ bot.sleep(Timing.time1S());
/*
* Send key press event to fire VPE listeners
*/
KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_LEFT);
+ bot.sleep(Timing.time1S());
/*
* Get toolbar button
*/
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ImportUnknownTagsWizardTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ImportUnknownTagsWizardTest.java 2011-02-10
07:45:08 UTC (rev 29101)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ImportUnknownTagsWizardTest.java 2011-02-10
13:52:11 UTC (rev 29102)
@@ -52,10 +52,21 @@
/*
* Check table values
*/
- String taglib = bot.table().cell(0, 0);
- assertEquals("Wrong table value.", "lib:tag", taglib);
//$NON-NLS-1$ //$NON-NLS-2$
- taglib = bot.table().cell(1, 0);
- assertEquals("Wrong table value.", "taglibName:tagName",
taglib); //$NON-NLS-1$ //$NON-NLS-2$
+ String firstLine = bot.table().cell(0, 0);
+ String libTagline = null;
+ String tagLibNameLine = null;
+ if (firstLine.startsWith("lib")){
+ libTagline = firstLine;
+ tagLibNameLine = bot.table().cell(1, 0);
+ }
+ else{
+ libTagline = bot.table().cell(1, 0);
+ tagLibNameLine = firstLine;
+ }
+
+ assertEquals("Wrong table value.", "lib:tag", libTagline);
//$NON-NLS-1$ //$NON-NLS-2$
+
+ assertEquals("Wrong table value.", "taglibName:tagName",
tagLibNameLine); //$NON-NLS-1$ //$NON-NLS-2$
/*
* Check that finish button is enabled and press it.
*/
@@ -76,11 +87,18 @@
/*
* Check table values on the preferences page
*/
- String taglib00 = bot.table().cell(0, 0);
- String taglib10 = bot.table().cell(1, 0);
+ firstLine = bot.table().cell(0, 0);
+ if (firstLine.startsWith("lib")){
+ libTagline = firstLine;
+ tagLibNameLine = bot.table().cell(1, 0);
+ }
+ else{
+ libTagline = bot.table().cell(1, 0);
+ tagLibNameLine = firstLine;
+ }
bot.button(WidgetVariables.OK_BUTTON).click();
- assertEquals("Wrong table value.", "taglibName:tagName",
taglib10); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong table value.", "lib:tag", taglib00);
//$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Wrong table value.", "taglibName:tagName",
tagLibNameLine); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Wrong table value.", "lib:tag", libTagline);
//$NON-NLS-1$ //$NON-NLS-2$
}