Author: dsvyatobatsko
Date: 2008-04-29 08:35:51 -0400 (Tue, 29 Apr 2008)
New Revision: 8294
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxStatus/ajaxStatusTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxStatusTest.java
Log:
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxStatus/ajaxStatusTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java 2008-04-29
12:31:51 UTC (rev 8293)
+++
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java 2008-04-29
12:35:51 UTC (rev 8294)
@@ -309,6 +309,26 @@
}
/**
+ * Asserts DOM node is visible
+ *
+ * @param id -
+ * DOM element id
+ */
+ public void AssertVisible(String id) {
+ Assert.assertTrue(isVisibleById(id));
+ }
+
+ /**
+ * Asserts DOM node is not visible
+ *
+ * @param id -
+ * DOM element id
+ */
+ public void AssertNotVisible(String id) {
+ Assert.assertFalse(isVisibleById(id));
+ }
+
+ /**
* Returns element's text
*
* @param id -
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxStatusTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxStatusTest.java 2008-04-29
12:31:51 UTC (rev 8293)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxStatusTest.java 2008-04-29
12:35:51 UTC (rev 8294)
@@ -2,6 +2,7 @@
import org.ajax4jsf.test.base.SeleniumTestBase;
import org.ajax4jsf.test.base.Templates;
+import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
@@ -32,10 +33,52 @@
@Test
public void testAjaxStatusComponent() throws Exception {
- _testAjaxStatusComponent(Templates.DATATABLE);
+ _testAjaxStatusComponent(Templates.DATATABLE);
}
private void _testAjaxStatusComponent(Templates template) {
renderPage("/faces/pages/ajaxStatus/ajaxStatusTest.xhtml", template);
+
+ String parentId = getParentId() + "_form:";
+ String btn1 = parentId + "button1";
+ clickById(btn1);
+
+ String reg1Status = parentId + "region1:status";
+
+ writeStatus("Ajax request is in progress");
+
+ AssertVisible(reg1Status + ".start");
+ AssertNotVisible(reg1Status + ".stop");
+ String start = getTextById(reg1Status + ".start");
+ Assert.assertTrue(start.startsWith("In progress..."));
+ pause(3000, reg1Status);
+
+ writeStatus("Ajax request completed");
+
+ AssertNotVisible(reg1Status + ".start");
+ AssertVisible(reg1Status + ".stop");
+ String stop = getTextById(reg1Status + ".stop");
+ Assert.assertTrue(stop.startsWith("Complete"));
+
+ String btn2 = parentId + "button2";
+ clickById(btn2);
+
+ String reg2Status = parentId + "region2:status";
+
+ writeStatus("Ajax request is in progress");
+
+ AssertVisible(reg2Status + ".start");
+ AssertNotVisible(reg2Status + ".stop");
+ start = getTextById(reg2Status + ".start");
+ Assert.assertTrue(start.startsWith("In progress..."));
+ pause(3000, reg2Status);
+
+ writeStatus("Ajax request completed");
+
+ AssertNotVisible(reg2Status + ".start");
+ AssertVisible(reg2Status + ".stop");
+ stop = getTextById(reg1Status + ".stop");
+ Assert.assertTrue(stop.startsWith("Complete"));
+
}
}