Author: vpakan(a)redhat.com
Date: 2012-04-16 17:20:04 -0400 (Mon, 16 Apr 2012)
New Revision: 40222
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/OpenOnTest.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
Log:
Added OpenOn test for opening css file referenced via <h:outputStyleSheet> tag.
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/OpenOnTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/OpenOnTest.java 2012-04-16
21:07:27 UTC (rev 40221)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/OpenOnTest.java 2012-04-16
21:20:04 UTC (rev 40222)
@@ -10,10 +10,15 @@
******************************************************************************/
package org.jboss.tools.jsf.ui.bot.test.smoke;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.jsf.ui.bot.test.JSFAutoTestCase;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
import org.jboss.tools.ui.bot.ext.helper.OpenOnHelper;
import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
@@ -193,5 +198,73 @@
0, 0, expectedOpenedFileName);
compositeComponentEditor.close();
}
-
+ /**
+ * Test Open On functionality for CSS file linked via <h:outputStyleSheet>
+ */
+ public void testOpenOnForHOutputStyleSheet() {
+ createJSF2Project(JSF2_TEST_PROJECT_NAME);
+ // create css file
+ SWTBotExt botExt = new SWTBotExt();
+ SWTBotTreeItem tiNode = SWTEclipseExt.selectPathInPackageExplorer(botExt,
+ JSF2_TEST_PROJECT_NAME,
+ "WebContent",
+ "resources");
+ if (tiNode == null){
+ open.newObject(ActionItem.NewObject.GeneralFolder.LABEL);
+ bot.shell(IDELabel.Shell.NEW_FOLDER).activate(); //$NON-NLS-1$
+
bot.textWithLabel(IDELabel.NewFolderDialog.FOLDER_NAME).setText("resources");
//$NON-NLS-1$
+ bot.button(IDELabel.Button.FINISH).click();
+ }
+ tiNode = SWTEclipseExt.selectPathInPackageExplorer(botExt,
+ JSF2_TEST_PROJECT_NAME,
+ "WebContent",
+ "resources",
+ "css");
+ if (tiNode == null){
+ open.newObject(ActionItem.NewObject.GeneralFolder.LABEL);
+ bot.shell(IDELabel.Shell.NEW_FOLDER).activate(); //$NON-NLS-1$
+ bot.textWithLabel(IDELabel.NewFolderDialog.FOLDER_NAME).setText("css");
//$NON-NLS-1$
+ bot.button(IDELabel.Button.FINISH).click();
+ }
+ final String cssFileName = "OpenOnTest.css";
+ tiNode = SWTEclipseExt.selectPathInPackageExplorer(botExt,
+ JSF2_TEST_PROJECT_NAME,
+ "WebContent",
+ "resources",
+ "css",
+ cssFileName);
+ if (tiNode == null){
+ open.newObject(ActionItem.NewObject.WebCSS.LABEL);
+ bot.shell(IDELabel.Shell.NEW_CSS_FILE).activate();
+ bot.textWithLabel(IDELabel.NewCSSWizard.FILE_NAME).setText(cssFileName);
+ bot.button(IDELabel.Button.FINISH).click();
+ }
+ eclipse.closeAllEditors();
+ // create test page
+ final String testPageName = "OpenOnHOutpuStyle.xhtml";
+ createXhtmlPage(testPageName,
JSF2_TEST_PROJECT_NAME,"WebContent","pages");
+ openPage(testPageName,JSF2_TEST_PROJECT_NAME);
+ SWTBotEclipseEditor xhtmlEditor = bot.editorByTitle(testPageName).toTextEditor();
+ xhtmlEditor.setText("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
+ "<html
xmlns=\"http://www.w3.org/1999/xhtml\"\n" +
+ "
xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n" +
+ "
xmlns:h=\"http://java.sun.com/jsf/html\">\n" +
+ " <ui:composition>\n" +
+ " <h:outputStylesheet library=\"css\" name=\"" +
cssFileName + "\"/>" +
+ " </ui:composition>\n" +
+ "</html>");
+ xhtmlEditor.save();
+ // check OpenOn
+ SWTBotEditor cssEditor = OpenOnHelper.checkOpenOnFileIsOpened(
+ SWTTestExt.bot,
+ testPageName,
+ cssFileName,
+ 2,
+ 0,
+ 0,
+ cssFileName);
+ cssEditor.close();
+ xhtmlEditor.close();
+
+ }
}
\ No newline at end of file
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2012-04-16
21:07:27 UTC (rev 40221)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2012-04-16
21:20:04 UTC (rev 40222)
@@ -1757,5 +1757,29 @@
bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.TOGGLE_BREAKPOINT).click();
}
}
+ /**
+ * Select path exist in Package Explorer. Last existing node from path is selected
+ * @param bot
+ * @param fullPath
+ * @return SWTBotTreeItem of last node within path or null if path doesn't exist
+ */
+ public static SWTBotTreeItem selectPathInPackageExplorer(SWTBotExt bot, String...
path) {
+ if (bot == null || path == null) {
+ throw new NullPointerException();
+ }
+ SWTBot innerBot = SWTEclipseExt.showView(bot, ViewType.PACKAGE_EXPLORER);
+ SWTBotTreeItem tiNode = null;
+ try {
+ tiNode = innerBot.tree().expandNode(path[0]);
+ tiNode.select();
+ for (int index = 1 ; index < path.length ; index++){
+ tiNode = tiNode.expandNode(path[index]);
+ tiNode.select();
+ }
+ } catch (WidgetNotFoundException wnfe){
+ tiNode = null;
+ }
+ return tiNode;
+ }
}
\ No newline at end of file
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-04-16
21:07:27 UTC (rev 40221)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2012-04-16
21:20:04 UTC (rev 40222)
@@ -220,7 +220,8 @@
public static final String JBOSS_TOOLS_USAGE = "JBoss Tools Usage";
public static final String SUBCLIPSE_USAGE = "Subclipse Usage";
public static final String PROGRESS_INFORMATION = "Progress Information";
- public static final String REMEMBER_MY_DECISION = "Remember my
decision";
+ public static final String REMEMBER_MY_DECISION = "Remember my decision";
+ public static final String NEW_FOLDER = "New Folder";
}
public class EntityGroup {
@@ -880,4 +881,9 @@
}
+ public static final class NewFolderDialog {
+
+ public static final String FOLDER_NAME = "Folder name:";
+
+ }
}