Author: vpakan(a)redhat.com
Date: 2011-02-22 04:15:40 -0500 (Tue, 22 Feb 2011)
New Revision: 29260
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ColumnsTagTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ComboBoxTagTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/FileUploadTagTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/InplaceInputTagTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/InplaceSelectInputTagTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/PickListTagTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ProgressTagTest.java
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
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/editor/tags/RichFacesTagsTest.java
Log:
Added RichFaces tags tests
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2011-02-21
22:22:27 UTC (rev 29259)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2011-02-22
09:15:40 UTC (rev 29260)
@@ -33,9 +33,15 @@
import
org.jboss.tools.vpe.ui.bot.test.editor.preferences.ShowResourceBundlesUsageasELexpressionsTest;
import org.jboss.tools.vpe.ui.bot.test.editor.preferences.ShowSelectionTagBarTest;
import org.jboss.tools.vpe.ui.bot.test.editor.selectionbar.SelectionBarTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.tags.ColumnsTagTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.tags.ComboBoxTagTest;
import org.jboss.tools.vpe.ui.bot.test.editor.tags.CoreHTMLTagsTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.tags.FileUploadTagTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.tags.InplaceInputTagTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.tags.InplaceSelectInputTagTest;
import org.jboss.tools.vpe.ui.bot.test.editor.tags.JSFTagsTest;
-import org.jboss.tools.vpe.ui.bot.test.editor.tags.RichFacesTagsTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.tags.PickListTagTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.tags.ProgressTagTest;
import org.jboss.tools.vpe.ui.bot.test.jbide.JBIDE4556Test;
import org.jboss.tools.vpe.ui.bot.test.palette.CancelTagLibDefenitionTest;
import org.jboss.tools.vpe.ui.bot.test.palette.ImportTagsFromTLDFileTest;
@@ -100,7 +106,13 @@
suite.addTestSuite(TextSelectionTest.class);
suite.addTestSuite(CoreHTMLTagsTest.class);
suite.addTestSuite(JSFTagsTest.class);
- suite.addTestSuite(RichFacesTagsTest.class);
+ suite.addTestSuite(ColumnsTagTest.class);
+ suite.addTestSuite(ComboBoxTagTest.class);
+ suite.addTestSuite(FileUploadTagTest.class);
+ suite.addTestSuite(InplaceInputTagTest.class);
+ suite.addTestSuite(InplaceSelectInputTagTest.class);
+ suite.addTestSuite(PickListTagTest.class);
+ suite.addTestSuite(ProgressTagTest.class);
suite.addTestSuite(XhtmlFilePerformanceTest.class);
return new TestSetup(suite);
}
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 2011-02-21
22:22:27 UTC (rev 29259)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2011-02-22
09:15:40 UTC (rev 29260)
@@ -17,6 +17,7 @@
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
@@ -566,4 +567,36 @@
}
});
}
+ /**
+ * Creates new empty xhtml page within test project
+ * @param pageName
+ * @param subDirs - complete path to page location within workspace
+ */
+ protected void createXhtmlPage (String pageName , String... subDirs){
+ SWTBotTreeItem tiPageParent = null;
+ if (subDirs == null || subDirs.length == 0) {
+ tiPageParent = packageExplorer.selectTreeItem("pages", new String[]
{VPEAutoTestCase.JBT_TEST_PROJECT_NAME,"WebContent"});
+ }
+ else{
+ String[] subPath = Arrays.copyOfRange(subDirs, 0, subDirs.length - 1);
+ tiPageParent = packageExplorer.selectTreeItem(subDirs[subDirs.length - 1],
subPath);
+ }
+ tiPageParent.expand();
+ try {
+ tiPageParent.getNode(pageName).doubleClick();
+ } catch (WidgetNotFoundException e) {
+ open.newObject(ActionItem.NewObject.JBossToolsWebXHTMLFile.LABEL);
+ bot.shell(IDELabel.Shell.NEW_XHTML_FILE).activate();
+
bot.textWithLabel(ActionItem.NewObject.JBossToolsWebXHTMLFile.TEXT_FILE_NAME).setText(pageName);
+ bot.button(IDELabel.Button.NEXT).click();
+ SWTBotCheckBox cbUseTemplate =
bot.checkBox(IDELabel.NewXHTMLFileDialog.USE_XHTML_TEMPLATE_CHECK_BOX);
+ if (cbUseTemplate.isChecked()){
+ cbUseTemplate.deselect();
+ }
+ bot.button(IDELabel.Button.FINISH).click();
+ }
+ bot.sleep(Timing.time2S());
+
+ }
+
}
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ColumnsTagTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ColumnsTagTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ColumnsTagTest.java 2011-02-22
09:15:40 UTC (rev 29260)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+
+ * Copyright (c) 2007-2011 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.bot.test.editor.tags;
+
+/**
+ * Tests Rich Faces Columns Tag behavior
+ * @author vlado pakan
+ *
+ */
+public class ColumnsTagTest extends RichFacesTagsTest{
+ private static final String columnHeader = "Column Header";
+ private static final String columnValue = "Column Value";
+
+ @Override
+ protected void initPageContent() {
+ xhtmlEditor.setText("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
+ "<ui:composition
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" +
+ "
xmlns:f=\"http://java.sun.com/jsf/core\"\n" +
+ "
xmlns:rich=\"http://richfaces.org/rich\"\n" +
+ "
xmlns:a4j=\"http://richfaces.org/a4j\">\n" +
+ "<html>\n" +
+ " <head>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <rich:dataTable value=\"\" var=\"model\"
width=\"750\">\n" +
+ " <rich:columns value=\"\" var=\"columns\"
index=\"ind\">\n" +
+ " <f:facet name=\"header\">\n" +
+ " <h:outputText value=\"" + columnHeader +
"\" />\n" +
+ " </f:facet>\n" +
+ " <h:outputText value=\"" + columnValue +
"\"/> \n" +
+ " </rich:columns>\n" +
+ " </rich:dataTable>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>\n" +
+ "</ui:composition>");
+ }
+
+ @Override
+ protected void verifyTag() {
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ columnHeader,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ columnValue,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TR",
+ new String[]{"class"},
+ new String[]{"dr-table-subheader rich-table-subheader"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TD",
+ new String[]{"class"},
+ new String[]{"dr-table-subheadercell rich-table-subheadercell"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TR",
+ new String[]{"class"},
+ new String[]{"dr-table-firstrow rich-table-firstrow"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TD",
+ new String[]{"class"},
+ new String[]{"dr-table-cell rich-table-cell"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ }
+
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ColumnsTagTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ComboBoxTagTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ComboBoxTagTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ComboBoxTagTest.java 2011-02-22
09:15:40 UTC (rev 29260)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+
+ * Copyright (c) 2007-2011 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.bot.test.editor.tags;
+
+import org.jboss.tools.ui.bot.ext.Timing;
+
+/**
+ * Tests Rich Faces ComboBox Tag behavior
+ * @author vlado pakan
+ *
+ */
+public class ComboBoxTagTest extends RichFacesTagsTest{
+ private static final String defaultLabel = "DefaultLabel";
+
+ @Override
+ protected void initPageContent() {
+ jspEditor.setText("<%@ taglib
uri=\"http://java.sun.com/jsf/html\"
prefix=\"h\" %>\n" +
+ "<%@ taglib
uri=\"http://java.sun.com/jsf/core\"
prefix=\"f\" %>\n" +
+ "<%@ taglib
uri=\"http://richfaces.org/rich\"
prefix=\"rich\" %>\n" +
+ "<html>\n" +
+ " <head>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <h:form>\n" +
+ " <rich:comboBox id=\"comboBox\"
defaultLabel=\"" + defaultLabel + "\">\n" +
+ " <f:selectItem itemValue=\"item 1\"/>\n" +
+ " <f:selectItem itemValue=\"item 2\"/>\n" +
+ " </rich:comboBox>\n" +
+ " </h:form>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>");
+ }
+
+ @Override
+ protected void verifyTag() {
+ assertVisualEditorContains(jspWebBrowser,
+ "INPUT",
+ new String[]{"type","class","value"},
+ new String[]{"text","rich-combobox-font-disabled
rich-combobox-input-inactive",defaultLabel},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContains(jspWebBrowser,
+ "INPUT",
+ new String[]{"type","class"},
+ new String[]{"text","rich-combobox-font-inactive
rich-combobox-button-background rich-combobox-button-inactive"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContains(jspWebBrowser,
+ "INPUT",
+ new String[]{"type","class"},
+ new String[]{"text","rich-combobox-font-inactive
rich-combobox-button-icon-inactive rich-combobox-button-inactive"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContains(jspWebBrowser,
+ "DIV",
+ new String[]{"class"},
+ new String[]{"rich-combobox-strut rich-combobox-font"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ // check tag selection
+ jspWebBrowser.selectDomNode(jspWebBrowser.getDomNodeByTagName("INPUT"),
0);
+ bot.sleep(Timing.time3S());
+ String selectedText = jspEditor.getSelection();
+ final String hasToStartWith = "<rich:comboBox";
+ assertTrue("Selected text in Source Pane has to start with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().startsWith(hasToStartWith));
+ final String hasToEndWith = "</rich:comboBox>";
+ assertTrue("Selected text in Source Pane has to end with '" +
hasToEndWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().endsWith(hasToEndWith));
+ }
+
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ComboBoxTagTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/FileUploadTagTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/FileUploadTagTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/FileUploadTagTest.java 2011-02-22
09:15:40 UTC (rev 29260)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+
+ * Copyright (c) 2007-2011 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.bot.test.editor.tags;
+
+import org.jboss.tools.ui.bot.ext.Timing;
+
+/**
+ * Tests Rich Faces FileUpload Tag behavior
+ * @author vlado pakan
+ *
+ */
+public class FileUploadTagTest extends RichFacesTagsTest{
+ @Override
+ protected void initPageContent() {
+ jspEditor.setText("<%@ taglib
uri=\"http://java.sun.com/jsf/html\"
prefix=\"h\" %>\n" +
+ "<%@ taglib
uri=\"http://java.sun.com/jsf/core\"
prefix=\"f\" %>\n" +
+ "<%@ taglib
uri=\"http://richfaces.org/rich\"
prefix=\"rich\" %>\n" +
+ "<html>\n" +
+ " <head>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <rich:fileUpload fileUploadListener=\"\"\n"+
+ " maxFilesQuantity=\"1\" id=\"upload\"\n" +
+ " immediateUpload=\"false\"\n" +
+ " acceptedTypes=\"jpg\" style=\"width:500;
height:500\">\n" +
+ " </rich:fileUpload>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>");
+ }
+
+ @Override
+ protected void verifyTag() {
+ assertVisualEditorContains(jspWebBrowser,
+ "B",
+ new String[]{"title"},
+ new String[]{"rich:fileUpload fileUploadListener: maxFilesQuantity: 1 id:
upload immediateUpload: false acceptedTypes: jpg style: width:500; height:500"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContains(jspWebBrowser,
+ "DIV",
+ new String[]{"class"},
+ new String[]{"rich-fileupload-list-decor"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContains(jspWebBrowser,
+ "DIV",
+ new String[]{"class"},
+ new String[]{"rich-fileupload-button-border"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContains(jspWebBrowser,
+ "DIV",
+ new String[]{"class"},
+ new String[]{"rich-fileupload-button rich-fileupload-font"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContains(jspWebBrowser,
+ "DIV",
+ new String[]{"class"},
+ new String[]{"rich-fileupload-button-content rich-fileupload-font
rich-fileupload-ico rich-fileupload-ico-add"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContains(jspWebBrowser,
+ "DIV",
+ new String[]{"class"},
+ new String[]{"rich-fileupload-button-content rich-fileupload-font
rich-fileupload-ico rich-fileupload-ico-start"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContains(jspWebBrowser,
+ "DIV",
+ new String[]{"class"},
+ new String[]{"rich-fileupload-button-content rich-fileupload-font
rich-fileupload-ico rich-fileupload-ico-clear"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ // check tag selection
+ jspWebBrowser.selectDomNode(jspWebBrowser.getDomNodeByTagName("B",0),
0);
+ bot.sleep(Timing.time3S());
+ String selectedText = jspEditor.getSelection();
+ final String hasToStartWith = "<rich:fileUpload";
+ assertTrue("Selected text in Source Pane has to start with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().startsWith(hasToStartWith));
+ final String hasEndWith = "</rich:fileUpload>";
+ assertTrue("Selected text in Source Pane has to end with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().endsWith(hasEndWith));
+ }
+
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/FileUploadTagTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/InplaceInputTagTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/InplaceInputTagTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/InplaceInputTagTest.java 2011-02-22
09:15:40 UTC (rev 29260)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+
+ * Copyright (c) 2007-2011 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.bot.test.editor.tags;
+
+import org.jboss.tools.ui.bot.ext.Timing;
+
+/**
+ * Tests Rich Faces InplaceInput Tag behavior
+ * @author vlado pakan
+ *
+ */
+public class InplaceInputTagTest extends RichFacesTagsTest{
+ private static final String defaultLabel = "DefaultLabel";
+ @Override
+ protected void initPageContent() {
+ jspEditor.setText("<%@ taglib
uri=\"http://java.sun.com/jsf/html\"
prefix=\"h\" %>\n" +
+ "<%@ taglib
uri=\"http://java.sun.com/jsf/core\"
prefix=\"f\" %>\n" +
+ "<%@ taglib
uri=\"http://richfaces.org/rich\"
prefix=\"rich\" %>\n" +
+ "<html>\n" +
+ " <head>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <rich:inplaceInput defaultLabel=\"" + defaultLabel+
"\"/>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>");
+ }
+
+ @Override
+ protected void verifyTag() {
+ assertVisualEditorContains(jspWebBrowser,
+ "SPAN",
+ new
String[]{"vpe-user-toggle-id","title","class"},
+ new String[]{"false","rich:inplaceInput defaultLabel: " +
defaultLabel,"rich-inplace rich-inplace-view"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContainsNodeWithValue(jspWebBrowser,
+ defaultLabel,
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ // check tag selection
+ jspWebBrowser.selectDomNode(jspWebBrowser.getDomNodeByTagName("SPAN",2),
0);
+ bot.sleep(Timing.time3S());
+ String selectedText = jspEditor.getSelection();
+ final String expectedSelectedText = "<rich:inplaceInput
defaultLabel=\"" + defaultLabel+ "\"/>";
+ assertTrue("Selected text in Source Pane has to be '" +
expectedSelectedText + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().equals(expectedSelectedText));
+
jspWebBrowser.mouseClickOnNode(jspWebBrowser.getDomNodeByTagName("SPAN",2));
+ bot.sleep(Timing.time3S());
+ selectedText = jspEditor.getSelection();
+ assertVisualEditorContains(jspWebBrowser,
+ "SPAN",
+ new String[]{"vpe-user-toggle-id","class"},
+ new String[]{"true","rich-inplace rich-inplace-edit"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContains(jspWebBrowser,
+ "INPUT",
+ new String[]{"type","class","value"},
+ new String[]{"text","rich-inplace-field",defaultLabel},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertTrue("Selected text in Source Pane has to be '" +
expectedSelectedText + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().equals(expectedSelectedText));
+
+ }
+
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/InplaceInputTagTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/InplaceSelectInputTagTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/InplaceSelectInputTagTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/InplaceSelectInputTagTest.java 2011-02-22
09:15:40 UTC (rev 29260)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+
+ * Copyright (c) 2007-2011 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.bot.test.editor.tags;
+
+import org.jboss.tools.ui.bot.ext.Timing;
+
+/**
+ * Tests Rich Faces InplaceSelectInput Tag behavior
+ * @author vlado pakan
+ *
+ */
+public class InplaceSelectInputTagTest extends RichFacesTagsTest{
+ private static final String defaultLabel = "DefaultLabel";
+ private static final String option1 = "Option 1";
+ private static final String option2 = "Option 2";
+ @Override
+ protected void initPageContent() {
+ jspEditor.setText("<%@ taglib
uri=\"http://java.sun.com/jsf/html\"
prefix=\"h\" %>\n" +
+ "<%@ taglib
uri=\"http://java.sun.com/jsf/core\"
prefix=\"f\" %>\n" +
+ "<%@ taglib
uri=\"http://richfaces.org/rich\"
prefix=\"rich\" %>\n" +
+ "<html>\n" +
+ " <head>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <rich:inplaceSelect value=\"0\"
defaultLabel=\"" + defaultLabel + "\">\n"+
+ " <f:selectItem itemValue=\"0\" itemLabel=\""
+ option1 +"\" />\n" +
+ " <f:selectItem itemValue=\"1\" itemLabel=\""
+ option2 +"\" />\n" +
+ " </rich:inplaceSelect>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>");
+ }
+
+ @Override
+ protected void verifyTag() {
+ assertVisualEditorContains(jspWebBrowser,
+ "SPAN",
+ new
String[]{"vpe-user-toggle-id","title","class"},
+ new String[]{"false","rich:inplaceSelect value: 0 defaultLabel:
" + defaultLabel,"rich-inplace-select rich-inplace-select-view"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContainsNodeWithValue(jspWebBrowser,
+ defaultLabel,
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ // check tag selection
+ jspWebBrowser.selectDomNode(jspWebBrowser.getDomNodeByTagName("SPAN",2),
0);
+ bot.sleep(Timing.time3S());
+ String selectedText = jspEditor.getSelection();
+ final String hasToStartWith = "<rich:inplaceSelect value=\"0\"
defaultLabel=\"" + defaultLabel + "\">";
+ assertTrue("Selected text in Source Pane has to start with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().startsWith(hasToStartWith));
+ final String hasEndWith = "</rich:inplaceSelect>";
+ assertTrue("Selected text in Source Pane has to end with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().endsWith(hasEndWith));
+ // Click on tag and check correct tag displaying
+
jspWebBrowser.mouseClickOnNode(jspWebBrowser.getDomNodeByTagName("SPAN",2));
+ bot.sleep(Timing.time3S());
+ assertVisualEditorContains(jspWebBrowser,
+ "SPAN",
+ new String[]{"vpe-user-toggle-id","class"},
+ new String[]{"true","rich-inplace-select
rich-inplace-select-edit"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContainsNodeWithValue(jspWebBrowser,
+ option1,
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorContainsNodeWithValue(jspWebBrowser,
+ option2,
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ assertVisualEditorNotContainNodeWithValue(jspWebBrowser,
+ defaultLabel,
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ selectedText = jspEditor.getSelection();
+ // check tag selection
+ assertTrue("Selected text in Source Pane has to start with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().startsWith(hasToStartWith));
+ assertTrue("Selected text in Source Pane has to end with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().endsWith(hasEndWith));
+ }
+
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/InplaceSelectInputTagTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/PickListTagTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/PickListTagTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/PickListTagTest.java 2011-02-22
09:15:40 UTC (rev 29260)
@@ -0,0 +1,151 @@
+/*******************************************************************************
+
+ * Copyright (c) 2007-2011 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.bot.test.editor.tags;
+
+import org.jboss.tools.ui.bot.ext.Timing;
+
+/**
+ * Tests Rich Faces Pick List Tag behavior
+ * @author vlado pakan
+ *
+ */
+public class PickListTagTest extends RichFacesTagsTest{
+ private static final String[] options = new String[]
{"Option0","Option1","Option2","Option3"};
+
+ @Override
+ protected void initPageContent() {
+ StringBuffer sbOptions = new StringBuffer("");
+ int index = 0;
+ for (String option : options){
+ sbOptions.append(" <f:selectItem itemLabel=\"");
+ sbOptions.append(option);
+ sbOptions.append("\" itemValue=\"");
+ sbOptions.append(index);
+ sbOptions.append("\" id=\"");
+ sbOptions.append("id" + index);
+ sbOptions.append("\"/>\n");
+ index++;
+ }
+ xhtmlEditor.setText("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
+ "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"\n"
+
+ "
xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n" +
+ "
xmlns:f=\"http://java.sun.com/jsf/core\"\n" +
+ "
xmlns:rich=\"http://richfaces.org/rich\"\n" +
+ "
xmlns:a4j=\"http://richfaces.org/a4j\">\n" +
+ "<html>\n" +
+ " <head>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <rich:pickList value=\"\">\n" +
+ sbOptions.toString() +
+ " </rich:pickList>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>\n" +
+ "</ui:composition>");
+ }
+
+ @Override
+ protected void verifyTag() {
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ "Copy all",
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ "Copy",
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ "Remove All",
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ "Remove",
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TABLE",
+ new String[]{"class"},
+ new String[]{"rich-list-picklist"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TABLE",
+ new String[]{"class"},
+ new String[]{"rich-picklist-body"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TABLE",
+ new String[]{"class"},
+ new String[]{"rich-picklist-internal-tab"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TBODY",
+ null,
+ null,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ int index = 0;
+ for (String option : options ){
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ option,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ StringBuffer sbTitle = new StringBuffer("");
+ sbTitle.append("f:selectItem itemLabel: ");
+ sbTitle.append(option);
+ sbTitle.append(" itemValue: ");
+ sbTitle.append(index);
+ sbTitle.append(" id: id");
+ sbTitle.append(index);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "OPTION",
+ new String[]{"title"},
+ new String[]{sbTitle.toString()},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ index++;
+ }
+ // check tag selection
+
xhtmlWebBrowser.selectDomNode(xhtmlWebBrowser.getDomNodeByTagName("TABLE",1),
0);
+ bot.sleep(Timing.time3S());
+ String selectedText = xhtmlEditor.getSelection();
+ String hasToStartWith = "<rich:pickList value=\"\">";
+ assertTrue("Selected text in Source Pane has to start with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().startsWith(hasToStartWith));
+ String hasEndWith = "</rich:pickList>";
+ assertTrue("Selected text in Source Pane has to end with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().endsWith(hasEndWith));
+ // select first item in VPE
+
xhtmlWebBrowser.selectDomNode(xhtmlWebBrowser.getDomNodeByTagName("OPTION",0),
0);
+ bot.sleep(Timing.time3S());
+ String currentLineText = xhtmlEditor.getTextOnCurrentLine();
+ StringBuffer sbOption = new StringBuffer("");
+ sbOption.append("<f:selectItem itemLabel=\"");
+ sbOption.append(options[0]);
+ sbOption.append("\" itemValue=\"0\"
id=\"id0\"/>");
+ assertTrue("Current Line text in Source Pane has to be '" +
sbOption.toString() + "'" +
+ "\nbut it is '" + currentLineText + "'",
+ currentLineText.trim().equals(sbOption.toString()));
+ // select second item in Source Editor
+ xhtmlEditor.setFocus();
+ xhtmlEditor.selectRange(xhtmlEditor.cursorPosition().line +
1,xhtmlEditor.cursorPosition().column,0);
+ bot.sleep(Timing.time3S());
+ xhtmlWebBrowser.setFocus();
+ bot.sleep(Timing.time3S());
+ StringBuffer sbOptionTitle = new StringBuffer("");
+ sbOptionTitle.append("f:selectItem itemLabel: ");
+ sbOptionTitle.append(options[1]);
+ sbOptionTitle.append(" itemValue: 1 id: id1");
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "OPTION",
+ new String[]{"title","style"},
+ new String[]{sbOptionTitle.toString(),"border: 2px solid rgb(0, 0, 255) !
important;"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ }
+
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/PickListTagTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ProgressTagTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ProgressTagTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ProgressTagTest.java 2011-02-22
09:15:40 UTC (rev 29260)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+
+ * Copyright (c) 2007-2011 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.bot.test.editor.tags;
+
+import org.jboss.tools.ui.bot.ext.Timing;
+
+/**
+ * Tests Rich Faces Progress Tag behavior
+ * @author vlado pakan
+ *
+ */
+public class ProgressTagTest extends RichFacesTagsTest{
+ @Override
+ protected void initPageContent() {
+ jspEditor.setText("<%@ taglib
uri=\"http://java.sun.com/jsf/html\"
prefix=\"h\" %>\n" +
+ "<%@ taglib
uri=\"http://java.sun.com/jsf/core\"
prefix=\"f\" %>\n" +
+ "<%@ taglib
uri=\"http://richfaces.org/rich\"
prefix=\"rich\" %>\n" +
+ "<html>\n" +
+ " <head>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <rich:progressBar mode=\"client\"
id=\"progressBar\">\n" +
+ " </rich:progressBar>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>");
+ }
+
+ @Override
+ protected void verifyTag() {
+ assertVisualEditorContains(jspWebBrowser,
+ "DIV",
+ new String[]{"title","class"},
+ new String[]{"rich:progressBar mode: client id:
progressBar","rich-progress-bar-block rich-progress-bar-width
rich-progress-bar-shell"},
+ RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ // check tag selection
+ jspWebBrowser.selectDomNode(jspWebBrowser.getDomNodeByTagName("DIV",4),
0);
+ bot.sleep(Timing.time3S());
+ String selectedText = jspEditor.getSelection();
+ final String hasToStartWith = "<rich:progressBar";
+ assertTrue("Selected text in Source Pane has to start with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().startsWith(hasToStartWith));
+ final String hasEndWith = "</rich:progressBar>";
+ assertTrue("Selected text in Source Pane has to end with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().endsWith(hasEndWith));
+ }
+
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ProgressTagTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/RichFacesTagsTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/RichFacesTagsTest.java 2011-02-21
22:22:27 UTC (rev 29259)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/RichFacesTagsTest.java 2011-02-22
09:15:40 UTC (rev 29260)
@@ -21,13 +21,16 @@
* @author vlado pakan
*
*/
-public class RichFacesTagsTest extends VPEEditorTestCase {
+public abstract class RichFacesTagsTest extends VPEEditorTestCase {
- private static final String TEST_PAGE_NAME = "RichFacesTagsTest.jsp";
+ protected static final String TEST_PAGE_NAME_JSP = "RichFacesTagsTest.jsp";
+ protected static final String TEST_PAGE_NAME_XHTML =
"RichFacesTagsTest.xhtml";
- private SWTBotEditorExt jspEditor;
- private SWTBotWebBrowser webBrowser;
- private SWTBotExt botExt;
+ protected SWTBotEditorExt jspEditor;
+ protected SWTBotEditorExt xhtmlEditor;
+ protected SWTBotWebBrowser jspWebBrowser;
+ protected SWTBotWebBrowser xhtmlWebBrowser;
+ protected SWTBotExt botExt;
public RichFacesTagsTest() {
super();
@@ -37,9 +40,13 @@
protected void setUp() throws Exception {
super.setUp();
eclipse.maximizeActiveShell();
- createJspPage(RichFacesTagsTest.TEST_PAGE_NAME);
- jspEditor = botExt.swtBotEditorExtByTitle(RichFacesTagsTest.TEST_PAGE_NAME);
- webBrowser = new SWTBotWebBrowser(RichFacesTagsTest.TEST_PAGE_NAME,botExt);
+ createJspPage(RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ jspEditor = botExt.swtBotEditorExtByTitle(RichFacesTagsTest.TEST_PAGE_NAME_JSP);
+ jspWebBrowser = new SWTBotWebBrowser(RichFacesTagsTest.TEST_PAGE_NAME_JSP,botExt);
+ createXhtmlPage(RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ xhtmlEditor = botExt.swtBotEditorExtByTitle(RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ xhtmlWebBrowser = new
SWTBotWebBrowser(RichFacesTagsTest.TEST_PAGE_NAME_XHTML,botExt);
+
}
@Override
@@ -54,117 +61,42 @@
@Override
protected void tearDown() throws Exception {
jspEditor.close();
+ xhtmlEditor.close();
super.tearDown();
}
/**
- * Tests rich:comboBox Tag
+ * Runs Tag Testing
*/
- public void testComboBoxTag(){
- final String defaultLabel = "DefaultLabel";
- jspEditor.setText("<%@ taglib
uri=\"http://java.sun.com/jsf/html\"
prefix=\"h\" %>\n" +
- "<%@ taglib
uri=\"http://java.sun.com/jsf/core\"
prefix=\"f\" %>\n" +
- "<%@ taglib
uri=\"http://richfaces.org/rich\"
prefix=\"rich\" %>\n" +
- "<html>\n" +
- " <head>\n" +
- " </head>\n" +
- " <body>\n" +
- " <f:view>\n" +
- " <h:form>\n" +
- " <rich:comboBox id=\"comboBox\"
defaultLabel=\"" + defaultLabel + "\">\n" +
- " <f:selectItem itemValue=\"item 1\"/>\n" +
- " <f:selectItem itemValue=\"item 2\"/>\n" +
- " </rich:comboBox>\n" +
- " </h:form>\n" +
- " </f:view>\n" +
- " </body>\n" +
- "</html>");
- jspEditor.save();
- bot.sleep(Timing.time3S());
- assertVisualEditorContains(webBrowser,
- "INPUT",
- new String[]{"type","class","value"},
- new String[]{"text","rich-combobox-font-disabled
rich-combobox-input-inactive",defaultLabel},
- RichFacesTagsTest.TEST_PAGE_NAME);
- assertVisualEditorContains(webBrowser,
- "INPUT",
- new String[]{"type","class"},
- new String[]{"text","rich-combobox-font-inactive
rich-combobox-button-background rich-combobox-button-inactive"},
- RichFacesTagsTest.TEST_PAGE_NAME);
- assertVisualEditorContains(webBrowser,
- "INPUT",
- new String[]{"type","class"},
- new String[]{"text","rich-combobox-font-inactive
rich-combobox-button-icon-inactive rich-combobox-button-inactive"},
- RichFacesTagsTest.TEST_PAGE_NAME);
- assertVisualEditorContains(webBrowser,
- "DIV",
- new String[]{"class"},
- new String[]{"rich-combobox-strut rich-combobox-font"},
- RichFacesTagsTest.TEST_PAGE_NAME);
- // check tag selection
- webBrowser.selectDomNode(webBrowser.getDomNodeByTagName("INPUT"), 0);
- bot.sleep(Timing.time3S());
- String selectedText = jspEditor.getSelection();
- final String hasToStartWith = "<rich:comboBox";
- assertTrue("Selected text in Source Pane has to start with '" +
hasToStartWith + "'" +
- "\nbut it is '" + selectedText + "'",
- selectedText.trim().startsWith(hasToStartWith));
- final String hasToEndWith = "</rich:comboBox>";
- assertTrue("Selected text in Source Pane has to end with '" +
hasToEndWith + "'" +
- "\nbut it is '" + selectedText + "'",
- selectedText.trim().endsWith(hasToEndWith));
-
+ public void testTag (){
+ initPageContent ();
+ savePageContent ();
+ verifyTag();
}
/**
- * Tests rich:comboBox Tag
+ * Initialize proper page content
*/
- public void testInplaceInputTag(){
- final String defaultLabel = "DefaultLabel";
- jspEditor.setText("<%@ taglib
uri=\"http://java.sun.com/jsf/html\"
prefix=\"h\" %>\n" +
- "<%@ taglib
uri=\"http://java.sun.com/jsf/core\"
prefix=\"f\" %>\n" +
- "<%@ taglib
uri=\"http://richfaces.org/rich\"
prefix=\"rich\" %>\n" +
- "<html>\n" +
- " <head>\n" +
- " </head>\n" +
- " <body>\n" +
- " <f:view>\n" +
- " <rich:inplaceInput defaultLabel=\"" + defaultLabel+
"\"/>\n" +
- " </f:view>\n" +
- " </body>\n" +
- "</html>");
- jspEditor.save();
- bot.sleep(Timing.time3S());
- assertVisualEditorContains(webBrowser,
- "SPAN",
- new String[]{"vpe-user-toggle-id","title","class"},
- new String[]{"false","rich:inplaceInput defaultLabel:
DefaultLabel","rich-inplace rich-inplace-view"},
- RichFacesTagsTest.TEST_PAGE_NAME);
- assertVisualEditorContainsNodeWithValue(webBrowser,
- defaultLabel,
- RichFacesTagsTest.TEST_PAGE_NAME);
- // check tag selection
- webBrowser.selectDomNode(webBrowser.getDomNodeByTagName("SPAN",2), 0);
- bot.sleep(Timing.time3S());
- String selectedText = jspEditor.getSelection();
- final String expectedSelectedText = "<rich:inplaceInput
defaultLabel=\"" + defaultLabel+ "\"/>";
- assertTrue("Selected text in Source Pane has to be '" +
expectedSelectedText + "'" +
- "\nbut it is '" + selectedText + "'",
- selectedText.trim().equals(expectedSelectedText));
- webBrowser.mouseClickOnNode(webBrowser.getDomNodeByTagName("SPAN",2));
- bot.sleep(Timing.time3S());
- selectedText = jspEditor.getSelection();
- assertVisualEditorContains(webBrowser,
- "SPAN",
- new String[]{"vpe-user-toggle-id","class"},
- new String[]{"true","rich-inplace rich-inplace-edit"},
- RichFacesTagsTest.TEST_PAGE_NAME);
- assertVisualEditorContains(webBrowser,
- "INPUT",
- new String[]{"type","class","value"},
- new String[]{"text","rich-inplace-field",defaultLabel},
- RichFacesTagsTest.TEST_PAGE_NAME);
- assertTrue("Selected text in Source Pane has to be '" +
expectedSelectedText + "'" +
- "\nbut it is '" + selectedText + "'",
- selectedText.trim().equals(expectedSelectedText));
-
+ protected abstract void initPageContent ();
+ /**
+ * Verify tag
+ */
+ protected abstract void verifyTag ();
+ /**
+ * Saves Page Content if it was changed and shows changed editor
+ */
+ protected void savePageContent(){
+ boolean wasSaved = false;
+ if (jspEditor.isDirty()){
+ jspEditor.save();
+ jspEditor.show();
+ wasSaved = true;
+ }
+ if (xhtmlEditor.isDirty()){
+ xhtmlEditor.save();
+ xhtmlEditor.show();
+ wasSaved = true;
+ }
+ if (wasSaved){
+ bot.sleep(Timing.time3S());
+ }
}
}