Author: konstantin.mishin
Date: 2009-02-25 14:21:30 -0500 (Wed, 25 Feb 2009)
New Revision: 12748
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/spacer/spacerAutoTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/spacer/spacerTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/SpacerTest.java
Log:
RF-6191
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/spacer/spacerAutoTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/spacer/spacerAutoTest.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/spacer/spacerAutoTest.xhtml 2009-02-25
19:21:30 UTC (rev 12748)
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.autoTestTemplate}">
+ <ui:define name="component">
+ <rich:spacer id="componentId"
rendered="#{autoTestBean.rendered}"
+ onclick="EventQueue.fire('onclick')"
+ onmousedown="EventQueue.fire('onmousedown')"
+ onmousemove="EventQueue.fire('onmousemove')"
+ onmouseup="EventQueue.fire('onmouseup')"
+ onmouseout="EventQueue.fire('onmouseout')"
+ onmouseover="EventQueue.fire('onmouseover')"
+ onkeydown="EventQueue.fire('onkeydown')"
+ onkeypress="EventQueue.fire('onkeypress')"
+ onkeyup="EventQueue.fire('onkeyup')"
+ />
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/spacer/spacerTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2009-02-25
17:12:01 UTC (rev 12747)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2009-02-25
19:21:30 UTC (rev 12748)
@@ -453,6 +453,8 @@
}
public void testHTMLEvents() {
+ reset();
+ clickLoad();
String componentId = getClientId(COMPONENT_ID);
base.assertEvents(componentId, SeleniumEvent.STANDARD_HTML_EVENTS);
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/SpacerTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/SpacerTest.java 2009-02-25
17:12:01 UTC (rev 12747)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/SpacerTest.java 2009-02-25
19:21:30 UTC (rev 12748)
@@ -21,6 +21,7 @@
package org.richfaces.testng;
import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -34,16 +35,17 @@
String spacerId = parentId + "sp";
writeStatus("Check width ");
- assertWidth(1 + 2, spacerId);
+ assertWidth(1, spacerId);
writeStatus("Check height ");
- assertHeight(5 + 2, spacerId);
+ assertHeight(5, spacerId);
writeStatus("Check styleClass ");
assertStyleClass("sp", spacerId);
writeStatus("Check style ");
- assertStyleClass("border: solid 1px green;", spacerId);
+ Assert.assertTrue(selenium.getAttribute("xpath=id('" + spacerId +
"')@style")
+ .toLowerCase().indexOf("color: yellow") != -1);
}
private void assertWidth(int width, String spacerId) {
@@ -77,17 +79,24 @@
}
}
- private void assertStyle(String style, String spacerId) {
- StringBuffer script = new StringBuffer("
document.getElementById('");
- script.append(spacerId);
- script.append("').style");
+ /**
+ * component with rendered = false is not present on the page,
+ * style and classes, standard HTML event attributes are output to client
+ */
+ @Test
+ public void testRenderedAndEvents(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, null);
+ autoTester.testRendered();
+ autoTester.testHTMLEvents();
+ }
- String s = runScript(script.toString());
- Assert.assertEquals(s, style);
- }
-
- public String getTestUrl() {
+ public String getTestUrl() {
return "pages/spacer/spacerTest.xhtml";
}
-
+
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/spacer/spacerAutoTest.xhtml";
+ }
}