Author: vpakan(a)redhat.com
Date: 2010-12-22 04:10:46 -0500 (Wed, 22 Dec 2010)
New Revision: 27654
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/TextEditingActionsTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java
Log:
Added test for editing page via Visual Editor
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/TextEditingActionsTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/TextEditingActionsTest.java 2010-12-22
02:29:50 UTC (rev 27653)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/TextEditingActionsTest.java 2010-12-22
09:10:46 UTC (rev 27654)
@@ -26,7 +26,7 @@
import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
import org.mozilla.interfaces.nsIDOMNode;
/**
- * Tests JSP file Cut, Copy, Paste actions through Visual Editor Menu for Text selection
+ * Tests JSP file Editing and Cut, Copy, Paste actions through Visual Editor Menu for
Text selection
* @author vlado pakan
*
*/
@@ -70,7 +70,7 @@
/**
* Tests Cut Copy Paste Operations on Blank Page
*/
- public void testCutCopyPasteBlankPage(){
+ public void ttestCutCopyPasteBlankPage(){
jspEditor.setText("");
jspEditor.save();
@@ -134,7 +134,7 @@
/**
* Tests insert Enter in Visual Editor
*/
- public void testInsertEnter(){
+ public void ttestInsertEnter(){
jspEditor.setText(TextEditingActionsTest.PAGE_TEXT);
jspEditor.save();
@@ -146,15 +146,64 @@
Position cursorPosition = jspEditor.cursorPosition();
jspEditor.deselectAndSetCursorPosition(cursorPosition.line, cursorPosition.column);
webBrowser.setFocus();
+ KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_RIGHT);
KeyboardHelper.typeKeyCodeUsingAWTRepeately(KeyEvent.VK_ENTER, 6);
jspEditor.save();
bot.sleep(Timing.time3S());
String jspEditorText = jspEditor.getText();
assertTrue ("Source Editor should has text " +
TextEditingActionsTest.PAGE_TEXT +
"\nbut it is\n" + jspEditorText,
- jspEditorText.equals(TextEditingActionsTest.PAGE_TEXT)); }
+ jspEditorText.equals(TextEditingActionsTest.PAGE_TEXT));
+ }
-
+ /**
+ * Tests page editing via keyboard Enter in Visual Editor
+ */
+ public void testKeyboardEditing(){
+
+ jspEditor.setText(TextEditingActionsTest.PAGE_TEXT);
+ jspEditor.save();
+ bot.sleep(Timing.time3S());
+ nsIDOMNode node = webBrowser.getDomNodeByTagName("SPAN", 0);
+ webBrowser.selectDomNode(node, 0);
+ bot.sleep(Timing.time1S());
+ // Check inserting Enter Functionality
+ Position cursorPosition = jspEditor.cursorPosition();
+ jspEditor.deselectAndSetCursorPosition(cursorPosition.line, cursorPosition.column);
+ webBrowser.setFocus();
+ KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_RIGHT);
+ KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_LEFT);
+ String testText = "insertedTextDeleteBackspace";
+ KeyboardHelper.typeBasicStringUsingAWT(testText);
+ jspEditor.save();
+ bot.sleep(Timing.time3S());
+ String sourceEditorText = jspEditor.getText();
+ String textToContain = "<h:outputText value=\"" + testText;
+ assertTrue ("Source Editor has to containt text " + textToContain +
+ "\nbut it doesn't.\nSource Editor text is:\n" + sourceEditorText,
+ sourceEditorText.contains(textToContain));
+ // Test Backspace
+ int lengthToRemove = 9;
+ KeyboardHelper.typeKeyCodeUsingAWTRepeately(KeyEvent.VK_BACK_SPACE, lengthToRemove);
+ jspEditor.save();
+ bot.sleep(Timing.time3S());
+ textToContain = textToContain.substring(0, textToContain.length() - lengthToRemove);
+ assertTrue ("Source Editor has to containt text " + textToContain +
+ "\nbut it doesn't.\nSource Editor text is:\n" + sourceEditorText,
+ sourceEditorText.contains(textToContain));
+ // Test Delete
+ lengthToRemove = 6;
+ KeyboardHelper.typeKeyCodeUsingAWTRepeately(KeyEvent.VK_LEFT, lengthToRemove);
+ KeyboardHelper.typeKeyCodeUsingAWTRepeately(KeyEvent.VK_DELETE, lengthToRemove);
+ jspEditor.save();
+ bot.sleep(Timing.time3S());
+ textToContain = textToContain.substring(0, textToContain.length() - lengthToRemove);
+ assertTrue ("Source Editor has to containt text " + textToContain +
+ "\nbut it doesn't.\nSource Editor text is:\n" + sourceEditorText,
+ sourceEditorText.contains(textToContain));
+
+ }
+
@Override
protected void closeUnuseDialogs() {
@@ -172,7 +221,7 @@
/**
* Tests Cut Copy Paste Operations on Value Attribute
*/
- public void testCutCopyPasteValueAttribute(){
+ public void ttestCutCopyPasteValueAttribute(){
jspEditor.setText(TextEditingActionsTest.PAGE_TEXT);
jspEditor.save();
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java 2010-12-22
02:29:50 UTC (rev 27653)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java 2010-12-22
09:10:46 UTC (rev 27654)
@@ -76,7 +76,7 @@
bot.menu("Edit").menu("Delete").click(); //$NON-NLS-1$
//$NON-NLS-2$
editor.setText(editorText);
editor.save();
- bot.sleep(Timing.time3S());
+ bot.sleep(Timing.time5S());
}
super.tearDown();
}
Show replies by date