Author: dsvyatobatsko
Date: 2008-11-14 07:32:39 -0500 (Fri, 14 Nov 2008)
New Revision: 11166
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean/AutoTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/layout/autotest/autoTestHiddens.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java
Log:
AutoTester:
made most methods public + some new event firing validators added + ...
Tests:
https://jira.jboss.org/jira/browse/RF-4822
https://jira.jboss.org/jira/browse/RF-4823
https://jira.jboss.org/jira/browse/RF-4824
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean/AutoTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean/AutoTestBean.java 2008-11-14
12:12:04 UTC (rev 11165)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/bean/AutoTestBean.java 2008-11-14
12:32:39 UTC (rev 11166)
@@ -14,286 +14,314 @@
import javax.faces.event.ValueChangeEvent;
import org.ajax4jsf.javascript.ScriptUtils;
+import org.richfaces.event.NodeExpandedEvent;
+import org.richfaces.event.NodeSelectedEvent;
/**
* Bean for auto test
+ *
* @author Andrey Markavtsov
- *
+ *
*/
public class AutoTestBean {
-
- public static final String INPUT_TEXT = "Text";
- public static final String STATUS_ID = "_auto_status";
- public static final String UPDATE_MODEL_STATUS = "UpdateModel";
- public static final String ACTION_LISTENER_STATUS = "ActionListener";
- public static final String NESTED_ACTION_LISTENER_STATUS = "NestedListener";
- public static final String VALUE_CHANGE_LISTENER_STATUS =
"ValueChangeListener";
- public static final String VALIDATOR_ID = "autoTestValidator";
- public static final String VALIDATOR_DEFAULT_ID = "autoTestDefaultValidator";
- public static final String ONCOMPLETE = "window._ajaxOncomplete = true;";
- //private String input = INPUT_TEXT;
+ public static final String INPUT_TEXT = "Text";
- private String reRender = STATUS_ID;
-
- private Boolean limitToList = false;
-
- private Boolean ajaxSingle = false;
-
- private Boolean immediate = false;
-
- private Boolean bypassUpdate= false;
-
- private Boolean rendered = true;
-
- private String status = null;
-
- private String oncomplete = ONCOMPLETE;
-
- private String validatorId = VALIDATOR_DEFAULT_ID;
+ public static final String STATUS_ID = "_auto_status";
- public void actionListener(ActionEvent event) {
- setStatus(getStatus() + ACTION_LISTENER_STATUS);
- }
+ public static final String UPDATE_MODEL_STATUS = "UpdateModel";
- public void valueChangeListener(ValueChangeEvent event) {
- setStatus(getStatus() + VALUE_CHANGE_LISTENER_STATUS);
- }
+ public static final String ACTION_LISTENER_STATUS = "ActionListener";
- public String load () {
- status = null;
- return null;
- }
-
-// public String testRendered() {
-// reset();
-// rendered = false;
-// return null;
-// }
-//
-// public String testReRender() {
-// reset();
-// reRender = TIME_ID + "," + STATUS_ID ;
-// return null;
-// }
-//
-// public String testListeners() {
-// reset();
-// return null;
-// }
-//
-// public String testFalidation() {
-// reset();
-// return null;
-// }
-//
-// public String testAjaxSingle() {
-// reset();
-// ajaxSingle = true;
-// return null;
-// }
-//
-// public String testImmdediate() {
-// reset();
-// immediate = true;
-// return null;
-// }
-//
-// public String testBypassUpdate() {
-// reset();
-// bypassUpdate = true;
-// return null;
-// }
-//
-// public String testLimitToList1() {
-// reset();
-// limitToList = true;
-// return null;
-// }
-//
-// public String testLimitToList2() {
-// reset();
-// limitToList = true;
-// reRender = TIME_ID + "," + STATUS_ID;
-// return null;
-// }
-//
-// public String testValidator() {
-// reset();
-// validatorId = VALIDATOR_ID;
-// return null;
-// }
-//
-// public String testValidatorAndAjaxSingle() {
-// return null;
-// }
-
-
- public Object getRequestParamsMap() {
- FacesContext context = FacesContext.getCurrentInstance();
- if (context != null) {
- ExternalContext ext = context.getExternalContext();
- if (ext != null) {
- return ScriptUtils.toScript(context.getExternalContext().getRequestParameterMap());
- }
- }
- return "";
- }
-
-
- public String getText() {
- return String.valueOf(new Date().getTime());
- }
+ public static final String NESTED_ACTION_LISTENER_STATUS =
"NestedListener";
- /**
- * @return the input
- */
- public String getInput() {
- return INPUT_TEXT;
- }
+ public static final String VALUE_CHANGE_LISTENER_STATUS =
"ValueChangeListener";
- /**
- * @param input the input to set
- */
- public void setInput(String input) {
- if (input != null && input.equals(INPUT_TEXT)) {
- setStatus(getStatus() + UPDATE_MODEL_STATUS);
- }
- //this.input = input;
- }
+ public static final String NODE_SELECTED_LISTENER_STATUS =
"NodeSelectedListener";
- /**
- * @return the reRender
- */
- public String getReRender() {
- return reRender;
- }
+ public static final String NODE_EXPANDED_LISTENER_STATUS =
"NodeExpandedListener";
- /**
- * @param reRender the reRender to set
- */
- public void setReRender(String reRender) {
- this.reRender = reRender;
- }
+ public static final String VALIDATOR_ID = "autoTestValidator";
- /**
- * @return the limitToList
- */
- public Boolean getLimitToList() {
- return limitToList;
- }
+ public static final String VALIDATOR_DEFAULT_ID =
"autoTestDefaultValidator";
- /**
- * @param limitToList the limitToList to set
- */
- public void setLimitToList(Boolean limitToList) {
- this.limitToList = limitToList;
- }
+ public static final String ONCOMPLETE = "window._ajaxOncomplete = true;";
- /**
- * @return the ajaxSingle
- */
- public Boolean getAjaxSingle() {
- return ajaxSingle;
- }
+ // private String input = INPUT_TEXT;
- /**
- * @param ajaxSingle the ajaxSingle to set
- */
- public void setAjaxSingle(Boolean ajaxSingle) {
- this.ajaxSingle = ajaxSingle;
- }
+ private String reRender = STATUS_ID;
- /**
- * @return the immediate
- */
- public Boolean getImmediate() {
- return immediate;
- }
+ private Boolean limitToList = false;
- /**
- * @param immediate the immediate to set
- */
- public void setImmediate(Boolean immediate) {
- this.immediate = immediate;
- }
+ private Boolean ajaxSingle = false;
- /**
- * @return the bypassUpdate
- */
- public Boolean getBypassUpdate() {
- return bypassUpdate;
- }
+ private Boolean immediate = false;
- /**
- * @param bypassUpdate the bypassUpdate to set
- */
- public void setBypassUpdate(Boolean bypassUpdate) {
- this.bypassUpdate = bypassUpdate;
- }
+ private Boolean bypassUpdate = false;
- /**
- * @return the status
- */
- public String getStatus() {
- if (status == null) {
- status = "";
- }
- return status;
- }
+ private Boolean rendered = true;
- /**
- * @param status the status to set
- */
- public void setStatus(String status) {
- this.status = status;
- }
+ private String status = null;
- /**
- * @return the rendered
- */
- public Boolean getRendered() {
- return rendered;
- }
+ private String oncomplete = ONCOMPLETE;
- /**
- * @param rendered the rendered to set
- */
- public void setRendered(Boolean rendered) {
- this.rendered = rendered;
- }
+ private String validatorId = VALIDATOR_DEFAULT_ID;
- /**
- * @return the oncomplete
- */
- public String getOncomplete() {
- return oncomplete;
- }
+ public void actionListener(ActionEvent event) {
+ setStatus(getStatus() + ACTION_LISTENER_STATUS);
+ }
+ public void valueChangeListener(ValueChangeEvent event) {
+ setStatus(getStatus() + VALUE_CHANGE_LISTENER_STATUS);
+ }
- /**
- * @param oncomplete the oncomplete to set
- */
- public void setOncomplete(String oncomplete) {
- this.oncomplete = oncomplete;
- }
+ public void processSelection(NodeSelectedEvent event) {
+ setStatus(getStatus() + NODE_SELECTED_LISTENER_STATUS);
+ }
+ public void processExpansion(NodeExpandedEvent nodeExpandedEvent) {
+ setStatus(getStatus() + NODE_EXPANDED_LISTENER_STATUS);
+ }
- /**
- * @return the validatorId
- */
- public String getValidatorId() {
- return validatorId;
- }
+ public String load() {
+ status = null;
+ return null;
+ }
+ public String reset() {
+ status = null;
+ return null;
+ }
- /**
- * @param validatorId the validatorId to set
- */
- public void setValidatorId(String validatorId) {
- this.validatorId = validatorId;
- }
+ // public String testRendered() {
+ // reset();
+ // rendered = false;
+ // return null;
+ // }
+ //
+ // public String testReRender() {
+ // reset();
+ // reRender = TIME_ID + "," + STATUS_ID ;
+ // return null;
+ // }
+ //
+ // public String testListeners() {
+ // reset();
+ // return null;
+ // }
+ //
+ // public String testFalidation() {
+ // reset();
+ // return null;
+ // }
+ //
+ // public String testAjaxSingle() {
+ // reset();
+ // ajaxSingle = true;
+ // return null;
+ // }
+ //
+ // public String testImmdediate() {
+ // reset();
+ // immediate = true;
+ // return null;
+ // }
+ //
+ // public String testBypassUpdate() {
+ // reset();
+ // bypassUpdate = true;
+ // return null;
+ // }
+ //
+ // public String testLimitToList1() {
+ // reset();
+ // limitToList = true;
+ // return null;
+ // }
+ //
+ // public String testLimitToList2() {
+ // reset();
+ // limitToList = true;
+ // reRender = TIME_ID + "," + STATUS_ID;
+ // return null;
+ // }
+ //
+ // public String testValidator() {
+ // reset();
+ // validatorId = VALIDATOR_ID;
+ // return null;
+ // }
+ //
+ // public String testValidatorAndAjaxSingle() {
+ // return null;
+ // }
-
+ public Object getRequestParamsMap() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ if (context != null) {
+ ExternalContext ext = context.getExternalContext();
+ if (ext != null) {
+ return
ScriptUtils.toScript(context.getExternalContext().getRequestParameterMap());
+ }
+ }
+ return "";
+ }
+ public String getText() {
+ return String.valueOf(new Date().getTime());
+ }
+
+ /**
+ * @return the input
+ */
+ public String getInput() {
+ return INPUT_TEXT;
+ }
+
+ /**
+ * @param input
+ * the input to set
+ */
+ public void setInput(String input) {
+ if (input != null && input.equals(INPUT_TEXT)) {
+ setStatus(getStatus() + UPDATE_MODEL_STATUS);
+ }
+ // this.input = input;
+ }
+
+ /**
+ * @return the reRender
+ */
+ public String getReRender() {
+ return reRender;
+ }
+
+ /**
+ * @param reRender
+ * the reRender to set
+ */
+ public void setReRender(String reRender) {
+ this.reRender = reRender;
+ }
+
+ /**
+ * @return the limitToList
+ */
+ public Boolean getLimitToList() {
+ return limitToList;
+ }
+
+ /**
+ * @param limitToList
+ * the limitToList to set
+ */
+ public void setLimitToList(Boolean limitToList) {
+ this.limitToList = limitToList;
+ }
+
+ /**
+ * @return the ajaxSingle
+ */
+ public Boolean getAjaxSingle() {
+ return ajaxSingle;
+ }
+
+ /**
+ * @param ajaxSingle
+ * the ajaxSingle to set
+ */
+ public void setAjaxSingle(Boolean ajaxSingle) {
+ this.ajaxSingle = ajaxSingle;
+ }
+
+ /**
+ * @return the immediate
+ */
+ public Boolean getImmediate() {
+ return immediate;
+ }
+
+ /**
+ * @param immediate
+ * the immediate to set
+ */
+ public void setImmediate(Boolean immediate) {
+ this.immediate = immediate;
+ }
+
+ /**
+ * @return the bypassUpdate
+ */
+ public Boolean getBypassUpdate() {
+ return bypassUpdate;
+ }
+
+ /**
+ * @param bypassUpdate
+ * the bypassUpdate to set
+ */
+ public void setBypassUpdate(Boolean bypassUpdate) {
+ this.bypassUpdate = bypassUpdate;
+ }
+
+ /**
+ * @return the status
+ */
+ public String getStatus() {
+ if (status == null) {
+ status = "";
+ }
+ return status;
+ }
+
+ /**
+ * @param status
+ * the status to set
+ */
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ /**
+ * @return the rendered
+ */
+ public Boolean getRendered() {
+ return rendered;
+ }
+
+ /**
+ * @param rendered the rendered to set
+ */
+ public void setRendered(Boolean rendered) {
+ this.rendered = rendered;
+ }
+
+ /**
+ * @return the oncomplete
+ */
+ public String getOncomplete() {
+ return oncomplete;
+ }
+
+ /**
+ * @param oncomplete the oncomplete to set
+ */
+ public void setOncomplete(String oncomplete) {
+ this.oncomplete = oncomplete;
+ }
+
+ /**
+ * @return the validatorId
+ */
+ public String getValidatorId() {
+ return validatorId;
+ }
+
+ /**
+ * @param validatorId the validatorId to set
+ */
+ public void setValidatorId(String validatorId) {
+ this.validatorId = validatorId;
+ }
+
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java 2008-11-14
12:12:04 UTC (rev 11165)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java 2008-11-14
12:32:39 UTC (rev 11166)
@@ -23,7 +23,6 @@
import java.io.IOException;
import java.io.InputStream;
-import java.net.URL;
import java.util.Properties;
import javax.faces.FacesException;
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/layout/autotest/autoTestHiddens.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/layout/autotest/autoTestHiddens.xhtml 2008-11-14
12:12:04 UTC (rev 11165)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/layout/autotest/autoTestHiddens.xhtml 2008-11-14
12:32:39 UTC (rev 11166)
@@ -9,4 +9,5 @@
<h:outputText id="_auto_time" style="display: none;"
value="#{autoTestBean.text}"></h:outputText>
<h:commandButton id="_auto_simple_submit" value="Simple submit"
immediate="#{autoTestBean.immediate}" style="display: none;" />
<a4j:commandButton id="_auto_ajax_submit" value="Ajax submit"
reRender="componentId" immediate="#{autoTestBean.immediate}"
style="display: none;" />
+ <a4j:commandButton id="_auto_ajax_reset" value="Ajax reset"
ajaxSingle="true" style="display: none;"
action="#{autoTestBean.reset}" />
</html>
\ No newline at end of file
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeAutoTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeTest.xhtml
===================================================================
(Binary files differ)
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 2008-11-14
12:12:04 UTC (rev 11165)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2008-11-14
12:32:39 UTC (rev 11166)
@@ -40,6 +40,8 @@
private static final String AJAX_SUBMIT = "_auto_ajax_submit";
+ private static final String AJAX_RESET = "_auto_ajax_reset";
+
// /private String componentName;
SeleniumTestBase base;
@@ -334,7 +336,7 @@
return template.getPrefix() + AUTOTEST_FORM_ID + id;
}
- private void reset() {
+ public void reset() {
if (base.getParentId() == null) {
Assert.fail("Page has not been rendered before test. Invoke
'renderPage' method before !");
}
@@ -344,22 +346,27 @@
}
}
- private void clickLoad() {
+ public void startTracing() {
+ String resetId = base.getParentId() + AUTOTEST_FORM_ID + AJAX_RESET;
+ base.clickAjaxCommandAndWait(resetId);
+ }
+
+ public void clickLoad() {
String commandButtonId = base.getParentId() + AUTOTEST_CONTROLS_FORM_ID +
"_auto_load";
base.clickCommandAndWait(commandButtonId);
}
- private void clickAjaxSubmit() {
+ public void clickAjaxSubmit() {
String ajaxSubmitId = base.getParentId() + AUTOTEST_FORM_ID + AJAX_SUBMIT;
base.clickAjaxCommandAndWait(ajaxSubmitId);
}
- private void clickSubmit() {
+ public void clickSubmit() {
String submitId = base.getParentId() + AUTOTEST_FORM_ID + SIMPLE_SUBMIT;
base.clickCommandAndWait(submitId);
}
- private void setExtrenalValidationFailed() {
+ public void setExtrenalValidationFailed() {
base.setValueById(base.getParentId() + AUTOTEST_FORM_ID + INPUT_ID,
"");
}
@@ -371,7 +378,7 @@
base.changeValue();
}
- private void setupControl(TestSetupEntry attr, Object o) {
+ public void setupControl(TestSetupEntry attr, Object o) {
final String idPrefix = "_auto_";
String controlId = base.getParentId() + AUTOTEST_CONTROLS_FORM_ID + idPrefix +
attr.name;
if (attr.type.equals(String.class)) {
@@ -381,7 +388,7 @@
}
}
- private void checkActionListener(boolean passed) {
+ public void checkActionListener(boolean passed) {
String status = getStatus();
if (passed && status != null &&
status.indexOf(AutoTestBean.ACTION_LISTENER_STATUS) == -1) {
Assert.fail("ActionListener has been skipped");
@@ -390,7 +397,7 @@
}
}
- private void checkNestedActionListener(boolean passed) {
+ public void checkNestedActionListener(boolean passed) {
String status = getStatus();
if (passed && status != null &&
status.indexOf(AutoTestBean.NESTED_ACTION_LISTENER_STATUS) == -1) {
Assert.fail("Nested actionListener has been skipped");
@@ -399,7 +406,7 @@
}
}
- private void checkValueChangeListener(boolean passed) {
+ public void checkValueChangeListener(boolean passed) {
String status = getStatus();
if (passed && status != null &&
status.indexOf(AutoTestBean.VALUE_CHANGE_LISTENER_STATUS) == -1) {
Assert.fail("ValueChangeListener has been skipped");
@@ -408,8 +415,26 @@
}
}
- private void checkUpdateModel(boolean passed) {
+ public void checkNodeSelectedListener(boolean passed) {
String status = getStatus();
+ if (passed && status != null &&
status.indexOf(AutoTestBean.NODE_SELECTED_LISTENER_STATUS) == -1) {
+ Assert.fail("NodeSelectedListener has been skipped");
+ } else if (!passed && status != null &&
status.indexOf(AutoTestBean.NODE_SELECTED_LISTENER_STATUS) != -1) {
+ Assert.fail(status);
+ }
+ }
+
+ public void checkNodeExpandedListener(boolean passed) {
+ String status = getStatus();
+ if (passed && status != null &&
status.indexOf(AutoTestBean.NODE_EXPANDED_LISTENER_STATUS) == -1) {
+ Assert.fail("NodeExpandedListener has been skipped");
+ } else if (!passed && status != null &&
status.indexOf(AutoTestBean.NODE_EXPANDED_LISTENER_STATUS) != -1) {
+ Assert.fail(status);
+ }
+ }
+
+ public void checkUpdateModel(boolean passed) {
+ String status = getStatus();
if (passed && status != null &&
status.indexOf(AutoTestBean.UPDATE_MODEL_STATUS) == -1) {
Assert.fail("Update Model phase has been skipped");
} else if (!passed && status != null &&
status.indexOf(AutoTestBean.UPDATE_MODEL_STATUS) != -1) {
@@ -420,52 +445,52 @@
private String getStatus() {
return base.getTextById(base.getParentId() + AUTOTEST_FORM_ID + STATUS_ID);
}
-}
-class TestSetupEntry {
+ public static class TestSetupEntry {
- String name;
+ String name;
- Class<?> type;
+ Class<?> type;
- Object defaultValue;
+ Object defaultValue;
- public TestSetupEntry(String name, Class<?> type, Object defaultValue) {
- super();
- this.name = name;
- this.type = type;
- this.defaultValue = defaultValue;
- }
+ public TestSetupEntry(String name, Class<?> type, Object defaultValue) {
+ super();
+ this.name = name;
+ this.type = type;
+ this.defaultValue = defaultValue;
+ }
- public static final TestSetupEntry reRender = new
TestSetupEntry("reRender", String.class, AutoTester.STATUS_ID);
+ public static final TestSetupEntry reRender = new
TestSetupEntry("reRender", String.class, AutoTester.STATUS_ID);
- public static final TestSetupEntry validatorId = new
TestSetupEntry("validatorId", String.class,
- AutoTestBean.VALIDATOR_DEFAULT_ID);
+ public static final TestSetupEntry validatorId = new
TestSetupEntry("validatorId", String.class,
+ AutoTestBean.VALIDATOR_DEFAULT_ID);
- public static final TestSetupEntry oncomplete = new
TestSetupEntry("oncomplete", String.class,
- AutoTestBean.ONCOMPLETE);
+ public static final TestSetupEntry oncomplete = new
TestSetupEntry("oncomplete", String.class,
+ AutoTestBean.ONCOMPLETE);
- public static final TestSetupEntry rendered = new
TestSetupEntry("rendered", Boolean.class, Boolean.TRUE);
+ public static final TestSetupEntry rendered = new
TestSetupEntry("rendered", Boolean.class, Boolean.TRUE);
- public static final TestSetupEntry ajaxSingle = new
TestSetupEntry("ajaxSingle", Boolean.class, Boolean.FALSE);
+ public static final TestSetupEntry ajaxSingle = new
TestSetupEntry("ajaxSingle", Boolean.class, Boolean.FALSE);
- public static final TestSetupEntry immediate = new
TestSetupEntry("immediate", Boolean.class, Boolean.FALSE);
+ public static final TestSetupEntry immediate = new
TestSetupEntry("immediate", Boolean.class, Boolean.FALSE);
- public static final TestSetupEntry bypassUpdate = new
TestSetupEntry("bypassUpdate", Boolean.class, Boolean.FALSE);
+ public static final TestSetupEntry bypassUpdate = new
TestSetupEntry("bypassUpdate", Boolean.class, Boolean.FALSE);
- public static final TestSetupEntry limitToList = new
TestSetupEntry("limitToList", Boolean.class, Boolean.FALSE);
+ public static final TestSetupEntry limitToList = new
TestSetupEntry("limitToList", Boolean.class, Boolean.FALSE);
- public static final List<TestSetupEntry> list = new
ArrayList<TestSetupEntry>();
- static {
- list.add(reRender);
- list.add(validatorId);
- list.add(rendered);
- list.add(ajaxSingle);
- list.add(immediate);
- list.add(bypassUpdate);
- list.add(limitToList);
- list.add(oncomplete);
+ public static final List<TestSetupEntry> list = new
ArrayList<TestSetupEntry>();
+ static {
+ list.add(reRender);
+ list.add(validatorId);
+ list.add(rendered);
+ list.add(ajaxSingle);
+ list.add(immediate);
+ list.add(bypassUpdate);
+ list.add(limitToList);
+ list.add(oncomplete);
+ }
+
}
-
-}
+}
\ No newline at end of file
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java 2008-11-14
12:12:04 UTC (rev 11165)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java 2008-11-14
12:32:39 UTC (rev 11166)
@@ -6,6 +6,7 @@
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
+import org.richfaces.AutoTester.TestSetupEntry;
import org.testng.annotations.Test;
public class TreeTest extends SeleniumTestBase {
@@ -34,15 +35,49 @@
tester.testRequestParameters(params);
}
+ @Test
+ public void testAjaxSingle(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ tester.reset();
+ tester.setupControl(TestSetupEntry.ajaxSingle, Boolean.TRUE);
+ tester.clickLoad();
+ String compId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
+ clickAjaxCommandAndWait("//*[@id='"+ compId +
":childs']/table[1]/tbody/tr/td/div/a");
+ clickAjaxCommandAndWait("//*[@id='"+ compId +
":childs']/div/table[1]/tbody/tr/td/div/a");
+ type("//*[@id='"+ compId +
":childs']/div/div/table[1]/tbody/tr/td[3]/input", "New");
+ tester.setExtrenalValidationFailed();
+ tester.startTracing();
+ writeStatus("Test ajaxSingle attribute");
+ clickAjaxCommandAndWait("//*[@id='"+ compId +
":childs']/div/table[1]/tbody/tr/td/div/a");
+ tester.checkUpdateModel(false);
+ tester.checkNodeExpandedListener(true);
+ }
+
+ @Test
+ public void testAjaxSingleWithInternalValidationFailed(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ tester.reset();
+ tester.setupControl(TestSetupEntry.ajaxSingle, Boolean.TRUE);
+ tester.clickLoad();
+ String compId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
+ clickAjaxCommandAndWait("//*[@id='"+ compId +
":childs']/table[1]/tbody/tr/td/div/a");
+ clickAjaxCommandAndWait("//*[@id='"+ compId +
":childs']/div/table[1]/tbody/tr/td/div/a");
+ type("//*[@id='"+ compId +
":childs']/div/div/table[1]/tbody/tr/td[3]/input", "");
+ tester.startTracing();
+ writeStatus("Test ajaxSingle attribute in case of invalid component
state");
+ clickAjaxCommandAndWait("//*[@id='"+ compId +
":childs']/div/table[1]/tbody/tr/td/div/a");
+ tester.checkUpdateModel(false);
+ tester.checkNodeExpandedListener(false);
+ }
+
@Override
public void sendAjax() {
- String compId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
- //String node1Id = compId + ":1::_defaultNodeFaceOutput";
- String node1Id = compId + ":1::_defaultNodeFace:text";
- //String node1Id = compId + ":1::_defaultNodeFace";
- selenium.mouseOver(node1Id);
- selenium.mouseDown(node1Id);
- waitForAjaxCompletion();
+ AutoTester tester = getAutoTester(this);
+ //String compId = tester.getClientId(AutoTester.COMPONENT_ID);
+ //clickAjaxCommandAndWait("//*[@id='"+ compId +
":childs']/table[1]/tbody/tr/td/div/a");
+ tester.clickAjaxSubmit();
}
@Override