Author: dsvyatobatsko
Date: 2008-10-02 13:06:16 -0400 (Thu, 02 Oct 2008)
New Revision: 10652
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/layout/layout.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxStatus/ajaxStatusTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxStatusTest.java
Log:
AjaxStatus: test onstart/onstop events firing
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/layout/layout.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxStatus/ajaxStatusTest.xhtml
===================================================================
(Binary files differ)
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 2008-10-02
15:39:52 UTC (rev 10651)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-10-02
17:06:16 UTC (rev 10652)
@@ -960,5 +960,18 @@
}
}
}
-
+
+ public void assertEvents(List<String> eventsExpected) {
+ StringBuilder sb = new StringBuilder();
+ String delim = "";
+ for (String event : eventsExpected) {
+
sb.append(delim).append("'").append(event).append("'");
+ delim = ",";
+ }
+ String json = "[" + sb.toString() + "]";
+ String message = runScript("EventQueue.assert(eval(\"" + json +
"\"))");
+ if (null != message && message.length() > 0) {
+ Assert.fail(message);
+ }
+ }
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxStatusTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxStatusTest.java 2008-10-02
15:39:52 UTC (rev 10651)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxStatusTest.java 2008-10-02
17:06:16 UTC (rev 10652)
@@ -1,5 +1,8 @@
package org.richfaces.testng;
+import java.util.ArrayList;
+import java.util.List;
+
import org.ajax4jsf.template.Template;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
@@ -116,6 +119,26 @@
assertClassNames(stopFacetId, new String[] {"stop-class"}, "Class
attribute was not output to client for stop facet", true);
}
+ @Test
+ public void testOnstartOnstopEventsFired(Template template) {
+ renderPage(template);
+
+ writeStatus("Check onstart/onstop events are fired ");
+
+ List<String> eventsExpected = new ArrayList<String>();
+ assertEvents(eventsExpected);
+
+ clickById(getParentId() + "_form:" + BTN_1_ID);
+
+ eventsExpected.add("onstart");
+ assertEvents(eventsExpected);
+
+ delay(3000);
+
+ eventsExpected.add("onstop");
+ assertEvents(eventsExpected);
+ }
+
public String getTestUrl() {
return "pages/ajaxStatus/ajaxStatusTest.xhtml";
}
Show replies by date