Author: dsvyatobatsko
Date: 2009-02-06 08:59:50 -0500 (Fri, 06 Feb 2009)
New Revision: 12591
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuGroup/panelMenuGroupCoreTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuGroupTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5896
https://jira.jboss.org/jira/browse/RF-5908
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuGroup/panelMenuGroupCoreTest.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuGroup/panelMenuGroupCoreTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
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-06
12:56:38 UTC (rev 12590)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2009-02-06
13:59:50 UTC (rev 12591)
@@ -640,6 +640,20 @@
}
/**
+ * Asserts DOM node is not present or not visible
+ *
+ * @param id -
+ * DOM element id
+ */
+ public void AssertNotPresentOrNotVisible(String id, String message) {
+ try {
+ AssertNotPresent(id, message);
+ } catch (AssertionError ae) {
+ AssertNotVisible(id, message);
+ }
+ }
+
+ /**
* Asserts DOM node is not present
*
* @param id -
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuGroupTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuGroupTest.java 2009-02-06
12:56:38 UTC (rev 12590)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuGroupTest.java 2009-02-06
13:59:50 UTC (rev 12591)
@@ -2,11 +2,16 @@
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
+import org.richfaces.AutoTester.TestSetupEntry;
import org.testng.Assert;
import org.testng.annotations.Test;
public class PanelMenuGroupTest extends PanelMenuItemTest {
+ private final static String CORE_TEST_URL =
"panelMenuGroupCoreTest.xhtml";
+
+ private static final String RESET_METHOD = "#{panelBean.reset}";
+
@Test
public void testIconsAttributesApply(Template template) {
renderPage(LOOK_AND_FEEL_TEST_URL, template, null);
@@ -47,6 +52,105 @@
assertEvent("oncollapse");
}
+ @Test
+ public void testComponentIsFunctioningCorrectlyForAllSubmissionModes(Template
template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(CORE_TEST_URL, template, null);
+ writeStatus("Check component is functioning correctly for all submission
modes; server listeners fire");
+
+ String serverGrpId = "icon" +
tester.getClientId("serverGrp");
+ String ajaxGrpId = "icon" + tester.getClientId("ajaxGrp");
+ String noneGrpId = "icon" + tester.getClientId("noneGrp");
+
+ writeStatus("Check server mode: listeners are invoked, model is
updated");
+ clickCommandAndWait(serverGrpId);
+
+ tester.checkUpdateModel(true);
+ tester.checkActionListener(true);
+
+ writeStatus("Check ajax mode: listeners are invoked, model is
updated");
+
+ tester.startTracing();
+ clickAjaxCommandAndWait(ajaxGrpId);
+
+ tester.checkUpdateModel(true);
+ tester.checkActionListener(true);
+
+ writeStatus("Check none mode: listeners are not invoked, model is not
updated");
+
+ tester.startTracing();
+ clickById(noneGrpId);
+
+ tester.checkUpdateModel(false);
+ tester.checkActionListener(false);
+ }
+
+ @Test
+ public void testNestedComponentsAreNotProcessedForServerAwareClosedGroups(Template
template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(CORE_TEST_URL, template, RESET_METHOD);
+ writeStatus("Check nested components aren't processed for server-aware
closed groups");
+
+ String inputsId = tester.getClientId("_inputs");
+
+ writeStatus("Primarily all groups are closed. Check that content of
server-aware groups are not processed");
+
+ tester.clickSubmit();
+
+ String inputs = selenium.getText(inputsId);
+ Assert.assertTrue(inputs.contains("grp3"), "Content of closed
non-server-aware group (grp3) must be processed");
+ Assert.assertFalse(inputs.contains("grp2"), "Content of closed
server-aware group (grp2) must not be processed");
+ Assert.assertFalse(inputs.contains("grp1"), "Content of closed
server-aware group (grp1) must not be processed");
+
+ String sRequiredId = tester.getClientId("sRequired");
+ String aRequiredId = tester.getClientId("aRequired");
+ String nRequiredId = tester.getClientId("nRequired");
+
+ String serverGrpId = "icon" +
tester.getClientId("serverGrp");
+ String ajaxGrpId = "icon" + tester.getClientId("ajaxGrp");
+ String noneGrpId = "icon" + tester.getClientId("noneGrp");
+
+ tester.setupControl(TestSetupEntry.required, true);
+ tester.clickLoad();
+
+ writeStatus("Now all groups have nested invalid controls");
+ writeStatus("Because client groups are processed anyway clicking any
server-aware group has no affect: " +
+ "listeners are not invoked, model is not update, a group is not
expanded");
+ clickAjaxCommandAndWait(ajaxGrpId);
+ tester.checkUpdateModel(false);
+ tester.checkActionListener(false);
+ AssertNotPresentOrNotVisible(aRequiredId, "Ajax group must not be
expanded");
+
+ clickCommandAndWait(serverGrpId);
+ tester.checkUpdateModel(false);
+ tester.checkActionListener(false);
+ AssertNotPresentOrNotVisible(aRequiredId, "Server group must not be
expanded");
+
+ writeStatus("Fix client group invalid content and so on");
+ clickById(noneGrpId);
+ setValueById(nRequiredId, "valid");
+
+ clickAjaxCommandAndWait(ajaxGrpId);
+ tester.checkUpdateModel(true);
+ tester.checkActionListener(true);
+ AssertPresentAndVisible(aRequiredId, "Ajax group would have been
expanded");
+
+ tester.startTracing();
+ clickCommandAndWait(serverGrpId);
+ tester.checkUpdateModel(false);
+ tester.checkActionListener(false);
+ AssertNotPresentOrNotVisible(sRequiredId, "Server group wouldn't have
been expanded");
+
+ writeStatus("Fix ajax group invalid content");
+ clickAjaxCommandAndWait(ajaxGrpId);
+ setValueById(aRequiredId, "valid");
+
+ clickCommandAndWait(serverGrpId);
+ tester.checkUpdateModel(true);
+ tester.checkActionListener(true);
+ AssertPresentAndVisible(sRequiredId, "Server group would have been
expanded");
+ }
+
@Override
public void sendAjax() {
clickAjaxCommandAndWait("icon" +
getAutoTester(this).getClientId(AutoTester.COMPONENT_ID));