Author: yzhishko
Date: 2009-07-29 06:49:14 -0400 (Wed, 29 Jul 2009)
New Revision: 16856
Added:
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/BlockCommentTestLinesToggle.xml
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/BlockCommentTestToggle.xml
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/CommentTestUntoggle.xml
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BlockCommentTest.java
Removed:
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/ToggleCommentTestLinesToggle.xml
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/ToggleCommentTestLinesUntoggle.xml
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/ToggleCommentTestUntoggle.xml
Modified:
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ToggleCommentTest.java
Log:
Tests for comments in VPE were updated. For some reasons SWTBot doesn't support key
event under windows correctly.
Added:
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/BlockCommentTestLinesToggle.xml
===================================================================
---
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/BlockCommentTestLinesToggle.xml
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/BlockCommentTestLinesToggle.xml 2009-07-29
10:49:14 UTC (rev 16856)
@@ -0,0 +1,34 @@
+<tests>
+ <test id="bodyId">
+ <DIV ID="bodyId">
+<TABLE STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px; width:
100%;">
+<TR>
+<TD>
+<DIV>
+<H1 STYLE="-moz-user-modify: read-write;">
+<SPAN CLASS="vpe-text">
+Hello Demo Application
+</SPAN>
+</H1>
+<UL STYLE="color: red; -moz-user-modify: read-only;">
+<LI>
+Error Messages
+</LI>
+</UL>
+<FORM STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px;">
+<SPAN CLASS="vpe-text">
+Name:
+</SPAN>
+<!--<h:inputText value="#{user.name}" required="true">
+ <f:validateLength maximum="30" minimum="3"/>
+ </h:inputText>-->
+<INPUT TYPE="button" VALUE="Say Hello!"
STYLE="-moz-user-modify: read-only;"/>
+
+</FORM>
+</DIV>
+</TD>
+</TR>
+</TABLE>
+</DIV>
+ </test>
+</tests>
\ No newline at end of file
Added:
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/BlockCommentTestToggle.xml
===================================================================
---
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/BlockCommentTestToggle.xml
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/BlockCommentTestToggle.xml 2009-07-29
10:49:14 UTC (rev 16856)
@@ -0,0 +1,36 @@
+<tests>
+ <test id="bodyId">
+ <DIV ID="bodyId">
+<TABLE STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px; width:
100%;">
+<TR>
+<TD>
+<DIV>
+<H1 STYLE="-moz-user-modify: read-write;">
+<SPAN CLASS="vpe-text">
+Hello Demo Application
+</SPAN>
+</H1>
+<UL STYLE="color: red; -moz-user-modify: read-only;">
+<LI>
+Error Messages
+</LI>
+</UL>
+<FORM STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px;">
+<SPAN CLASS="vpe-text">
+Name:
+</SPAN>
+<SPAN CLASS="vpe-text">
+<SPAN CLASS="vpe-text">
+</SPAN>
+<INPUT VALUE="#{user.name}"/>
+
+</SPAN>
+<!--<h:commandButton action="hello" value="Say Hello!"
/>-->
+</FORM>
+</DIV>
+</TD>
+</TR>
+</TABLE>
+</DIV>
+ </test>
+</tests>
\ No newline at end of file
Copied:
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/CommentTestUntoggle.xml (from
rev 16840,
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/ToggleCommentTestLinesUntoggle.xml)
===================================================================
--- workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/CommentTestUntoggle.xml
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/CommentTestUntoggle.xml 2009-07-29
10:49:14 UTC (rev 16856)
@@ -0,0 +1,37 @@
+<tests>
+ <test id="bodyId">
+ <DIV ID="bodyId">
+<TABLE STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px; width:
100%;">
+<TR>
+<TD>
+<DIV>
+<H1 STYLE="-moz-user-modify: read-write;">
+<SPAN CLASS="vpe-text">
+Hello Demo Application
+</SPAN>
+</H1>
+<UL STYLE="color: red; -moz-user-modify: read-only;">
+<LI>
+Error Messages
+</LI>
+</UL>
+<FORM STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px;">
+<SPAN CLASS="vpe-text">
+Name:
+</SPAN>
+<SPAN CLASS="vpe-text">
+<SPAN CLASS="vpe-text">
+</SPAN>
+<INPUT VALUE="#{user.name}"/>
+
+</SPAN>
+<INPUT TYPE="button" VALUE="Say Hello!"
STYLE="-moz-user-modify: read-only;"/>
+
+</FORM>
+</DIV>
+</TD>
+</TR>
+</TABLE>
+</DIV>
+ </test>
+</tests>
\ No newline at end of file
Deleted:
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/ToggleCommentTestLinesToggle.xml
===================================================================
---
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/ToggleCommentTestLinesToggle.xml 2009-07-29
10:48:20 UTC (rev 16855)
+++
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/ToggleCommentTestLinesToggle.xml 2009-07-29
10:49:14 UTC (rev 16856)
@@ -1,34 +0,0 @@
-<tests>
- <test id="bodyId">
- <DIV id="bodyId">
-<TABLE STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px; width:
100%;">
-<TR>
-<TD>
-<DIV>
-<H1 STYLE="-moz-user-modify: read-write;">
-<SPAN CLASS="vpe-text">
-Hello Demo Application
-</SPAN>
-</H1>
-<UL STYLE="color: red; -moz-user-modify: read-only;">
-<LI>
-Error Messages
-</LI>
-</UL>
-<FORM STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px;">
-<SPAN CLASS="vpe-text">
-Name:
-</SPAN>
-<!-- <h:inputText value="#{user.name}"
required="true">-->
-<!-- <f:validateLength maximum="30"
minimum="3"/>-->
-<!-- </h:inputText>-->
-<INPUT TYPE="button" VALUE="Say Hello!"
STYLE="-moz-user-modify: read-only;"/>
-
-</FORM>
-</DIV>
-</TD>
-</TR>
-</TABLE>
-</DIV>
- </test>
-</tests>
\ No newline at end of file
Deleted:
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/ToggleCommentTestLinesUntoggle.xml
===================================================================
---
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/ToggleCommentTestLinesUntoggle.xml 2009-07-29
10:48:20 UTC (rev 16855)
+++
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/ToggleCommentTestLinesUntoggle.xml 2009-07-29
10:49:14 UTC (rev 16856)
@@ -1,37 +0,0 @@
-<tests>
- <test id="bodyId">
- <DIV ID="bodyId">
-<TABLE STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px; width:
100%;">
-<TR>
-<TD>
-<DIV>
-<H1 STYLE="-moz-user-modify: read-write;">
-<SPAN CLASS="vpe-text">
-Hello Demo Application
-</SPAN>
-</H1>
-<UL STYLE="color: red; -moz-user-modify: read-only;">
-<LI>
-Error Messages
-</LI>
-</UL>
-<FORM STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px;">
-<SPAN CLASS="vpe-text">
-Name:
-</SPAN>
-<SPAN CLASS="vpe-text">
-<SPAN CLASS="vpe-text">
-</SPAN>
-<INPUT VALUE="#{user.name}"/>
-
-</SPAN>
-<INPUT TYPE="button" VALUE="Say Hello!"
STYLE="-moz-user-modify: read-only;"/>
-
-</FORM>
-</DIV>
-</TD>
-</TR>
-</TABLE>
-</DIV>
- </test>
-</tests>
\ No newline at end of file
Deleted:
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/ToggleCommentTestUntoggle.xml
===================================================================
---
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/ToggleCommentTestUntoggle.xml 2009-07-29
10:48:20 UTC (rev 16855)
+++
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/resources/ToggleCommentTestUntoggle.xml 2009-07-29
10:49:14 UTC (rev 16856)
@@ -1,37 +0,0 @@
-<tests>
- <test id="bodyId">
- <DIV ID="bodyId">
-<TABLE STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px; width:
100%;">
-<TR>
-<TD>
-<DIV>
-<H1 STYLE="-moz-user-modify: read-write;">
-<SPAN CLASS="vpe-text">
-Hello Demo Application
-</SPAN>
-</H1>
-<UL STYLE="color: red; -moz-user-modify: read-only;">
-<LI>
-Error Messages
-</LI>
-</UL>
-<FORM STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px;">
-<SPAN CLASS="vpe-text">
-Name:
-</SPAN>
-<SPAN CLASS="vpe-text">
-<SPAN CLASS="vpe-text">
-</SPAN>
-<INPUT VALUE="#{user.name}"/>
-
-</SPAN>
-<INPUT TYPE="button" VALUE="Say Hello!"
STYLE="-moz-user-modify: read-only;"/>
-
-</FORM>
-</DIV>
-</TD>
-</TR>
-</TABLE>
-</DIV>
- </test>
-</tests>
\ No newline at end of file
Added:
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BlockCommentTest.java
===================================================================
---
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BlockCommentTest.java
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BlockCommentTest.java 2009-07-29
10:49:14 UTC (rev 16856)
@@ -0,0 +1,193 @@
+package org.jboss.tools.vpe.ui.bot.test.editor;
+
+import java.util.List;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+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;
+
+public class BlockCommentTest extends VPEAutoTestCase{
+
+ private static String textEditor;
+ private static SWTBotEclipseEditor editor;
+
+ public void testBlockComment() throws Throwable{
+
+ //Test open page
+
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
+ SWTBotTree tree = innerBot.tree();
+ try {
+ List<? extends SWTBotEditor> editors = bot.editors();
+ for (int i = 0; i < editors.size(); i++) {
+ editors.get(i).close();
+ }
+
+ } catch (Exception e) {
+ }
+ try {
+ tree.expandNode(projectProperties.getProperty("JSFProjectName"))
+ .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
+ } catch (Exception e) {
+ }
+
+ editor = bot.editorByTitle(TEST_PAGE).toTextEditor();
+ textEditor = editor.getText();
+
+ //Test add block comment from Source menu
+
+ editor.navigateTo(22,22);
+ bot.menu("Source").menu("Add Block Comment").click();
+ waitForJobs();
+ checkVPE("BlockCommentTestToggle.xml");
+
+ //Test add block comment with CTRL+SHIFT+/ hot keys
+
+ editor.navigateTo(22,22);
+ pressBlockCommentHotKeys();
+ waitForJobs();
+ checkVPE("BlockCommentTestToggle.xml");
+
+ //Test remove block comment with CTRL+SHIFT+\ hot keys
+
+ editor.navigateTo(22,22);
+ pressUnBlockCommentHotKeys();
+ waitForJobs();
+ checkVPE("CommentTestUntoggle.xml");
+
+ //Test add block comment lines from Source menu
+
+ editor.navigateTo(18,22);
+ bot.menu("Source").menu("Add Block Comment").click();
+ waitForJobs();
+ checkVPE("BlockCommentTestLinesToggle.xml");
+
+ //Test remove block comment lines from Source menu
+
+ editor.navigateTo(18,22);
+ bot.menu("Source").menu("Remove Block Comment").click();
+ waitForJobs();
+ checkVPE("CommentTestUntoggle.xml");
+
+ //Test add block comment lines with CTRL+SHIFT+/ hot keys
+
+ editor.navigateTo(18,22);
+ bot.menu("Source").menu("Add Block Comment").click();
+ waitForJobs();
+ checkVPE("BlockCommentTestLinesToggle.xml");
+
+ //Test remove block comment lines with CTRL+SHIFT+/ hot keys
+
+ editor.navigateTo(18,22);
+ bot.menu("Source").menu("Remove Block Comment").click();
+ waitForJobs();
+ checkVPE("CommentTestUntoggle.xml");
+
+ }
+
+
+ @Override
+ protected void closeUnuseDialogs() {
+ }
+
+ @Override
+ protected boolean isUnuseDialogOpened() {
+ return false;
+ }
+
+ private void checkVPE(String testPage) throws Throwable{
+ editor.selectLine(9);
+ if (!"<body
id=\"bodyId\">".equals(editor.getTextOnCurrentLine().trim())) {
+ editor.insertText("<body id=\"bodyId\">");
+ }
+ editor.save();
+ waitForJobs();
+ performContentTest(testPage, bot.multiPageEditorByTitle(TEST_PAGE));
+ }
+
+ private void pressBlockCommentHotKeys(){
+ bot.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ Display display = bot.getDisplay();
+ Event event = new Event();
+ event.type = SWT.KeyDown;
+ event.keyCode = SWT.CTRL;
+ display.post(event);
+ event = new Event();
+ event.type = SWT.KeyDown;
+ event.keyCode = SWT.SHIFT;
+ display.post(event);
+ event = new Event();
+ event.type = SWT.KeyDown;
+ event.character = '/';
+ display.post(event);
+ event = new Event();
+ event.type = SWT.KeyUp;
+ event.character = '/';
+ display.post(event);
+ event = new Event();
+ event.type = SWT.KeyUp;
+ event.keyCode = SWT.SHIFT;
+ display.post(event);
+ event = new Event();
+ event.type = SWT.KeyUp;
+ event.keyCode = SWT.CTRL;
+ display.post(event);
+ }
+ });
+ }
+
+ private void pressUnBlockCommentHotKeys(){
+ bot.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ Display display = bot.getDisplay();
+ Event event = new Event();
+ event.type = SWT.KeyDown;
+ event.keyCode = SWT.CTRL;
+ display.post(event);
+ event = new Event();
+ event.type = SWT.KeyDown;
+ event.keyCode = SWT.SHIFT;
+ display.post(event);
+ event = new Event();
+ event.type = SWT.KeyDown;
+ event.character = '\\';
+ display.post(event);
+ event = new Event();
+ event.type = SWT.KeyUp;
+ event.character = '\\';
+ display.post(event);
+ event = new Event();
+ event.type = SWT.KeyUp;
+ event.keyCode = SWT.SHIFT;
+ display.post(event);
+ event = new Event();
+ event.type = SWT.KeyUp;
+ event.keyCode = SWT.CTRL;
+ display.post(event);
+ }
+ });
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+
+ //Restore page state before tests
+
+ editor.setFocus();
+ bot.menu("Edit").menu("Select All").click();
+ bot.menu("Edit").menu("Delete").click();
+ editor.setText(textEditor);
+ editor.save();
+ waitForJobs();
+ editor.close();
+ super.tearDown();
+ }
+
+
+}
Modified:
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ToggleCommentTest.java
===================================================================
---
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ToggleCommentTest.java 2009-07-29
10:48:20 UTC (rev 16855)
+++
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ToggleCommentTest.java 2009-07-29
10:49:14 UTC (rev 16856)
@@ -1,15 +1,12 @@
package org.jboss.tools.vpe.ui.bot.test.editor;
import java.util.List;
-
-import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
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;
@@ -39,10 +36,12 @@
} catch (Exception e) {
}
- //Test toggle comment from Source menu
editor = bot.editorByTitle(TEST_PAGE).toTextEditor();
textEditor = editor.getText();
+
+ //Test toggle comment from Source menu
+
editor.navigateTo(22,22);
bot.menu("Source").menu("Toggle Comment").click();
waitForJobs();
@@ -55,7 +54,7 @@
bot.menu("Source").menu("Toggle Comment").click();
waitForJobs();
checkSelectionBar("h:commandButton");
- checkVPE("ToggleCommentTestUntoggle.xml");
+ checkVPE("CommentTestUntoggle.xml");
//Test toggle comment with CTRL+SHIFT+C hot keys
@@ -71,51 +70,8 @@
pressToggleCommentHotKeys();
waitForJobs();
checkSelectionBar("h:commandButton");
- checkVPE("ToggleCommentTestUntoggle.xml");
+ checkVPE("CommentTestUntoggle.xml");
- //Test toggle comment with three lines from Source menu
-
- editor.selectLine(18);
- editor.pressShortcut(Keystrokes.SHIFT, KeyStroke.getInstance(SWT.ARROW_DOWN));
- shortDelay();
- editor.pressShortcut(Keystrokes.SHIFT, KeyStroke.getInstance(SWT.ARROW_DOWN));
- bot.menu("Source").menu("Toggle Comment").click();
- editor.navigateTo(19, 22);
- waitForJobs();
- checkSelectionBar("#comment");
- checkVPE("ToggleCommentTestLinesToggle.xml");
-
- //Test untoggle comment with three lines from Source menu
-
- editor.selectLine(18);
- editor.pressShortcut(Keystrokes.SHIFT, KeyStroke.getInstance(SWT.ARROW_DOWN));
- shortDelay();
- editor.pressShortcut(Keystrokes.SHIFT, KeyStroke.getInstance(SWT.ARROW_DOWN));
- bot.menu("Source").menu("Toggle Comment").click();
- waitForJobs();
- checkVPE("ToggleCommentTestLinesUntoggle.xml");
-
- //Test toggle comment with three lines using hot keys
-
- editor.selectLine(18);
- editor.pressShortcut(Keystrokes.SHIFT, KeyStroke.getInstance(SWT.ARROW_DOWN));
- shortDelay();
- editor.pressShortcut(Keystrokes.SHIFT, KeyStroke.getInstance(SWT.ARROW_DOWN));
- pressToggleCommentHotKeys();
- waitForJobs();
- checkSelectionBar("#comment");
- checkVPE("ToggleCommentTestLinesToggle.xml");
-
- //Test untoggle comment with three lines using hot keys
-
- editor.selectLine(18);
- editor.pressShortcut(Keystrokes.SHIFT, KeyStroke.getInstance(SWT.ARROW_DOWN));
- shortDelay();
- editor.pressShortcut(Keystrokes.SHIFT, KeyStroke.getInstance(SWT.ARROW_DOWN));
- pressToggleCommentHotKeys();
- waitForJobs();
- checkVPE("ToggleCommentTestLinesUntoggle.xml");
-
}
private void checkVPE(String testPage) throws Throwable{
@@ -159,7 +115,7 @@
}
});
}
-
+
@Override
protected void closeUnuseDialogs() {
@@ -185,15 +141,10 @@
super.tearDown();
}
- @Override
- protected void shortDelay() {
- bot.sleep(500);
- }
-
private void checkSelectionBar (String... args){
for (int i = 0; i < args.length; i++) {
bot.toolbarButton(args[i]).click();
}
}
-
+
}