Author: dsvyatobatsko
Date: 2009-02-19 09:03:27 -0500 (Thu, 19 Feb 2009)
New Revision: 12691
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxHTMLCommandLink/ajaxHTMLLinkAutoTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java
Log:
RF-6203, RF-6204, RF-6205, RF-6206, RF-6208
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxHTMLCommandLink/ajaxHTMLLinkAutoTest.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxHTMLCommandLink/ajaxHTMLLinkAutoTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
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-18
23:47:10 UTC (rev 12690)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2009-02-19
14:03:27 UTC (rev 12691)
@@ -331,6 +331,62 @@
}
//
+// ActionSource test methods
+//
+
+ public void testAS() {
+ reset();
+ clickLoad();
+
+ base.sendAction();
+
+ checkActionListener(true);
+ checkNestedActionListener(true);
+ checkNavigation(true);
+ checkUpdateModel(true);
+ }
+
+ public void testASImmediate() {
+ reset();
+ setupControl(TestSetupEntry.immediate, Boolean.TRUE);
+ clickLoad();
+
+ base.sendAction();
+
+ checkActionListener(true);
+ checkNestedActionListener(true);
+ checkNavigation(true);
+ checkUpdateModel(false);
+ }
+
+ public void testASImmediateWithExternalValidationFailed() {
+ reset();
+ setupControl(TestSetupEntry.immediate, Boolean.TRUE);
+ clickLoad();
+
+ setExtrenalValidationFailed();
+ base.sendAction();
+
+ checkActionListener(true);
+ checkNestedActionListener(true);
+ checkNavigation(true);
+ checkUpdateModel(false);
+ }
+
+ public void testASExtrenalValidationFailure() {
+ reset();
+ clickLoad();
+
+ setExtrenalValidationFailed();
+ base.sendAction();
+
+ checkActionListener(false);
+ checkNestedActionListener(false);
+ checkNavigation(false);
+ checkUpdateModel(false);
+ }
+
+//
// EditableValueHolder test methods
//
@@ -604,11 +660,15 @@
}
public void checkNavigation(boolean passed) {
- if (!"Navigation
successfully".equals(base.getTextById("_auto_test_navigation"))) {
- Assert.fail("Navigation has not been occurred");
- }
+ boolean isNavigated = base.isPresent("_auto_test_navigation")
+ && "Navigation
successfully".equals(base.getTextById("_auto_test_navigation"));
+ if (passed && !isNavigated) {
+ Assert.fail("Navigation has not been occurred");
+ } else if (!passed && isNavigated) {
+ Assert.fail("Navigation would not have been occurred");
+ }
}
-
+
public void checkProcessInputChangeListener(boolean passed) {
String status = getStatus();
if (passed && status != null &&
status.indexOf(AutoTestBean.PROCESS_INPUT_CHANGE_LISTENER) == -1) {
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2009-02-18
23:47:10 UTC (rev 12690)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2009-02-19
14:03:27 UTC (rev 12691)
@@ -1234,7 +1234,16 @@
*/
public void sendAjax() {
}
-
+
+ /**
+ * Control action that should force ActionSource component to produce an action event
(as a rule - a full form submit)
+ * This method should wait for full submit completion
+ * Used for auto testing only
+ */
+ public void sendAction() {
+ throw new UnsupportedOperationException("This method has always to be
overridden before usage");
+ }
+
/**
* Control action that should force ajax request that navigate to other page.
* This method should NOT wait for ajax completion
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java 2009-02-18
23:47:10 UTC (rev 12690)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java 2009-02-19
14:03:27 UTC (rev 12691)
@@ -17,10 +17,11 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+ */
package org.richfaces.testng;
import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
import org.testng.annotations.Test;
@@ -60,14 +61,60 @@
assertActionInvoked(true);
assertListenerInvoked(true);
-// linkId = parentId + "l1";
-// writeStatus("Click link 1");
-// clickCommandAndWait(linkId);
-// assertValueSubmitted(true);
-// assertActionInvoked(true);
-// assertListenerInvoked(true);
+ // linkId = parentId + "l1";
+ // writeStatus("Click link 1");
+ // clickCommandAndWait(linkId);
+ // assertValueSubmitted(true);
+ // assertActionInvoked(true);
+ // assertListenerInvoked(true);
}
+ @Test
+ public void testComponentDesignMode(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Check action and actionListener defined as component attributes
and actionListener defined as nested tag are invoked");
+ writeStatus(" on the server after button is pressed, navigation
occurs");
+ tester.testAS();
+ }
+
+ @Test
+ public void testImmediate(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test immediate attribute");
+ tester.testASImmediate();
+ }
+
+ @Test
+ public void testImmediateWithExternalValidationFailed(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test immediate attribute with external validation
failed");
+ tester.testASImmediateWithExternalValidationFailed();
+ }
+
+ @Test
+ public void testWithExternalValidationFailure(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, null);
+ writeStatus("Check component in case of external validation failure:
listeners and navigation does not work");
+ autoTester.testASExtrenalValidationFailure();
+ }
+
+ @Test
+ public void testRenderedAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test component with rendered = false is not present on the
page");
+ tester.testRendered();
+ }
+
+ @Override
+ public void sendAction() {
+ clickCommandAndWait(getAutoTester(this).getClientId(AutoTester.COMPONENT_ID));
+ }
+
private void assertValueSubmitted(boolean submitted) {
if (submitted) {
writeStatus("Check that a new value is submitted");
@@ -79,7 +126,7 @@
}
private void assertActionInvoked(boolean invoked) {
- if(invoked) {
+ if (invoked) {
writeStatus("Check that action is invoked");
AssertTextEquals(getParentId() + IS_ACTION_INVOKED, "true",
"An action is not invoked");
} else {
@@ -89,7 +136,7 @@
}
private void assertListenerInvoked(boolean invoked) {
- if(invoked) {
+ if (invoked) {
writeStatus("Check that listener is invoked");
AssertTextEquals(getParentId() + IS_LISTENER_INVOKED, "true",
"A listener is not invoked");
} else {
@@ -103,4 +150,9 @@
return "pages/ajaxHTMLCommandLink/ajaxHTMLLinkTest.xhtml";
}
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/ajaxHTMLCommandLink/ajaxHTMLLinkAutoTest.xhtml";
+ }
+
}
Show replies by date