Author: lfryc(a)redhat.com
Date: 2011-02-02 11:01:36 -0500 (Wed, 02 Feb 2011)
New Revision: 21394
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TestTreeNodeSimple.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TreeNodeAttributes.java
Removed:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TreeNodeAttributes.java
Modified:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTreeBean.properties
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTreeNodeBean.properties
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSimple.java
Log:
rich:treeNode - automate test case (RFPL-1052)
Modified:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTreeBean.properties
===================================================================
---
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTreeBean.properties 2011-02-02
15:55:57 UTC (rev 21393)
+++
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTreeBean.properties 2011-02-02
16:01:36 UTC (rev 21394)
@@ -1,5 +1,5 @@
-attr.dir.rtl=RTL
-attr.dir.ltr=LTR
+attr.dir.rtl=rtl
+attr.dir.ltr=ltr
attr.dir.null=
attr.selectionType.client=client
attr.selectionType.ajax=ajax
Modified:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTreeNodeBean.properties
===================================================================
---
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTreeNodeBean.properties 2011-02-02
15:55:57 UTC (rev 21393)
+++
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTreeNodeBean.properties 2011-02-02
16:01:36 UTC (rev 21394)
@@ -1,5 +1,5 @@
-attr.dir.rtl=RTL
-attr.dir.ltr=LTR
+attr.dir.rtl=rtl
+attr.dir.ltr=ltr
attr.dir.null=
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java 2011-02-02
15:55:57 UTC (rev 21393)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java 2011-02-02
16:01:36 UTC (rev 21394)
@@ -58,6 +58,10 @@
public <T extends ExtendedLocator<JQueryLocator>>
AbstractComponentAttributes(T root) {
this.root.setLocator(root);
}
+
+ public ExtendedLocator<JQueryLocator> getRoot() {
+ return root.getLocator();
+ }
protected String getProperty(String propertyName) {
final ElementLocator<?> locator = propertyLocator.format(propertyName,
"");
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2011-02-02
15:55:57 UTC (rev 21393)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2011-02-02
16:01:36 UTC (rev 21394)
@@ -31,6 +31,7 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import static org.jboss.test.selenium.locator.reference.ReferencedLocator.ref;
import java.net.URL;
import java.util.Locale;
@@ -49,6 +50,8 @@
import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.locator.ExtendedLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.locator.reference.LocatorReference;
+import org.jboss.test.selenium.locator.reference.ReferencedLocator;
import org.jboss.test.selenium.waiting.EventFiredCondition;
import org.jboss.test.selenium.waiting.retrievers.Retriever;
import org.jboss.test.selenium.waiting.retrievers.TextRetriever;
@@ -66,7 +69,7 @@
* @version $Revision$
*/
public abstract class AbstractMetamerTest extends AbstractTestCase {
-
+
protected JQueryLocator time = jq("span[id$=requestTime]");
protected JQueryLocator renderChecker = jq("span[id$=renderChecker]");
protected JQueryLocator statusChecker =
jq("span[id$=statusCheckerOutput]");
@@ -75,6 +78,9 @@
protected TextRetriever retrieveRenderChecker =
retrieveText.locator(jq("#renderChecker"));
protected TextRetriever retrieveStatusChecker =
retrieveText.locator(jq("#statusCheckerOutput"));
protected PhaseInfo phaseInfo = new PhaseInfo();
+
+
+ protected LocatorReference<JQueryLocator> attributesRoot = new
LocatorReference<JQueryLocator>(pjq("span[id$=:attributes:panel]"));
/**
* timeout in miliseconds
@@ -214,7 +220,7 @@
* name of the attribute that will be set (e.g. style, headerStyle,
itemContentStyle)
*/
protected void testStyle(ElementLocator<?> element, String attribute) {
- ElementLocator<?> styleInput = pjq("input[id$=" + attribute +
"Input]");
+ ElementLocator<?> styleInput = ref(attributesRoot, "input[id$=" +
attribute + "Input]");
final String value = "background-color: yellow; font-size: 1.5em;";
selenium.type(styleInput, value);
@@ -234,7 +240,7 @@
* name of the attribute that will be set (e.g. styleClass, headerClass,
itemContentClass)
*/
protected void testStyleClass(ExtendedLocator<JQueryLocator> element, String
attribute) {
- ElementLocator<?> classInput = pjq("input[id$=" + attribute +
"Input]");
+ ElementLocator<?> classInput = ref(attributesRoot, "input[id$=" +
attribute + "Input]");
final String styleClass = "metamer-ftest-class";
selenium.type(classInput, styleClass);
@@ -247,7 +253,9 @@
public void testRequestEventsBefore(String... events) {
for (String event : events) {
- selenium.type(pjq(format("input[type=text][id$=on{0}Input]",
event)), format("metamerEvents += \"{0} \"", event));
+ ReferencedLocator<JQueryLocator> input = ref(attributesRoot,
"input[type=text][id$=on{0}Input]");
+ input = input.format(event);
+ selenium.type(input, format("metamerEvents += \"{0} \"",
event));
selenium.waitForPageToLoad();
}
@@ -270,8 +278,9 @@
* locator of tested element
*/
protected void testDir(ElementLocator<?> element) {
- JQueryLocator ltrInput =
pjq("input[type=radio][name$=dirInput][value=ltr],input[type=radio][name$=dirInput][value=LTR]");
- JQueryLocator rtlInput =
pjq("input[type=radio][name$=dirInput][value=rtl],input[type=radio][name$=dirInput][value=RTL]");
+ ElementLocator<?> ltrInput = ref(attributesRoot,
"input[type=radio][name$=dirInput][value=ltr]");
+ ElementLocator<?> rtlInput = ref(attributesRoot,
"input[type=radio][name$=dirInput][value=rtl]");
+
AttributeLocator<?> dirAttribute = element.getAttribute(new
Attribute("dir"));
// dir = null
@@ -324,7 +333,7 @@
* locator of tested element
*/
protected void testTitle(ElementLocator<?> element) {
- JQueryLocator input = pjq("input[type=text][id$=titleInput]");
+ ElementLocator<?> input = ref(attributesRoot,
"input[type=text][id$=titleInput]");
AttributeLocator<?> attribute = element.getAttribute(new
Attribute("title"));
// title = null
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSimple.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSimple.java 2011-02-02
15:55:57 UTC (rev 21393)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSimple.java 2011-02-02
16:01:36 UTC (rev 21394)
@@ -56,6 +56,7 @@
import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.ftest.richTreeNode.TreeNodeAttributes;
import org.testng.annotations.Test;
/**
Deleted:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TreeNodeAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TreeNodeAttributes.java 2011-02-02
15:55:57 UTC (rev 21393)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TreeNodeAttributes.java 2011-02-02
16:01:36 UTC (rev 21394)
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- *******************************************************************************/
-package org.richfaces.tests.metamer.ftest.richTree;
-
-import org.jboss.test.selenium.locator.ExtendedLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
-
-/**
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class TreeNodeAttributes extends AbstractComponentAttributes {
-
- public TreeNodeAttributes() {
- }
-
- public <T extends ExtendedLocator<JQueryLocator>> TreeNodeAttributes(T
root) {
- super(root);
- }
-
- public void setDir(String dir) {
- setProperty("dir", dir);
- }
-
- public void setIconCollapsed(String iconCollapsed) {
- setProperty("iconCollapsed", iconCollapsed);
- }
-
- public void setIconExpanded(String iconExpanded) {
- setProperty("iconExpanded", iconExpanded);
- }
-
- public void setIconLeaf(String iconLeaf) {
- setProperty("iconLeaf", iconLeaf);
- }
-
- public void setImmediate(Boolean immediate) {
- setProperty("immediate", immediate);
- }
-
- public void setLang(String lang) {
- setProperty("lang", lang);
- }
-
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
-
- public void setTitle(String title) {
- setProperty("title", title);
- }
-}
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TestTreeNodeSimple.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TestTreeNodeSimple.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TestTreeNodeSimple.java 2011-02-02
16:01:36 UTC (rev 21394)
@@ -0,0 +1,297 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richTreeNode;
+
+import static org.jboss.test.selenium.JQuerySelectors.append;
+import static org.jboss.test.selenium.JQuerySelectors.not;
+import static org.jboss.test.selenium.dom.Event.CLICK;
+import static org.jboss.test.selenium.dom.Event.DBLCLICK;
+import static org.jboss.test.selenium.dom.Event.KEYDOWN;
+import static org.jboss.test.selenium.dom.Event.KEYPRESS;
+import static org.jboss.test.selenium.dom.Event.KEYUP;
+import static org.jboss.test.selenium.dom.Event.MOUSEDOWN;
+import static org.jboss.test.selenium.dom.Event.MOUSEMOVE;
+import static org.jboss.test.selenium.dom.Event.MOUSEOUT;
+import static org.jboss.test.selenium.dom.Event.MOUSEOVER;
+import static org.jboss.test.selenium.dom.Event.MOUSEUP;
+import static org.jboss.test.selenium.locator.Attribute.SRC;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import javax.faces.event.PhaseId;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.geometry.Point;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.waiting.EventFiredCondition;
+import org.jboss.test.selenium.waiting.retrievers.AttributeRetriever;
+import org.richfaces.component.SwitchType;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.ftest.richTree.TreeAttributes;
+import org.richfaces.tests.metamer.ftest.richTree.TreeModel;
+import org.richfaces.tests.metamer.ftest.richTree.TreeNodeModel;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestTreeNodeSimple extends AbstractMetamerTest {
+
+ private static final String SAMPLE_CLASS = "sample-class";
+ private static final String JQ_SAMPLE_CLASS = "[sample-class]";
+ private static final String IMAGE_URL = "/resources/images/loading.gif";
+
+ TreeAttributes attributesTree = new
TreeAttributes(jq("span[id$=attributes:panel]"));
+ TreeNodeAttributes attributes = new
TreeNodeAttributes(jq("span[id$=treeNode1Attributes:panel]"));
+ TreeNodeAttributes attributesLeaf = new
TreeNodeAttributes(jq("span[id$=treeNode3Attributes:panel]"));
+
+ TreeModel tree = new TreeModel(pjq("div.rf-tr[id$=richTree]"));
+ TreeNodeModel treeNode = tree.getNode(1);
+ TreeNodeModel subTreeNode = treeNode.getNode(1);
+ TreeNodeModel leaf = subTreeNode.getNode(1);
+
+ @Inject
+ @Use(empty = true)
+ Event event = CLICK;
+ Event[] events = new Event[] { CLICK, DBLCLICK, KEYDOWN, KEYPRESS, KEYUP, MOUSEDOWN,
MOUSEMOVE, MOUSEOUT,
+ MOUSEOVER, MOUSEUP };
+
+ @Inject
+ @Use(empty = true)
+ SwitchType toggleType;
+ SwitchType[] toggleTypes = new SwitchType[] { SwitchType.ajax, SwitchType.server };
+
+ @BeforeMethod
+ public void init() {
+ attributesRoot.setLocator(jq("span[id$=treeNode1Attributes:panel]"));
+ tree.setToggleType(SwitchType.ajax);
+ }
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"http://localhost:8080/metamer/faces/components/richTree/simple.xhtml");
+ }
+
+ @Test
+ public void testDir() {
+ super.testDir(treeNode.getTreeNode());
+ }
+
+ @Test
+ public void testHandleClass() {
+ assertEquals(selenium.getCount(not(tree.getAnyNode().getHandle(),
JQ_SAMPLE_CLASS)), 4);
+
+ attributes.setHandleClass(SAMPLE_CLASS);
+
+ assertEquals(selenium.getCount(append(tree.getAnyNode().getHandle(),
JQ_SAMPLE_CLASS)), 0);
+ assertEquals(selenium.getCount(not(tree.getAnyNode().getHandle(),
JQ_SAMPLE_CLASS)), 4);
+ }
+
+ @Test
+ public void testIconClass() {
+ assertEquals(selenium.getCount(not(tree.getAnyNode().getIcon(),
JQ_SAMPLE_CLASS)), 4);
+
+ attributes.setIconClass(SAMPLE_CLASS);
+
+ assertEquals(selenium.getCount(append(tree.getAnyNode().getIcon(),
JQ_SAMPLE_CLASS)), 0);
+ assertEquals(selenium.getCount(not(tree.getAnyNode().getIcon(),
JQ_SAMPLE_CLASS)), 4);
+ }
+
+ ElementLocator<?> iconImage = treeNode.getIcon();
+ AttributeLocator<?> imageSrc = iconImage.getAttribute(SRC);
+ AttributeRetriever retrieveImageSrc = retrieveAttribute.attributeLocator(imageSrc);
+
+ @Test
+ public void testIconCollapsed() {
+ assertTrue(selenium.isElementPresent(iconImage));
+ assertFalse(selenium.isAttributePresent(imageSrc));
+
+ attributes.setIconCollapsed(IMAGE_URL);
+
+ assertTrue(selenium.isElementPresent(iconImage));
+ assertTrue(selenium.isAttributePresent(imageSrc));
+
+ String url = retrieveImageSrc.retrieve();
+ assertTrue(url.endsWith(IMAGE_URL));
+ }
+
+ @Test
+ public void testIconExpanded() {
+ assertTrue(selenium.isElementPresent(iconImage));
+ assertFalse(selenium.isAttributePresent(imageSrc));
+
+ attributes.setIconExpanded(IMAGE_URL);
+
+ assertTrue(selenium.isElementPresent(iconImage));
+ assertFalse(selenium.isAttributePresent(imageSrc));
+
+ treeNode.expand();
+
+ assertTrue(selenium.isElementPresent(iconImage));
+ assertTrue(selenium.isAttributePresent(imageSrc));
+
+ String url = retrieveImageSrc.retrieve();
+ assertTrue(url.endsWith(IMAGE_URL));
+ }
+
+ @Test
+ public void testIconLeaf() {
+ treeNode.expand();
+ subTreeNode.expand();
+
+ ElementLocator<?> leafIcon = leaf.getIcon();
+ AttributeLocator<?> leafIconImageSrc = leaf.getIcon().getAttribute(SRC);
+
+ assertTrue(selenium.isElementPresent(leafIcon));
+ assertFalse(selenium.isAttributePresent(leafIconImageSrc));
+
+ attributesLeaf.setIconLeaf(IMAGE_URL);
+
+ assertTrue(selenium.isElementPresent(leafIcon));
+ assertTrue(selenium.isAttributePresent(leafIconImageSrc));
+
+ String url = selenium.getAttribute(leafIconImageSrc);
+ assertTrue(url.endsWith(IMAGE_URL));
+ }
+
+ @Test
+ @Use(field = "toggleType", value = "toggleTypes")
+ public void testImmediate() {
+ tree.setToggleType(toggleType);
+ attributesTree.setToggleType(toggleType);
+
+ treeNode.expand();
+
+ phaseInfo.assertPhases(PhaseId.ANY_PHASE);
+ phaseInfo.assertListener(PhaseId.PROCESS_VALIDATIONS, "tree toggle listener
invoked");
+
+ attributes.setImmediate(true);
+
+ treeNode.expand();
+
+ phaseInfo.assertPhases(PhaseId.ANY_PHASE);
+ phaseInfo.assertListener(PhaseId.APPLY_REQUEST_VALUES, "tree toggle listener
invoked");
+ }
+
+ @Test
+ public void testLabelClass() {
+ assertEquals(selenium.getCount(not(tree.getAnyNode().getLabel(),
JQ_SAMPLE_CLASS)), 4);
+
+ attributes.setLabelClass(SAMPLE_CLASS);
+
+ assertEquals(selenium.getCount(append(tree.getAnyNode().getLabel(),
JQ_SAMPLE_CLASS)), 0);
+ assertEquals(selenium.getCount(not(tree.getAnyNode().getLabel(),
JQ_SAMPLE_CLASS)), 4);
+ }
+
+ @Test
+ public void testLang() {
+ assertEquals(selenium.getCount(not(tree.getAnyNode(), "[lang=cs]")),
4);
+
+ attributes.setLang("cs");
+
+ assertEquals(selenium.getCount(append(tree.getAnyNode(), "[lang=cs]")),
0);
+ assertEquals(selenium.getCount(not(tree.getAnyNode(), "[lang=cs]")),
4);
+ }
+
+ @Test
+ @Use(field = "event", value = "events")
+ public void testClientEvents() {
+ String attributeName = event.getEventName();
+ ElementLocator<?> eventInput =
pjq("span[id$=treeNode1Attributes:panel] input[id$=on" + attributeName
+ + "Input]");
+ String value = "metamerEvents += \"" + event.getEventName() +
" \"";
+
+ selenium.type(eventInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ fireEventAt(treeNode.getLabel(), event);
+
+ waitGui.failWith("Attribute on" + attributeName + " does not work
correctly").until(
+ new EventFiredCondition(event));
+ }
+
+ @Test
+ public void testOnbeforetoggle() {
+ super.testRequestEventsBefore("beforetoggle", "toggle");
+ treeNode.expand();
+ super.testRequestEventsAfter("beforetoggle", "toggle");
+ }
+
+ @Test
+ public void testRendered() {
+ treeNode.expand();
+ subTreeNode.expand();
+
+ assertTrue(selenium.isElementPresent(leaf));
+
+ attributesLeaf.setRendered(false);
+
+ assertFalse(selenium.isElementPresent(leaf));
+ assertTrue(selenium.isElementPresent(subTreeNode));
+ }
+
+ @Test
+ public void testStyle() {
+ super.testStyle(treeNode.getTreeNode(), "style");
+ }
+
+ @Test
+ public void testStyleClass() {
+ super.testStyleClass(treeNode.getTreeNode(), "styleClass");
+ }
+
+ @Test
+ public void testTitle() {
+ super.testTitle(treeNode.getTreeNode());
+ }
+
+ private void fireEventAt(ElementLocator<?> element, Event event) {
+ Point coords = new Point(0, 0);
+ if (event == CLICK) {
+ selenium.clickAt(element, coords);
+ } else if (event == DBLCLICK) {
+ selenium.doubleClickAt(element, coords);
+ } else if (event == MOUSEDOWN) {
+ selenium.mouseDownAt(element, coords);
+ } else if (event == MOUSEMOVE) {
+ selenium.mouseMoveAt(element, coords);
+ } else if (event == MOUSEOUT) {
+ selenium.mouseOutAt(element, coords);
+ } else if (event == MOUSEOVER) {
+ selenium.mouseOverAt(element, coords);
+ } else if (event == MOUSEUP) {
+ selenium.mouseUpAt(element, coords);
+ } else {
+ selenium.fireEvent(element, event);
+ }
+ }
+}
Copied:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TreeNodeAttributes.java
(from rev 21393,
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TreeNodeAttributes.java)
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TreeNodeAttributes.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TreeNodeAttributes.java 2011-02-02
16:01:36 UTC (rev 21394)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richTreeNode;
+
+import org.jboss.test.selenium.locator.ExtendedLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TreeNodeAttributes extends AbstractComponentAttributes {
+
+ public TreeNodeAttributes() {
+ }
+
+ public <T extends ExtendedLocator<JQueryLocator>> TreeNodeAttributes(T
root) {
+ super(root);
+ }
+
+ public void setDir(String dir) {
+ setProperty("dir", dir);
+ }
+
+ public void setHandleClass(String handleClass) {
+ setProperty("handleClass", handleClass);
+ }
+
+ public void setIconClass(String iconClass) {
+ setProperty("iconClass", iconClass);
+ }
+
+ public void setIconCollapsed(String iconCollapsed) {
+ setProperty("iconCollapsed", iconCollapsed);
+ }
+
+ public void setIconExpanded(String iconExpanded) {
+ setProperty("iconExpanded", iconExpanded);
+ }
+
+ public void setIconLeaf(String iconLeaf) {
+ setProperty("iconLeaf", iconLeaf);
+ }
+
+ public void setImmediate(Boolean immediate) {
+ setProperty("immediate", immediate);
+ }
+
+ public void setLabelClass(String labelClass) {
+ setProperty("labelClass", labelClass);
+ }
+
+ public void setLang(String lang) {
+ setProperty("lang", lang);
+ }
+
+ public void setOnbeforetoggle(String onbeforetoggle) {
+ setProperty("onbeforetoggle", onbeforetoggle);
+ }
+
+ public void setOntoggle(String ontoggle) {
+ setProperty("ontoggle", ontoggle);
+ }
+
+ public void setRendered(Boolean rendered) {
+ setProperty("rendered", rendered);
+ }
+
+ public void setStyle(String style) {
+ setProperty("style", style);
+ }
+
+ public void setStyleClass(String styleClass) {
+ setProperty("styleClass", styleClass);
+ }
+
+ public void setTitle(String title) {
+ setProperty("title", title);
+ }
+}