[jbosstools-commits] JBoss Tools SVN: r43467 - in trunk: tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types and 5 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Thu Sep 6 08:05:51 EDT 2012
Author: vpakan at redhat.com
Date: 2012-09-06 08:05:51 -0400 (Thu, 06 Sep 2012)
New Revision: 43467
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BlockCommentTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ScrollingSynchronizationTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ToggleCommentTest.java
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/pagedesign/AddSubstitutedELExpressionFolderScopeTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/SubstitutedELTestCase.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/BorderForUnknownTagsTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/PreferencesTestCase.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/ShowNonVisualTagsTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/ShowResourceBundlesUsageasELexpressionsTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/jbide/Jbide10020_TestHotKeyForVpeRefresh.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/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2012-09-06 11:37:24 UTC (rev 43466)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -74,4 +74,9 @@
protected void setUp() throws Exception {
super.setUp();
}
+
+ @Override
+ public void runBare() throws Throwable {
+ super.runBare();
+ }
}
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2012-09-06 11:37:24 UTC (rev 43466)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -755,7 +755,7 @@
public static class ToolbarButton{
- public static final String REFRESH = "Refresh (F5)";
+ public static final String REFRESH = "Refresh (Ctrl+R)";
public static final String REFRESH_MAC_OS = "Refresh (⌘R)";
}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BlockCommentTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BlockCommentTest.java 2012-09-06 11:37:24 UTC (rev 43466)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BlockCommentTest.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -13,7 +13,9 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.SWTJBTExt;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
public class BlockCommentTest extends VPEEditorTestCase{
@@ -31,14 +33,20 @@
getEditor().selectLine(22);
bot.menu("Source").menu("Add Block Comment").click(); //$NON-NLS-1$//$NON-NLS-2$
getEditor().save();
- checkVPE("BlockCommentTestToggle.xml"); //$NON-NLS-1$
+ waitForBlockingJobsAcomplished(VISUAL_UPDATE);
+ SWTBotWebBrowser webBrowser = new SWTBotWebBrowser(TEST_PAGE, new SWTBotExt());
+ assertVisualEditorContainsManyComments(webBrowser, 1, TEST_PAGE);
+ final String commentValue = "<h:commandButton action=\"hello\" value=\"Say Hello!\" />";
+ assertTrue("Visual Representation of page doesn't contain comment with value " + commentValue,
+ webBrowser.containsCommentWithValue(commentValue));
//Test remove block comment from Source menu
getEditor().selectLine(22);
bot.menu("Source").menu("Remove Block Comment").click(); //$NON-NLS-1$//$NON-NLS-2$
getEditor().save();
- checkVPE("CommentTestUntoggle.xml"); //$NON-NLS-1$
+ waitForBlockingJobsAcomplished(VISUAL_UPDATE);
+ assertVisualEditorContainsManyComments(webBrowser, 0, TEST_PAGE);
//Test add block comment with CTRL+SHIFT+/ hot keys
@@ -46,14 +54,18 @@
getEditor().selectLine(22);
pressBlockCommentHotKeys();
getEditor().save();
- checkVPE("BlockCommentTestToggle.xml"); //$NON-NLS-1$
+ waitForBlockingJobsAcomplished(VISUAL_UPDATE);
+ assertVisualEditorContainsManyComments(webBrowser, 1, TEST_PAGE);
+ assertTrue("Visual Representation of page doesn't contain comment with value " + commentValue,
+ webBrowser.containsCommentWithValue(commentValue));
//Test remove block comment with CTRL+SHIFT+\ hot keys
getEditor().selectLine(22);
pressUnBlockCommentHotKeys();
getEditor().save();
- checkVPE("CommentTestUntoggle.xml"); //$NON-NLS-1$
+ waitForBlockingJobsAcomplished(VISUAL_UPDATE);
+ assertVisualEditorContainsManyComments(webBrowser, 0, TEST_PAGE);
}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ScrollingSynchronizationTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ScrollingSynchronizationTest.java 2012-09-06 11:37:24 UTC (rev 43466)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ScrollingSynchronizationTest.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -45,7 +45,7 @@
*/
try {
FileHelper.copyFilesBinary(
- new File(getPathToResources(IDELabel.JsfProjectTree.WEB_CONTENT + "/" + FACELETS_JSP)), //$NON-NLS-1$
+ new File(getPathToRootResources(IDELabel.JsfProjectTree.WEB_CONTENT + "/" + FACELETS_JSP)), //$NON-NLS-1$
new File(FileHelper.getProjectLocation(JBT_TEST_PROJECT_NAME, bot),
IDELabel.JsfProjectTree.WEB_CONTENT + "/" + IDELabel.JsfProjectTree.PAGES)); //$NON-NLS-1$
} catch (IOException ioe) {
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ToggleCommentTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ToggleCommentTest.java 2012-09-06 11:37:24 UTC (rev 43466)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ToggleCommentTest.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -13,7 +13,9 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.SWTJBTExt;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
public class ToggleCommentTest extends VPEEditorTestCase{
@@ -27,32 +29,41 @@
setEditorText(getEditor().getText());
//Test toggle comment from Source menu
-
getEditor().navigateTo(22,22);
bot.menu("Source").menu("Toggle Comment").click(); //$NON-NLS-1$ //$NON-NLS-2$
getEditor().save();
- checkVPE("ToggleCommentTestToggle.xml"); //$NON-NLS-1$
+ waitForBlockingJobsAcomplished(VISUAL_UPDATE);
+ SWTBotWebBrowser webBrowser = new SWTBotWebBrowser(TEST_PAGE, new SWTBotExt());
+ assertVisualEditorContainsManyComments(webBrowser, 1, TEST_PAGE);
+ final String commentValue = "<h:commandButton action=\"hello\" value=\"Say Hello!\" />";
+ assertTrue("Visual Representation of page doesn't contain comment with value " + commentValue,
+ webBrowser.containsCommentWithValue(commentValue));
//Test untoggle comment from Source menu
getEditor().navigateTo(22,22);
bot.menu("Source").menu("Toggle Comment").click(); //$NON-NLS-1$ //$NON-NLS-2$
getEditor().save();
- checkVPE("CommentTestUntoggle.xml"); //$NON-NLS-1$
+ waitForBlockingJobsAcomplished(VISUAL_UPDATE);
+ assertVisualEditorContainsManyComments(webBrowser, 0, TEST_PAGE);
//Test toggle comment with CTRL+SHIFT+C hot keys
getEditor().navigateTo(22,22);
pressToggleCommentHotKeys();
getEditor().save();
- checkVPE("ToggleCommentTestToggle.xml"); //$NON-NLS-1$
+ waitForBlockingJobsAcomplished(VISUAL_UPDATE);
+ assertVisualEditorContainsManyComments(webBrowser, 1, TEST_PAGE);
+ assertTrue("Visual Representation of page doesn't contain comment with value " + commentValue,
+ webBrowser.containsCommentWithValue(commentValue));
//Test untoggle comment with CTRL+SHIFT hot keys
getEditor().navigateTo(22,22);
pressToggleCommentHotKeys();
getEditor().save();
- checkVPE("CommentTestUntoggle.xml"); //$NON-NLS-1$
+ waitForBlockingJobsAcomplished(VISUAL_UPDATE);
+ assertVisualEditorContainsManyComments(webBrowser, 0, TEST_PAGE);
}
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 2012-09-06 11:37:24 UTC (rev 43466)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -64,6 +64,9 @@
return filePath;
}
+ protected String getPathToRootResources(String testPage) throws IOException {
+ return super.getPathToResources(testPage);
+ }
protected void openPage(){
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
SWTBotTree tree = innerBot.tree();
@@ -206,4 +209,22 @@
attributeValues));
}
+ /**
+ * Asserts if Visual Editor contains node nodeNameToContain exactly numOccurrencies times
+ * @param webBrowser
+ * @param nodeNameToContain
+ * @param numOccurrences
+ * @param fileName
+ */
+ protected static void assertVisualEditorContainsManyComments (SWTBotWebBrowser webBrowser,
+ int numOccurrences,
+ String fileName){
+
+ assertTrue("Visual Representation of file " + fileName
+ + " has to contain "
+ + numOccurrences
+ + " comment nodes but it doesn't",
+ webBrowser.getCommentNodes().size() == numOccurrences);
+
+ }
}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/AddSubstitutedELExpressionFolderScopeTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/AddSubstitutedELExpressionFolderScopeTest.java 2012-09-06 11:37:24 UTC (rev 43466)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/AddSubstitutedELExpressionFolderScopeTest.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -11,13 +11,13 @@
package org.jboss.tools.vpe.ui.bot.test.editor.pagedesign;
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.SWTBotTable;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.gen.ActionItem;
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 AddSubstitutedELExpressionFolderScopeTest extends SubstitutedELTestCase{
@@ -104,17 +104,27 @@
// waitForBlockingJobsAcomplished(VISUAL_REFRESH);
//Check page content
-
- checkVPEForTestPage("AddSubstitutedELExpressionTestPage.xml"); //$NON-NLS-1$
- checkVPEForHelloPage("AddSubstitutedELExpressionHelloPage.xml"); //$NON-NLS-1$
- checkVPEForTestPageFolder("RemoveSubstitutedELExpressionTestPage.xml"); //$NON-NLS-1$
-
- //Test check the page in the same folder
-
-
-
- //Test open Page Design Options
-
+ openPage();
+ SWTBotExt botExt = new SWTBotExt();
+ assertVisualEditorContains(new SWTBotWebBrowser(TEST_PAGE,botExt),
+ "INPUT",
+ new String[]{"value"},
+ new String[]{EL_VALUE},
+ TEST_PAGE);
+ openPage("hello.jsp");
+ assertVisualEditorContainsNodeWithValue(new SWTBotWebBrowser("hello.jsp",botExt),
+ EL_VALUE,
+ "hello.jsp");
+ packageExplorer.openFile(JBT_TEST_PROJECT_NAME,
+ "WebContent",
+ TEST_FOLDER,
+ TEST_PAGE_FOR_FOLDER+".jsp");
+ assertVisualEditorContains(new SWTBotWebBrowser(TEST_PAGE_FOR_FOLDER+".jsp",botExt),
+ "INPUT",
+ new String[]{"value"},
+ new String[]{"#{user.name}"},
+ TEST_PAGE_FOR_FOLDER+".jsp");
+ openPage();
bot.toolbarButtonWithTooltip(PAGE_DESIGN).click();
bot.shell(PAGE_DESIGN).activate();
@@ -129,10 +139,21 @@
bot.button("OK").click(); //$NON-NLS-1$
//Check VPE content
+ assertVisualEditorContains(new SWTBotWebBrowser(TEST_PAGE,botExt),
+ "INPUT",
+ new String[]{"value"},
+ new String[]{"#{user.name}"},
+ TEST_PAGE);
- checkVPEForTestPage("RemoveSubstitutedELExpressionTestPage.xml"); //$NON-NLS-1$
- checkVPEForHelloPage("RemoveSubstitutedELExpressionHelloPage.xml"); //$NON-NLS-1$
- checkVPEForTestPageFolder("RemoveSubstitutedELExpressionTestPage.xml"); //$NON-NLS-1$
+ assertVisualEditorContainsNodeWithValue(new SWTBotWebBrowser("hello.jsp",botExt),
+ "#{user.name}",
+ "hello.jsp");
+
+ assertVisualEditorContains(new SWTBotWebBrowser(TEST_PAGE_FOR_FOLDER+".jsp",botExt),
+ "INPUT",
+ new String[]{"value"},
+ new String[]{"#{user.name}"},
+ TEST_PAGE_FOR_FOLDER+".jsp");
}
@Override
@@ -147,30 +168,5 @@
delay();
super.tearDown();
}
-
- private void checkVPEForTestPageFolder(String testPageFolder) throws Throwable{
- //Open hello page
-
- SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
- SWTBotTree tree = innerBot.tree();
- tree.expandNode(JBT_TEST_PROJECT_NAME)
- .expandNode("WebContent").expandNode(TEST_FOLDER) //$NON-NLS-1$
- .getNode(TEST_PAGE_FOR_FOLDER+".jsp").doubleClick(); //$NON-NLS-1$
- SWTBotEditor editor = bot.editorByTitle(TEST_PAGE_FOR_FOLDER+".jsp"); //$NON-NLS-1$
- // waitForBlockingJobsAcomplished(VISUAL_REFRESH);
-
- //Check page content
-
- try {
- performContentTestByDocument(testPageFolder, bot.multiPageEditorByTitle(TEST_PAGE_FOR_FOLDER+".jsp")); //$NON-NLS-1$
- } catch (Throwable e) {
- throw e;
- }finally{
- editor.close();
- openPage();
- }
-
- }
-
}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/SubstitutedELTestCase.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/SubstitutedELTestCase.java 2012-09-06 11:37:24 UTC (rev 43466)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/SubstitutedELTestCase.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -10,12 +10,8 @@
******************************************************************************/
package org.jboss.tools.vpe.ui.bot.test.editor.pagedesign;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
-import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.jboss.tools.ui.bot.test.WidgetVariables;
public abstract class SubstitutedELTestCase extends PageDesignTestCase{
@@ -42,11 +38,6 @@
return isOpened;
}
-
- void checkVPEForTestPage(String testPage) throws Throwable{
- performContentTestByDocument(testPage, bot.multiPageEditorByTitle(TEST_PAGE));
- }
-
@Override
public void setUp() throws Exception {
super.setUp();
@@ -77,27 +68,5 @@
catch (WidgetNotFoundException e) {
}
}
-
- void checkVPEForHelloPage(String testHelloPage) throws Throwable{
- //Open hello page
-
- SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
- SWTBotTree tree = innerBot.tree();
- tree.expandNode(JBT_TEST_PROJECT_NAME)
- .expandNode("WebContent").expandNode("pages").getNode("hello.jsp").doubleClick(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- SWTBotEditor editor = bot.editorByTitle("hello.jsp"); //$NON-NLS-1$
-
- //Check page content
-
- try {
- performContentTestByDocument(testHelloPage, bot.multiPageEditorByTitle("hello.jsp")); //$NON-NLS-1$
- } catch (Throwable e) {
- throw e;
- }finally{
- editor.close();
- openPage();
- }
- }
-
}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/BorderForUnknownTagsTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/BorderForUnknownTagsTest.java 2012-09-06 11:37:24 UTC (rev 43466)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/BorderForUnknownTagsTest.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -12,6 +12,8 @@
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
public class BorderForUnknownTagsTest extends PreferencesTestCase{
@@ -28,7 +30,8 @@
//Test insert unknown tag
editor.navigateTo(12, 52);
- editor.insertText("<tagunknown></tagunknown>"); //$NON-NLS-1$
+ final String unknownTag = "tagunknown";
+ editor.insertText("<" + unknownTag + "></" + unknownTag + ">"); //$NON-NLS-1$
//Test default Show Border value
@@ -42,25 +45,32 @@
//Test check VPE content
- checkVPE("ShowBorderForUnknownTag.xml"); //$NON-NLS-1$
-
+ SWTBotWebBrowser webBrowser = new SWTBotWebBrowser(TEST_PAGE, new SWTBotExt());
+ assertVisualEditorContains(webBrowser,
+ "DIV",
+ new String[]{"style","title"},
+ new String[]{"-moz-user-modify: read-only; border: 1px solid green;",unknownTag},
+ TEST_PAGE);
//Test hide border for unknown tag
selectBorder();
- checkVPE("HideBorderForUnknownTag.xml"); //$NON-NLS-1$
-
+ assertVisualEditorContains(webBrowser,
+ "DIV",
+ new String[]{"style","title"},
+ new String[]{"-moz-user-modify: read-only;",unknownTag},
+ TEST_PAGE);
+
//Test restore previous state
selectBorder();
- checkVPE("ShowBorderForUnknownTag.xml"); //$NON-NLS-1$
+ assertVisualEditorContains(webBrowser,
+ "DIV",
+ new String[]{"style","title"},
+ new String[]{"-moz-user-modify: read-only; border: 1px solid green;",unknownTag},
+ TEST_PAGE);
}
- private void checkVPE(String testPage) throws Throwable{
-// waitForBlockingJobsAcomplished(VISUAL_REFRESH);
- performContentTestByDocument(testPage, bot.multiPageEditorByTitle(TEST_PAGE));
- }
-
private void selectBorder(){
bot.toolbarButtonWithTooltip(PREF_TOOLTIP).click();
bot.shell(PREF_FILTER_SHELL_TITLE).activate();
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/PreferencesTestCase.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/PreferencesTestCase.java 2012-09-06 11:37:24 UTC (rev 43466)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/PreferencesTestCase.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -21,9 +21,9 @@
import org.jboss.tools.ui.bot.ext.SWTJBTExt;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.vpe.ui.bot.test.Activator;
-import org.jboss.tools.vpe.ui.bot.test.VPEAutoTestCase;
+import org.jboss.tools.vpe.ui.bot.test.editor.VPEEditorTestCase;
-public abstract class PreferencesTestCase extends VPEAutoTestCase{
+public abstract class PreferencesTestCase extends VPEEditorTestCase{
protected static final String TOGGLE_SELECTION_BAR_TOOLTIP = "Toggle selection tag bar (" + //$NON-NLS-1$
(SWTJBTExt.isRunningOnMacOs() ? "⌘6" : "Ctrl+6") + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/ShowNonVisualTagsTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/ShowNonVisualTagsTest.java 2012-09-06 11:37:24 UTC (rev 43466)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/ShowNonVisualTagsTest.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -10,32 +10,37 @@
******************************************************************************/
package org.jboss.tools.vpe.ui.bot.test.editor.preferences;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
+
public class ShowNonVisualTagsTest extends PreferencesTestCase{
public void testShowNonVisualTags() throws Throwable{
openPage();
- checkVPE("DumpedTestPage.xml"); //$NON-NLS-1$
-
- //Test Show Non-Visual Tags
-
+ //Test Show Non-Visual Tags
selectShowNonVisual();
closePage();
openPage();
- checkVPE("ShowNonVisualTags.xml"); //$NON-NLS-1$
-
+ SWTBotWebBrowser webBrowser = new SWTBotWebBrowser(TEST_PAGE, new SWTBotExt());
+ assertVisualEditorContainsNodeWithValue(webBrowser,
+ "jsp:directive.taglib",
+ TEST_PAGE);
+ assertVisualEditorContainsNodeWithValue(webBrowser,
+ "f:loadBundle",
+ TEST_PAGE);
//Test Hide Non-Visual Tags
selectShowNonVisual();
closePage();
openPage();
- checkVPE("DumpedTestPage.xml"); //$NON-NLS-1$
-
+ webBrowser = new SWTBotWebBrowser(TEST_PAGE, new SWTBotExt());
+ assertVisualEditorNotContainNodeWithValue(webBrowser,
+ "jsp:directive.taglib",
+ TEST_PAGE);
+ assertVisualEditorNotContainNodeWithValue(webBrowser,
+ "f:loadBundle",
+ TEST_PAGE);
}
- private void checkVPE(String testPage) throws Throwable{
-// waitForBlockingJobsAcomplished(VISUAL_REFRESH);
- performContentTestByDocument(testPage, bot.multiPageEditorByTitle(TEST_PAGE));
- }
-
private void selectShowNonVisual(){
bot.toolbarButtonWithTooltip(PREF_TOOLTIP).click();
bot.shell(PREF_FILTER_SHELL_TITLE).activate();
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/ShowResourceBundlesUsageasELexpressionsTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/ShowResourceBundlesUsageasELexpressionsTest.java 2012-09-06 11:37:24 UTC (rev 43466)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/ShowResourceBundlesUsageasELexpressionsTest.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -11,6 +11,8 @@
package org.jboss.tools.vpe.ui.bot.test.editor.preferences;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
public class ShowResourceBundlesUsageasELexpressionsTest extends PreferencesTestCase{
@@ -22,17 +24,37 @@
openPage();
editor = bot.editorByTitle(TEST_PAGE).toTextEditor();
textEditor = editor.getText();
-
+ SWTBotWebBrowser webBrowser = new SWTBotWebBrowser(TEST_PAGE, new SWTBotExt());
//Test check VPE content with resource bundles
-
selectELExpressions();
- checkVPE("ShowResourceBundlesUsageasELExpressions.xml"); //$NON-NLS-1$
-
+ assertVisualEditorContainsNodeWithValue(webBrowser,
+ "#{Message.prompt_message}",
+ TEST_PAGE);
+ assertVisualEditorContainsNodeWithValue(webBrowser,
+ "#{Message.header}",
+ TEST_PAGE);
+ assertVisualEditorNotContainNodeWithValue(webBrowser,
+ "Hello Demo Application",
+ TEST_PAGE);
+ assertVisualEditorNotContainNodeWithValue(webBrowser,
+ "Name:",
+ TEST_PAGE);
//Test check VPE content without resource bundles
selectELExpressions();
- checkVPE("HideResourceBundlesUsageasELExpressions.xml"); //$NON-NLS-1$
-
+ new SWTBotWebBrowser(TEST_PAGE, new SWTBotExt()).displayWebBrowserDOM();
+ assertVisualEditorNotContainNodeWithValue(webBrowser,
+ "#{Message.prompt_message}",
+ TEST_PAGE);
+ assertVisualEditorNotContainNodeWithValue(webBrowser,
+ "#{Message.header}",
+ TEST_PAGE);
+ assertVisualEditorContainsNodeWithValue(webBrowser,
+ "Hello Demo Application",
+ TEST_PAGE);
+ assertVisualEditorContainsNodeWithValue(webBrowser,
+ "Name:",
+ TEST_PAGE);
}
@Override
@@ -48,11 +70,6 @@
super.tearDown();
}
- private void checkVPE(String testPage) throws Throwable{
-// waitForBlockingJobsAcomplished(VISUAL_REFRESH);
- performContentTestByDocument(testPage, bot.multiPageEditorByTitle(TEST_PAGE));
- }
-
private void selectELExpressions(){
bot.toolbarButtonWithTooltip(PREF_TOOLTIP).click();
bot.shell(PREF_FILTER_SHELL_TITLE).activate();
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/jbide/Jbide10020_TestHotKeyForVpeRefresh.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/jbide/Jbide10020_TestHotKeyForVpeRefresh.java 2012-09-06 11:37:24 UTC (rev 43466)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/jbide/Jbide10020_TestHotKeyForVpeRefresh.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -11,13 +11,15 @@
package org.jboss.tools.vpe.ui.bot.test.jbide;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.jboss.tools.ui.bot.ext.SWTJBTExt;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.vpe.ui.bot.test.VPEAutoTestCase;
public class Jbide10020_TestHotKeyForVpeRefresh extends VPEAutoTestCase {
- private final String TOOL_TIP = "Refresh (F5)"; //$NON-NLS-1$
- private final String TOOL_TIP2 = "Refresh"; //$NON-NLS-1$
+ private final String TOOL_TIP = SWTJBTExt.isRunningOnMacOs() ?
+ IDELabel.ToolbarButton.REFRESH_MAC_OS: IDELabel.ToolbarButton.REFRESH;
private final String ERROR_MESSAGE =
"Could not find tool bar button with tooltip '" + TOOL_TIP //$NON-NLS-1$
+ "' on the toolbar. Hot key 'F5' for VPE refresh is broken."; //$NON-NLS-1$
@@ -41,7 +43,7 @@
/*
* Case 1:
* When focus is on in the VPE --
- * Find "Refresh (F5)" toolbar button
+ * Find "Refresh (Ctrl+5)" toolbar button
*/
editor.setFocus();
try {
@@ -55,10 +57,6 @@
* Find "Refresh" toolbar button without HotKey defined.
*/
packageExplorer.show();
- try {
- bot.toolbarButtonWithTooltip(TOOL_TIP2);
- } catch (Exception e) {
- fail("Hot key for VPE refresh is *NOT* disabled in Package Explorer"); //$NON-NLS-1$
- }
+ assertNotEnabled(bot.toolbarButtonWithTooltip(TOOL_TIP));
}
}
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-06 11:37:24 UTC (rev 43466)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java 2012-09-06 12:05:51 UTC (rev 43467)
@@ -968,4 +968,61 @@
return result;
}
+
+ /**
+ * Returns all comment nodes
+ * @return
+ */
+ public List<nsIDOMNode> getCommentNodes(){
+ return getCommentNodes(mozillaEditor.getDomDocument());
+ }
+ /**
+ * Returns all comment nodes of node
+ * @param node
+ * @return
+ */
+ public List<nsIDOMNode> getCommentNodes(nsIDOMNode node){
+ LinkedList<nsIDOMNode> result = new LinkedList<nsIDOMNode>();
+ final String commentNodeName = "#comment";
+ if (node.getNodeName().trim().equals(commentNodeName)){
+ result.add(node);
+ }
+ else{
+ // check children children
+ nsIDOMNodeList children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); 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.addAll(getCommentNodes(child));
+ }
+ }
+ return result;
+ }
+ /**
+ * Returns true if browser contains comment node with value
+ * @param value
+ * @return
+ */
+ public boolean containsCommentWithValue (String value){
+ boolean notFound = true;
+
+ List<nsIDOMNode> comments = getCommentNodes();
+ if (comments != null && comments.size() > 0){
+ Iterator<nsIDOMNode> itNode = comments.iterator();
+ while (itNode.hasNext() && notFound){
+ nsIDOMNode node = itNode.next();
+ if (stripTextFromSpecChars(node.getNodeValue()).equalsIgnoreCase(value)){
+ notFound = false;
+ }
+ }
+ }
+
+ return !notFound;
+ }
}
More information about the jbosstools-commits
mailing list