Author: vpakan(a)redhat.com
Date: 2011-04-05 12:08:42 -0400 (Tue, 05 Apr 2011)
New Revision: 30321
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ActionParamTagTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/AjaxValidatorTagTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/BeanValidatorTagTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ColumnGroupTagTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/DataGridTagTest.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/tools/SWTBotWebBrowser.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-04-05
15:14:04 UTC (rev 30320)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2011-04-05
16:08:42 UTC (rev 30321)
@@ -33,12 +33,17 @@
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.ActionParamTagTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.tags.AjaxValidatorTagTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.tags.BeanValidatorTagTest;
import org.jboss.tools.vpe.ui.bot.test.editor.tags.CalendarTagTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.tags.ColumnGroupTagTest;
import org.jboss.tools.vpe.ui.bot.test.editor.tags.ColumnTagTest;
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.DataDefinitionTagTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.tags.DataGridTagTest;
import org.jboss.tools.vpe.ui.bot.test.editor.tags.DataScrollerTagTest;
import org.jboss.tools.vpe.ui.bot.test.editor.tags.DataTableTagTest;
import org.jboss.tools.vpe.ui.bot.test.editor.tags.EditorTagTest;
@@ -72,6 +77,7 @@
public class VPEAllBotTests extends SWTBotTestCase{
public static Test suite(){
TestSuite suite = new TestSuite("VPE All Tests"); //$NON-NLS-1$
+/*
suite.addTestSuite(VisualEditorContextMenuTest.class);
suite.addTestSuite(EditingActionsTest.class);
suite.addTestSuite(NewXHTMLPageWizardTest.class);
@@ -135,7 +141,12 @@
suite.addTestSuite(SpacerTagTest.class);
suite.addTestSuite(DataScrollerTagTest.class);
suite.addTestSuite(ColumnTagTest.class);
- suite.addTestSuite(XhtmlFilePerformanceTest.class);
+ suite.addTestSuite(ActionParamTagTest.class);
+ suite.addTestSuite(AjaxValidatorTagTest.class);
+ suite.addTestSuite(BeanValidatorTagTest.class);
+ suite.addTestSuite(ColumnGroupTagTest.class);
+*/ suite.addTestSuite(DataGridTagTest.class);
+// suite.addTestSuite(XhtmlFilePerformanceTest.class);
return new TestSetup(suite);
}
}
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ActionParamTagTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ActionParamTagTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ActionParamTagTest.java 2011-04-05
16:08:42 UTC (rev 30321)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+
+ * 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;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
+import org.mozilla.interfaces.nsIDOMNode;
+
+/**
+ * Tests Rich Faces DataTable Tag behavior
+ * @author vlado pakan
+ *
+ */
+public class ActionParamTagTest extends RichFacesTagsTest{
+ @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" +
+ "<html
xmlns=\"http://www.w3.org/1999/xhtml\"\n" +
+ "
xmlns:f=\"http://java.sun.com/jsf/core\"\n" +
+ "
xmlns:a4j=\"http://richfaces.org/a4j\"\n" +
+ "
xmlns:h=\"http://java.sun.com/jsf/html\">\n" +
+ "<head>\n" +
+ "</head>\n" +
+ "<body>\n" +
+ " <f:view>\n" +
+ " <a4j:commandButton value=\"Set Name to Alex\">\n" +
+ " <a4j:actionparam name=\"username\"
value=\"Alex\"/>\n" +
+ " </a4j:commandButton>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>");
+ }
+
+ @Override
+ protected void verifyTag() {
+ // check tag selection
+ xhtmlEditor.selectLine(10);
+ bot.sleep(Timing.time3S());
+ nsIDOMNode selectedVisualNode=xhtmlWebBrowser.getSelectedDomNode();
+ assertNotNull("Selected node in Visual Editor cannot be
null",selectedVisualNode);
+ String expectedSelectedNode = "DIV";
+ assertTrue("Selected Node has to be '" + expectedSelectedNode +
"' node but is " + selectedVisualNode.getLocalName(),
+ selectedVisualNode.getLocalName().equals(expectedSelectedNode));
+ String selectedNodeTitle = SWTBotWebBrowser.getNodeAttribute(selectedVisualNode,
"title");
+ assertNotNull("Selected Node in Visual Editor has to have attribute title but it
has not." ,selectedNodeTitle);
+ final String expectedTitle = "f:view";
+ assertTrue("Selected Node in Visual Editor has to have attribute
title=\"" + expectedTitle +
+ "\" but has \"" + selectedNodeTitle + "\"",
+ expectedTitle.equals(selectedNodeTitle));
+ }
+
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ActionParamTagTest.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/AjaxValidatorTagTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/AjaxValidatorTagTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/AjaxValidatorTagTest.java 2011-04-05
16:08:42 UTC (rev 30321)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+
+ * 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;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
+import org.mozilla.interfaces.nsIDOMNode;
+
+/**
+ * Tests Rich Faces ajaxValidator Tag behavior
+ * @author vlado pakan
+ *
+ */
+public class AjaxValidatorTagTest extends RichFacesTagsTest{
+ private static final String INPUT_TEXT = "!*- Input Text";
+ @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" +
+ "<html
xmlns=\"http://www.w3.org/1999/xhtml\"\n" +
+ "
xmlns:f=\"http://java.sun.com/jsf/core\"\n" +
+ "
xmlns:rich=\"http://richfaces.org/rich\"\n" +
+ "
xmlns:h=\"http://java.sun.com/jsf/html\">\n" +
+ "<head>\n" +
+ "</head>\n" +
+ "<body>\n" +
+ " <f:view>\n" +
+ " <h:inputText value=\"" + AjaxValidatorTagTest.INPUT_TEXT +
"\">\n" +
+ " <f:validateLength minimum=\"3\"
maximum=\"12\"/>\n" +
+ " <rich:ajaxValidator event=\"onblur\"/>\n" +
+ " </h:inputText>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>");
+ }
+
+ @Override
+ protected void verifyTag() {
+ // check tag selection
+ xhtmlEditor.selectLine(11);
+ bot.sleep(Timing.time3S());
+ nsIDOMNode selectedVisualNode=xhtmlWebBrowser.getSelectedDomNode();
+ assertNotNull("Selected node in Visual Editor cannot be
null",selectedVisualNode);
+ String expectedSelectedNode = "SPAN";
+ assertTrue("Selected Node has to be '" + expectedSelectedNode +
"' node but is " + selectedVisualNode.getLocalName(),
+ selectedVisualNode.getLocalName().equals(expectedSelectedNode));
+ String selectedNodeTitle = SWTBotWebBrowser.getNodeAttribute(selectedVisualNode,
"title");
+ assertNotNull("Selected Node in Visual Editor has to have attribute title but it
has not." ,selectedNodeTitle);
+ final String expectedTitle = "h:inputText value: " +
AjaxValidatorTagTest.INPUT_TEXT;
+ assertTrue("Selected Node in Visual Editor has to have attribute
title=\"" + expectedTitle +
+ "\" but has \"" + selectedNodeTitle + "\"",
+ expectedTitle.equals(selectedNodeTitle));
+ }
+
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/AjaxValidatorTagTest.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/BeanValidatorTagTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/BeanValidatorTagTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/BeanValidatorTagTest.java 2011-04-05
16:08:42 UTC (rev 30321)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+
+ * 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;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
+import org.mozilla.interfaces.nsIDOMNode;
+
+/**
+ * Tests Rich Faces beanValidator Tag behavior
+ * @author vlado pakan
+ *
+ */
+public class BeanValidatorTagTest extends RichFacesTagsTest{
+ private static final String INPUT_TEXT = "!*- Input Text";
+ @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" +
+ "<html
xmlns=\"http://www.w3.org/1999/xhtml\"\n" +
+ "
xmlns:f=\"http://java.sun.com/jsf/core\"\n" +
+ "
xmlns:rich=\"http://richfaces.org/rich\"\n" +
+ "
xmlns:h=\"http://java.sun.com/jsf/html\">\n" +
+ "<head>\n" +
+ "</head>\n" +
+ "<body>\n" +
+ " <f:view>\n" +
+ " <h:inputText value=\"" + BeanValidatorTagTest.INPUT_TEXT +
"\">\n" +
+ " <rich:beanValidator summary=\"Invalid value\"/>\n"
+
+ " </h:inputText>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>");
+ }
+
+ @Override
+ protected void verifyTag() {
+ // check tag selection
+ xhtmlEditor.selectLine(10);
+ bot.sleep(Timing.time3S());
+ nsIDOMNode selectedVisualNode=xhtmlWebBrowser.getSelectedDomNode();
+ assertNotNull("Selected node in Visual Editor cannot be
null",selectedVisualNode);
+ String expectedSelectedNode = "SPAN";
+ assertTrue("Selected Node has to be '" + expectedSelectedNode +
"' node but is " + selectedVisualNode.getLocalName(),
+ selectedVisualNode.getLocalName().equals(expectedSelectedNode));
+ String selectedNodeTitle = SWTBotWebBrowser.getNodeAttribute(selectedVisualNode,
"title");
+ assertNotNull("Selected Node in Visual Editor has to have attribute title but it
has not." ,selectedNodeTitle);
+ final String expectedTitle = "h:inputText value: " +
BeanValidatorTagTest.INPUT_TEXT;
+ assertTrue("Selected Node in Visual Editor has to have attribute
title=\"" + expectedTitle +
+ "\" but has \"" + selectedNodeTitle + "\"",
+ expectedTitle.equals(selectedNodeTitle));
+ }
+
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/BeanValidatorTagTest.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/ColumnGroupTagTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ColumnGroupTagTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/ColumnGroupTagTest.java 2011-04-05
16:08:42 UTC (rev 30321)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+
+ * 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 columnGroup Tag behavior
+ * @author vlado pakan
+ *
+ */
+public class ColumnGroupTagTest extends RichFacesTagsTest{
+ private static final String SPAN_COLUMN_VALUE = "!-*Span Column Value";
+ private static final String SPAN_ROW__VALUE = "!-*Span Row Value";
+ private static final String CELL_1_0_VALUE = "!-* Cell 1x0 Value";
+ private static final String CELL_1_1_VALUE = "!-* Cell 1x1 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" +
+ "<html
xmlns=\"http://www.w3.org/1999/xhtml\"\n" +
+ "
xmlns:f=\"http://java.sun.com/jsf/core\"\n" +
+ "
xmlns:rich=\"http://richfaces.org/rich\"\n" +
+ "
xmlns:h=\"http://java.sun.com/jsf/html\">\n" +
+ " <head>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <rich:columnGroup>\n" +
+ " <rich:column rowspan=\"2\">\n" +
+ " <h:outputText value=\"" +
ColumnGroupTagTest.SPAN_ROW__VALUE + "\" />\n" +
+ " </rich:column>\n" +
+ " <rich:column colspan=\"2\">\n" +
+ " <h:outputText value=\"" +
ColumnGroupTagTest.SPAN_COLUMN_VALUE + "\" />\n" +
+ " </rich:column>\n" +
+ " <rich:column breakBefore=\"true\">\n" +
+ " <h:outputText value=\"" +
ColumnGroupTagTest.CELL_1_0_VALUE + "\" />\n" +
+ " </rich:column>\n" +
+ " <rich:column>\n" +
+ " <h:outputText value=\"" +
ColumnGroupTagTest.CELL_1_1_VALUE + "\" />\n" +
+ " </rich:column>\n" +
+ " </rich:columnGroup>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>");
+ }
+
+ @Override
+ protected void verifyTag() {
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TD",
+ new String[]{"class","rowspan"},
+ new String[]{"dr-table-cell rich-table-cell
dr-subtable-cell","2"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TD",
+ new String[]{"class","colspan"},
+ new String[]{"dr-table-cell rich-table-cell
dr-subtable-cell","2"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TD",
+ new String[]{"class","breakbefore"},
+ new String[]{"dr-table-cell rich-table-cell
dr-subtable-cell","true"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ ColumnGroupTagTest.SPAN_COLUMN_VALUE,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ ColumnGroupTagTest.SPAN_ROW__VALUE,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ ColumnGroupTagTest.CELL_1_0_VALUE,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ ColumnGroupTagTest.CELL_1_1_VALUE,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ // check tag selection
+
xhtmlWebBrowser.selectDomNode(xhtmlWebBrowser.getDomNodeByTagName("TBODY",0),
0);
+ bot.sleep(Timing.time3S());
+ String selectedText = xhtmlEditor.getSelection();
+ String hasToStartWith = "<rich:columnGroup>";
+ assertTrue("Selected text in Source Pane has to start with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().startsWith(hasToStartWith));
+ String hasEndWith = "</rich:columnGroup>";
+ assertTrue("Selected text in Source Pane has to end with '" +
hasEndWith + "'" +
+ "\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/ColumnGroupTagTest.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/DataGridTagTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/DataGridTagTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/tags/DataGridTagTest.java 2011-04-05
16:08:42 UTC (rev 30321)
@@ -0,0 +1,132 @@
+/*******************************************************************************
+
+ * 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 DataTable Tag behavior
+ * @author vlado pakan
+ *
+ */
+public class DataGridTagTest extends RichFacesTagsTest{
+ private static final String HEADER_VALUE = "!-*Header Value";
+ private static final String FOOTER_VALUE = "!-*Footer Value";
+ private static final String CELL_0_VALUE = "!-*Cell 0 Value";
+ private static final String CELL_1_VALUE = "!-*Cell 1 Value";
+ private static final String GRID_COLUMNS = "3";
+ private static final String GRID_ELEMENTS = "6";
+ @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" +
+ "<html
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:h=\"http://java.sun.com/jsf/html\">\n" +
+ " <head>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <rich:dataGrid columns=\"" + DataGridTagTest.GRID_COLUMNS
+ "\" elements=\"" + DataGridTagTest.GRID_ELEMENTS +
"\">\n" +
+ " <f:facet name=\"header\">\n" +
+ " <h:outputText value=\"" + DataGridTagTest.HEADER_VALUE
+ "\" />\n" +
+ " </f:facet>\n" +
+ " <h:outputText value=\"" + DataGridTagTest.CELL_0_VALUE +
"\"/>\n" +
+ " <h:outputText value=\"" + DataGridTagTest.CELL_1_VALUE +
"\"/>\n" +
+ " <f:facet name=\"footer\">\n" +
+ " <h:outputText value=\"" + DataGridTagTest.FOOTER_VALUE
+ "\" />\n" +
+ " </f:facet>\n" +
+ " </rich:dataGrid>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>");
+ }
+
+ @Override
+ protected void verifyTag() {
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TABLE",
+ new String[]{"class","columns","elements"},
+ new String[]{"dr-table
rich-table",DataGridTagTest.GRID_COLUMNS,DataGridTagTest.GRID_ELEMENTS},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "THEAD",
+ null,
+ null,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TFOOT",
+ null,
+ null,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TR",
+ new String[]{"class"},
+ new String[]{"dr-table-header rich-table-header"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TD",
+ new String[]{"class"},
+ new String[]{"dr-table-headercell rich-table-headercell"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TR",
+ new String[]{"class"},
+ new String[]{"dr-table-footer rich-table-footer"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TD",
+ new String[]{"class"},
+ new String[]{"dr-table-footercell rich-table-footercell"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TR",
+ new String[]{"class"},
+ new String[]{"dr-table-row rich-table-row"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContains(xhtmlWebBrowser,
+ "TD",
+ new String[]{"class"},
+ new String[]{"dr-table-cell rich-table-cell"},
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContainsManyNodes(xhtmlWebBrowser,
+ "SPAN",
+ 2 + (2 * Integer.parseInt(DataGridTagTest.GRID_ELEMENTS)),
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ DataGridTagTest.HEADER_VALUE,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ DataGridTagTest.FOOTER_VALUE,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ DataGridTagTest.CELL_0_VALUE,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ assertVisualEditorContainsNodeWithValue(xhtmlWebBrowser,
+ DataGridTagTest.CELL_1_VALUE,
+ RichFacesTagsTest.TEST_PAGE_NAME_XHTML);
+ // check tag selection
+
xhtmlWebBrowser.selectDomNode(xhtmlWebBrowser.getDomNodeByTagName("THEAD",0),
0);
+ bot.sleep(Timing.time3S());
+ String selectedText = xhtmlEditor.getSelection();
+ String hasToStartWith = "<rich:dataGrid";
+ assertTrue("Selected text in Source Pane has to start with '" +
hasToStartWith + "'" +
+ "\nbut it is '" + selectedText + "'",
+ selectedText.trim().startsWith(hasToStartWith));
+ String hasEndWith = "</rich:dataGrid>";
+ assertTrue("Selected text in Source Pane has to end with '" +
hasEndWith + "'" +
+ "\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/DataGridTagTest.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/tools/SWTBotWebBrowser.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java 2011-04-05
15:14:04 UTC (rev 30320)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java 2011-04-05
16:08:42 UTC (rev 30321)
@@ -914,5 +914,23 @@
int arg13, nsIDOMEventTarget arg14) {
}
}
-
+ /**
+ * Returns node attribute attributeName value or null when node doesn't have
attribute with attributeName
+ * @param node
+ * @param attributeName
+ * @return
+ */
+ public static String getNodeAttribute (nsIDOMNode node , String attributeName){
+ String result = null;
+ nsIDOMNamedNodeMap attrs = node.getAttributes();
+ int index = 0;
+ while (result == null && index < attrs.getLength()){
+ nsIDOMNode modelAttr = attrs.item(index);
+ if (modelAttr.getNodeName().equals(attributeName)){
+ result = modelAttr.getNodeValue().replaceAll("\n", " ");
+ }
+ index++;
+ }
+ return result;
+ }
}