Author: dmaliarevich
Date: 2010-07-28 10:33:46 -0400 (Wed, 28 Jul 2010)
New Revision: 23780
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/resources/projectProperties.properties
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6287 , JUnits for facelets in xhtml file was added.
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/resources/projectProperties.properties
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/resources/projectProperties.properties 2010-07-28
13:51:18 UTC (rev 23779)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/resources/projectProperties.properties 2010-07-28
14:33:46 UTC (rev 23780)
@@ -1,3 +1,4 @@
JSFProjectName=JBIDETestProject
+FaceletsProjectName=FaceletsTestProject
Apachev6.0=D\:/Java/apache-tomcat-6.0.18
JBossEap4.3=${jbosstools.test.jboss.home}
\ No newline at end of file
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2010-07-28
13:51:18 UTC (rev 23779)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2010-07-28
14:33:46 UTC (rev 23780)
@@ -35,6 +35,7 @@
protected static Properties projectProperties;
protected static final String TEST_PAGE = "inputUserName.jsp"; //$NON-NLS-1$
+ protected static final String FACELETS_TEST_PAGE = "inputname.xhtml";
//$NON-NLS-1$
protected static String PROJECT_PROPERTIES = "projectProperties.properties";
//$NON-NLS-1$
/**
@@ -43,6 +44,7 @@
protected final static String JBOSS_EAP_HOME;
protected final static String JBT_TEST_PROJECT_NAME;
+ protected final static String FACELETS_TEST_PROJECT_NAME;
protected final static String JBOSS_SERVER_GROUP;
protected final static String JBOSS_SERVER_TYPE;
protected final static String JBOSS_SERVER_RUNTIME_TYPE;
@@ -84,6 +86,7 @@
JBOSS_SERVER_TYPE = IDELabel.ServerType.JBOSS_EAP_4_3;
}
JBT_TEST_PROJECT_NAME = projectProperties.getProperty("JSFProjectName");
//$NON-NLS-1$
+ FACELETS_TEST_PROJECT_NAME =
projectProperties.getProperty("FaceletsProjectName"); //$NON-NLS-1$
}
/**
@@ -96,11 +99,22 @@
clearWorkbench();
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
SWTBotTree tree = innerBot.tree();
+ /*
+ * Test JSF project
+ */
try {
tree.getTreeItem(JBT_TEST_PROJECT_NAME);
} catch (WidgetNotFoundException e) {
createJSFProject(JBT_TEST_PROJECT_NAME);
}
+ /*
+ * Test Facelets project
+ */
+ try {
+ tree.getTreeItem(FACELETS_TEST_PROJECT_NAME);
+ } catch (WidgetNotFoundException e) {
+ createFaceletsProject(FACELETS_TEST_PROJECT_NAME);
+ }
}
/**
@@ -120,7 +134,6 @@
* Create JSF Project with <b>jsfProjectName</b>
* @param jsfProjectName - name of created project
*/
-
protected void createJSFProject(String jsfProjectName){
bot.menu("File").menu("New").menu("Other...").click();
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
bot.shell("New").activate(); //$NON-NLS-1$
@@ -132,7 +145,7 @@
bot.comboBoxWithLabel("Template*").setSelection("JSFKickStartWithoutLibs");
//$NON-NLS-1$ //$NON-NLS-2$
bot.button("Next >").click(); //$NON-NLS-1$
try {
- bot.comboBoxWithLabel("Runtime*").setSelection("jboss-eap
Runtime"); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.comboBoxWithLabel("Runtime*").setSelection("JBoss EAP 4.3
Runtime"); //$NON-NLS-1$ //$NON-NLS-2$
delay();
bot.button("Finish").click(); //$NON-NLS-1$
try {
@@ -164,6 +177,53 @@
}
/**
+ * Create Facelets Project with <b>faceletsProjectName</b>
+ * @param faceletsProjectName - name of created project
+ */
+ protected void createFaceletsProject(String faceletsProjectName){
+ bot.menu("File").menu("New").menu("Other...").click();
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bot.shell("New").activate(); //$NON-NLS-1$
+ SWTBotTree tree = bot.tree();
+ delay();
+ tree.expandNode("JBoss Tools
Web").expandNode("JSF").select("JSF Project"); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
+ bot.button("Next >").click(); //$NON-NLS-1$
+ bot.textWithLabel("Project Name*").setText(faceletsProjectName);
//$NON-NLS-1$
+ bot.comboBoxWithLabel("JSF Environment*").setSelection("JSF 1.2 with
Facelets"); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.comboBoxWithLabel("Template*").setSelection("FaceletsKickStartWithoutLibs");
//$NON-NLS-1$ //$NON-NLS-2$
+ bot.button("Next >").click(); //$NON-NLS-1$
+ try {
+ bot.comboBoxWithLabel("Runtime*").setSelection("JBoss EAP 4.3
Runtime"); //$NON-NLS-1$ //$NON-NLS-2$
+ delay();
+ bot.button("Finish").click(); //$NON-NLS-1$
+ try {
+ bot.button("Yes").click(); //$NON-NLS-1$
+ openErrorLog();
+ openPackageExplorer();
+ } catch (WidgetNotFoundException e) {
+ }
+ } catch (Exception e) {
+ bot.button(0).click();
+ SWTBotTree innerTree = bot.tree();
+ delay();
+ innerTree.expandNode(JBOSS_SERVER_GROUP).select(JBOSS_SERVER_RUNTIME_TYPE);
+ delay();
+ bot.button("Next >").click(); //$NON-NLS-1$
+ bot.textWithLabel("Home Directory").setText(JBOSS_EAP_HOME); //$NON-NLS-1$
+ bot.button("Finish").click(); //$NON-NLS-1$
+ delay();
+ bot.button("Finish").click(); //$NON-NLS-1$
+ try {
+ bot.button("Yes").click(); //$NON-NLS-1$
+ openErrorLog();
+ openPackageExplorer();
+ } catch (WidgetNotFoundException e2) {
+ }
+ }
+ waitForBlockingJobsAcomplished(60*1000L, BUILDING_WS);
+ setException(null);
+ }
+
+ /**
* Test content of elements from <b>editor</b> by IDs.<p>
* Tested elements from source editor should have id's attributes that
* correspond to expected one from <b>expectedVPEContentFile</b>.
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 2010-07-28
13:51:18 UTC (rev 23779)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java 2010-07-28
14:33:46 UTC (rev 23780)
@@ -128,6 +128,85 @@
assertEquals("'Messages.properties' was updated incorrectly",
"User=User", line); //$NON-NLS-1$ //$NON-NLS-2$
}
+ public void testExternalizeStringsDialogInXhtml() throws Throwable {
+ /*
+ * Open simple html file in order to get the VPE toolbar
+ */
+ SWTBotEditor editor = SWTTestExt.packageExplorer.openFile(FACELETS_TEST_PROJECT_NAME,
+ "WebContent", "pages", FACELETS_TEST_PAGE); //$NON-NLS-1$
//$NON-NLS-2$
+ editor.setFocus();
+ /*
+ * Select some text
+ */
+ editor.toTextEditor().selectRange(10, 45, 4);
+ /*
+ * Get toolbar button
+ */
+ bot.toolbarButtonWithTooltip(VpeUIMessages.EXTERNALIZE_STRINGS).click();
+ bot.shell(VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).setFocus();
+ bot.shell(VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).activate();
+
+ /*
+ * Check properties key and value fields
+ */
+ SWTBotText defKeyText = bot.textWithLabelInGroup(
+ VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPERTIES_KEY,
+ VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPS_STRINGS_GROUP);
+ assertNotNull("Cannot find 'Property Key' text field", defKeyText);
//$NON-NLS-1$
+ assertText("User",defKeyText); //$NON-NLS-1$
+ SWTBotText defValueText = bot.textWithLabelInGroup(
+ VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPERTIES_VALUE,
+ VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPS_STRINGS_GROUP);
+ assertNotNull(CANNOT_FIND_PROPERTY_VALUE, defValueText);
+ assertText("User", defValueText); //$NON-NLS-1$
+ SWTBotCheckBox checkBox = bot.checkBox();
+ assertNotNull("Cannot find checkbox '" //$NON-NLS-1$
+ + VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_NEW_FILE + "'",
//$NON-NLS-1$
+ checkBox);
+ /*
+ * Check that "Next" button is disabled
+ */
+ assertFalse("Checkbox should be unchecked.", //$NON-NLS-1$
+ checkBox.isChecked());
+ assertFalse("Next button should be disabled.", //$NON-NLS-1$
+ bot.button(WidgetVariables.NEXT_BUTTON).isEnabled());
+ /*
+ * Select existed resource bundle
+ */
+ SWTBotCombo combo = bot.comboBox();
+ combo.setSelection(0);
+ assertText("resources", combo); //$NON-NLS-1$
+ /*
+ * Check table results
+ */
+ SWTBotTable table = bot.table();
+ assertNotNull("Table should exist", table); //$NON-NLS-1$
+ assertEquals(INCORRECT_TABLE_VALUE, "prompt", table.cell(0, 0));
//$NON-NLS-1$
+ assertEquals(INCORRECT_TABLE_VALUE, "Your Name\\:", table.cell(0, 1));
//$NON-NLS-1$
+ assertEquals(INCORRECT_TABLE_VALUE, "greeting", table.cell(1, 0));
//$NON-NLS-1$
+ assertEquals(INCORRECT_TABLE_VALUE, "Hello", table.cell(1, 1));
//$NON-NLS-1$
+ /*
+ * Press OK and replace the text in the editor
+ */
+ assertTrue("(OK) button should be enabled.", //$NON-NLS-1$
+ bot.button(WidgetVariables.OK_BUTTON).isEnabled());
+ bot.button(WidgetVariables.OK_BUTTON).click();
+ /*
+ * Check replaced text
+ */
+ editor.toTextEditor().selectRange(10, 39, 22);
+ assertEquals("Replaced text is incorrect", "Input #{msg.User}
Name", editor.toTextEditor().getSelection()); //$NON-NLS-1$ //$NON-NLS-2$
+ /*
+ * Check that properties file has been updated
+ */
+ SWTBotEditor editor2 = SWTTestExt.eclipse.openFile(
+ FACELETS_TEST_PROJECT_NAME, "JavaSource", //$NON-NLS-1$
+ "resources.properties"); //$NON-NLS-1$
+ editor2.toTextEditor().selectLine(3);
+ String line = editor2.toTextEditor().getSelection();
+ assertEquals("'resources.properties' was updated incorrectly",
"User=User", line); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
public void testNewFileInExternalizeStringsDialog() throws Throwable {
/*
* Open simple html file in order to get the VPE toolbar