Author: ppitonak(a)redhat.com
Date: 2010-11-15 11:53:41 -0500 (Mon, 15 Nov 2010)
New Revision: 20050
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/a4jOutputPanel/TestA4JOutputPanel.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTabPanel/TestRichTabPanel.java
Log:
* testTitle added to AbstractMetamerTest
* all tests for attribute title refactored
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 2010-11-15
15:26:58 UTC (rev 20049)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2010-11-15
16:53:41 UTC (rev 20050)
@@ -156,7 +156,7 @@
selenium.fireEvent(element, event);
- waitGui.failWith(event.getEventName() + " attribute did not change
correctly").until(
+ waitGui.failWith("Attribute on" + attributeName + " does not work
correctly").until(
new EventFiredCondition(event));
}
@@ -251,6 +251,28 @@
}
/**
+ * A helper method for testing attribute "title".
+ *
+ * @param element
+ * locator of tested element
+ */
+ protected void testTitle(ElementLocator<?> element) {
+ JQueryLocator input = pjq("input[type=text][id$=titleInput]");
+ AttributeLocator<?> attribute = element.getAttribute(new
Attribute("title"));
+
+ // title = null
+ assertFalse(selenium.isAttributePresent(attribute), "Attribute title should
not be present.");
+
+ // title = "RichFaces 4"
+ selenium.type(input, "RichFaces 4");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertTrue(selenium.isAttributePresent(attribute), "Attribute title should
be present.");
+ String value = selenium.getAttribute(attribute);
+ assertEquals(value, "RichFaces 4", "Attribute title");
+ }
+
+ /**
* Hides header, footer and inputs for attributes.
*/
protected void hideControls() {
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java 2010-11-15
15:26:58 UTC (rev 20049)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java 2010-11-15
16:53:41 UTC (rev 20050)
@@ -227,22 +227,6 @@
@Test
public void testTitle() {
- String title = "a4j:outputPanel title";
- JQueryLocator titleInput = pjq("input[id$=titleInput]");
- AttributeLocator<?> attributeTitle = outputDiv.getAttribute(new
Attribute("title"));
-
- selenium.typeKeys(titleInput, title);
- selenium.waitForPageToLoad(TIMEOUT);
-
- String attributeValue = selenium.getAttribute(attributeTitle);
- assertEquals(attributeValue, title, "Value of attribute title.");
-
- selenium.typeKeys(titleInput, "");
- selenium.waitForPageToLoad(TIMEOUT);
-
- if (selenium.isAttributePresent(attributeTitle)) {
- attributeValue = selenium.getAttribute(attributeTitle);
- assertEquals(attributeValue, "", "Value of attribute
style.");
- }
+ testTitle(outputDiv);
}
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2010-11-15
15:26:58 UTC (rev 20049)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2010-11-15
16:53:41 UTC (rev 20050)
@@ -352,19 +352,7 @@
@Test
public void testTitle() {
- JQueryLocator input = pjq("input[type=text][id$=titleInput]");
- AttributeLocator<?> attribute = accordion.getAttribute(new
Attribute("title"));
-
- // title = null
- assertFalse(selenium.isAttributePresent(attribute), "Attribute title should
not be present.");
-
- // title = "RichFaces Accordion"
- selenium.type(input, "RichFaces Accordion");
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertTrue(selenium.isAttributePresent(attribute), "Attribute title should
be present.");
- String value = selenium.getAttribute(attribute);
- assertEquals(value, "RichFaces Accordion", "Attribute
title");
+ testTitle(accordion);
}
@Test
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java 2010-11-15
15:26:58 UTC (rev 20049)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java 2010-11-15
16:53:41 UTC (rev 20050)
@@ -283,7 +283,7 @@
public void testOnleave() {
JQueryLocator time = jq("span[id$=requestTime]");
- selenium.type(pjq("input[type=text][id$=onleaveInput]"),
"metamerEvents += \"enter \"");
+ selenium.type(pjq("input[type=text][id$=onleaveInput]"),
"metamerEvents += \"leave \"");
selenium.waitForPageToLoad();
selenium.getEval(new JavaScript("window.metamerEvents =
\"\";"));
@@ -390,18 +390,6 @@
@Test
public void testTitle() {
- JQueryLocator input = pjq("input[type=text][id$=titleInput]");
- AttributeLocator<?> attribute = tab.getAttribute(new
Attribute("title"));
-
- // title = null
- assertFalse(selenium.isAttributePresent(attribute), "Attribute title should
not be present.");
-
- // title = "RichFaces Tab Panel"
- selenium.type(input, "RichFaces Tab Panel");
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertTrue(selenium.isAttributePresent(attribute), "Attribute title should
be present.");
- String value = selenium.getAttribute(attribute);
- assertEquals(value, "RichFaces Tab Panel", "Attribute
title");
+ testTitle(tab);
}
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTabPanel/TestRichTabPanel.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTabPanel/TestRichTabPanel.java 2010-11-15
15:26:58 UTC (rev 20049)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTabPanel/TestRichTabPanel.java 2010-11-15
16:53:41 UTC (rev 20050)
@@ -411,18 +411,6 @@
@Test
public void testTitle() {
- JQueryLocator input = pjq("input[type=text][id$=titleInput]");
- AttributeLocator<?> attribute = panel.getAttribute(new
Attribute("title"));
-
- // title = null
- assertFalse(selenium.isAttributePresent(attribute), "Attribute title should
not be present.");
-
- // title = "RichFaces Tab Panel"
- selenium.type(input, "RichFaces Tab Panel");
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertTrue(selenium.isAttributePresent(attribute), "Attribute title should
be present.");
- String value = selenium.getAttribute(attribute);
- assertEquals(value, "RichFaces Tab Panel", "Attribute
title");
+ testTitle(panel);
}
}