Author: dsvyatobatsko
Date: 2009-03-30 15:51:25 -0400 (Mon, 30 Mar 2009)
New Revision: 13310
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxPageBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxPage/
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxPage/ajaxPageAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxPage/ajaxPageTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxPageTest.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
Log:
https://jira.jboss.org/jira/browse/RF-6330
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxPageBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxPageBean.java
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxPageBean.java 2009-03-30
19:51:25 UTC (rev 13310)
@@ -0,0 +1,53 @@
+package org.ajax4jsf.bean;
+
+import java.util.Date;
+
+import org.ajax4jsf.event.AjaxEvent;
+
+public class AjaxPageBean {
+
+ private String value = "value";
+
+ /**
+ * Gets value of value field.
+ * @return value of value field
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Set a new value for value field.
+ * @param value a new value for value field
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ private String status = "";
+
+ /**
+ * Gets value of status field.
+ * @return value of status field
+ */
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * Set a new value for status field.
+ * @param status a new value for status field
+ */
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getTime() {
+ return String.valueOf(new Date().getTime());
+ }
+
+ public void ajaxListener(AjaxEvent event) {
+ setStatus("AjaxEvent");
+ }
+
+}
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxPageBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-03-30
19:26:22 UTC (rev 13309)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-03-30
19:51:25 UTC (rev 13310)
@@ -378,6 +378,11 @@
<managed-bean-name>tooltipBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.TooltipBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>pageBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.bean.AjaxPageBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/pages/ajaxInclude/step1.xhtml</from-view-id>
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxPage/ajaxPageAutoTest.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxPage/ajaxPageAutoTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxPage/ajaxPageTest.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxPage/ajaxPageTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxPageTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxPageTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxPageTest.java 2009-03-30
19:51:25 UTC (rev 13310)
@@ -0,0 +1,137 @@
+package org.richfaces.testng;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
+import org.richfaces.SeleniumTestBase;
+import org.richfaces.AutoTester.TestSetupEntry;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class AjaxPageTest extends SeleniumTestBase {
+
+ private final static String TIMESTAMP_ID = "form:timestamp";
+
+ private final static String STATUS_ID = "form:status";
+
+ private final static String INPUT_ID = "form:input";
+
+ private final static String SUBMIT_ID = "form:submit";
+
+ @Test
+ public void testRenderer(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ selenium.selectFrame("page");
+ try {
+ String contentType = selenium.getAttribute("//meta@content");
+ Assert.assertEquals(contentType, "application/xhtml+xml");
+ } finally {
+ selenium.selectFrame("relative=parent");
+ }
+ writeStatus("Check facets");
+ selenium.selectFrame("page");
+ try {
+ String bodyText = selenium.getText("//body");
+ if (!bodyText.contains("Page Content here")) {
+ Assert.fail("Page Content is not output at all");
+ }
+ if (bodyText.contains("Head Content here")) {
+ Assert.fail("Head facet is output to wrong place (must to head but
really to body)");
+ }
+ } finally {
+ selenium.selectFrame("relative=parent");
+ }
+ }
+
+ @Test
+ public void testAjaxListener(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Check ajaxListener fires on each AJAX request");
+ selenium.selectFrame("page");
+ try {
+ clickAjaxCommandAndWait(SUBMIT_ID);
+ AssertTextEquals(STATUS_ID, "AjaxEvent", "ajaxListeners are
not triggered");
+ } finally {
+ selenium.selectFrame("relative=parent");
+ }
+ }
+
+ @Test
+ public void testSelfRenderedAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Check selfRendered attribute. Each ajax request should cause
component to be rerendered");
+ selenium.selectFrame("page");
+ try {
+ String was = selenium.getText(TIMESTAMP_ID);
+ clickAjaxCommandAndWait(SUBMIT_ID);
+ AssertTextNotEquals(TIMESTAMP_ID, was, "selfRendered attribute does not
work");
+ } finally {
+ selenium.selectFrame("relative=parent");
+ }
+ }
+
+ @Test
+ public void testImmediate(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ tester.reset();
+ tester.setupControl(TestSetupEntry.immediate, Boolean.TRUE);
+ tester.clickLoad();
+ writeStatus("Check that AjaxEvents are delivered in Apply Request Values
instead of Invoke Application phase");
+ writeStatus("Move input to invalid state");
+ selenium.selectFrame("page");
+ try {
+ type(INPUT_ID, "A");
+ clickAjaxCommandAndWait(SUBMIT_ID);
+ AssertTextEquals(STATUS_ID, "AjaxEvent", "immediate attribute
does not work");
+ } finally {
+ selenium.selectFrame("relative=parent");
+ }
+ }
+
+ @Test
+ public void testStylesAndClassesAndHtmlAttributes(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+
+ writeStatus("Check styles and classes are output to client");
+
+ writeStatus("Check styleClass/style attributes");
+ selenium.selectFrame("page");
+ try {
+ assertStyleAttributeContains("//body", "font-size: 13px",
"Style attribute was not output to client");
+ assertClassAttributeContains("//body", "noclass",
"Class attribute was not output to client");
+ } finally {
+ selenium.selectFrame("relative=parent");
+ }
+ }
+
+ @Test
+ public void testRenderedAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ tester.reset();
+ tester.setupControl(TestSetupEntry.rendered, Boolean.FALSE);
+ tester.clickLoad();
+
+ selenium.selectFrame("page");
+ try {
+ AssertTextEquals("//body", "", "Rendered attribute
does not work");
+ } finally {
+ selenium.selectFrame("relative=parent");
+ }
+ }
+
+ @Override
+ public String getAutoTestUrl(){
+ return "pages/ajaxPage/ajaxPageAutoTest.xhtml";
+ }
+
+ @Override
+ public String getTestUrl() {
+ return null;
+ }
+
+}
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxPageTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native