Author: alevkovsky
Date: 2009-02-06 07:31:37 -0500 (Fri, 06 Feb 2009)
New Revision: 12588
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/progressBar/progressBarAutoTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ProgressBarTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ProgressBarTest.java
Log:
Progress bar selenium tests
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ProgressBarTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ProgressBarTestBean.java 2009-02-06
10:38:52 UTC (rev 12587)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ProgressBarTestBean.java 2009-02-06
12:31:37 UTC (rev 12588)
@@ -28,6 +28,8 @@
private boolean enabled = false;
+ private int content = 0;
+
private Long value = -5L;
public String getDate() {
@@ -74,6 +76,25 @@
public void setValue(Long value) {
this.value = value;
}
+
+ /**
+ * @return the content
+ */
+ public String getContent() {
+ content++;
+ return String.valueOf(content);
+ }
+
+ /**
+ * @param content the content to set
+ */
+ public void setContent(String content) {
+ if(content != null && content.length() > 0){
+ this.content = Integer.parseInt(content);
+ }else{
+ this.content = 0;
+ }
+ }
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/progressBar/progressBarAutoTest.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/progressBar/progressBarAutoTest.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-06
10:38:52 UTC (rev 12587)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2009-02-06
12:31:37 UTC (rev 12588)
@@ -200,18 +200,28 @@
}
public void testImmediate() {
+ testImmediate(true);
+ }
+
+ public void testImmediate(boolean checkListener) {
reset();
setupControl(TestSetupEntry.immediate, Boolean.TRUE);
clickLoad();
base.sendAjax();
-
- checkActionListener(true);
+
+ if (checkListener) {
+ checkActionListener(true);
+ }
checkUpdateModel(false);
}
public void testImmediateWithExternalValidationFailed() {
+ testImmediateWithExternalValidationFailed(true);
+ }
+
+ public void testImmediateWithExternalValidationFailed(boolean checkListener) {
reset();
setupControl(TestSetupEntry.immediate, Boolean.TRUE);
clickLoad();
@@ -219,7 +229,9 @@
setExtrenalValidationFailed();
base.sendAjax();
- checkActionListener(true);
+ if (checkListener) {
+ checkActionListener(true);
+ }
checkUpdateModel(false);
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ProgressBarTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ProgressBarTest.java 2009-02-06
10:38:52 UTC (rev 12587)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ProgressBarTest.java 2009-02-06
12:31:37 UTC (rev 12588)
@@ -20,17 +20,29 @@
*/
package org.richfaces.testng;
+import java.util.HashMap;
+import java.util.Map;
+
import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
import org.testng.annotations.Test;
public class ProgressBarTest extends SeleniumTestBase {
+
+ private static Map<String, String> params = new HashMap<String,
String>();
+ static {
+ params.put("parameter1", "value1");
+ params.put("parameter2", "value2");
+ params.put("parameter3", "value3");
+ }
+
@Test
public void testProgressBarComponent(Template template) {
- renderPage(template);
+ renderPage(template);
String parentId = getParentId() + "_form:";
@@ -62,7 +74,7 @@
pause(5000, progressBarId);
writeStatus("Check value");
- Assert.assertTrue((getProgressBarValue(progressBarId).intValue() != value),
+ Assert.assertTrue((getProgressBarValue(progressBarId).intValue() > value),
"Progress has been terminated abnormal");
writeStatus("Disable polling");
@@ -105,7 +117,81 @@
waitForAjaxCompletion();
}
+
+ @Test
+ public void testActionListeners(Template template) {
+ //actionListener not work RF-5500
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test action listener attribute");
+ tester.testActionListener();
+ }
+
+ @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();
+ }
+ @Test
+ public void testNestedParams(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test component encodes nested f:param tags and their values are
present as request parameters");
+ tester.testRequestParameters(params);
+ }
+
+ @Test
+ public void testImmediate(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test immediate attribute");
+ tester.testImmediate(false);
+ }
+
+ @Test
+ public void testImmediateWithExternalValidationFailed(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test immediate attribute with external validation
failed");
+ tester.testImmediateWithExternalValidationFailed(false);
+ }
+
+ @Test
+ public void testNestedActionListener(Template template) {
+ //actionListener not work RF-5500
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test actionListener defined as nested tag are invoked on the
server ");
+ tester.testNestedActionListener();
+ }
+
+ @Test
+ public void testListenersAreNotInvokedInCaseOfExternalValidationFailure(Template
template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test listeners aren't invoked in case of external
validation failure");
+ tester.testExtrenalValidationFailure();
+ }
+
+ @Test
+ public void testAjaxSingle(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test ajaxSingle attribute");
+ tester.testAjaxSingle(false);
+ }
+
+ @Test
+ public void testAjaxSingleWithInternalValidationFailed(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test ajaxSingle attribute in case of invalid children
state");
+ tester.testAjaxSingleWithInternalValidationFailed();
+ }
+
private void enableProgressBar(String id, boolean enable) {
invokeFromComponent(id, (enable ? "enable" : "disable"),
null);
}
@@ -119,9 +205,25 @@
Integer v = Integer.parseInt(value);
return v;
}
+
+ @Override
+ public void sendAjax() {
+ delay(2000);
+ }
+ @Override
+ public void setInternalValidationFailed() {
+ String childCompId = getAutoTester(this).getClientId("") +
"child";
+ setValueById(childCompId, "");
+ }
+
public String getTestUrl() {
return "pages/progressBar/progressBarTest.xhtml";
}
+
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/progressBar/progressBarAutoTest.xhtml";
+ }
}
Show replies by date