Author: alevkovsky
Date: 2009-01-10 09:50:33 -0500 (Sat, 10 Jan 2009)
New Revision: 12198
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComponentControlBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/componentControl/
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/componentControl/componentControl.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/componentControl/componentControlWithAttachTo.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/componentControl/componentControlWithDisabledDefault.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/componentControl/componentControlWithParameters.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComponentControlTest.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
Log:
Add component control selenium tests
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComponentControlBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComponentControlBean.java
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComponentControlBean.java 2009-01-10
14:50:33 UTC (rev 12198)
@@ -0,0 +1,28 @@
+/**
+ *
+ */
+package org.ajax4jsf.bean;
+
+/**
+ * @author Alexandr Levkovsky
+ *
+ */
+public class ComponentControlBean {
+
+ private Integer[] numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9};
+
+ /**
+ * @return the numbers
+ */
+ public Integer[] getNumbers() {
+ return numbers;
+ }
+
+ /**
+ * @param numbers the numbers to set
+ */
+ public void setNumbers(Integer[] numbers) {
+ this.numbers = numbers;
+ }
+
+}
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComponentControlBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-01-10
14:45:25 UTC (rev 12197)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-01-10
14:50:33 UTC (rev 12198)
@@ -302,6 +302,11 @@
<managed-bean-name>editorBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.EditorBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>controlBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.bean.ComponentControlBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/pages/ajaxInclude/step1.xhtml</from-view-id>
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/componentControl/componentControl.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/componentControl/componentControl.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/componentControl/componentControlWithAttachTo.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/componentControl/componentControlWithAttachTo.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/componentControl/componentControlWithDisabledDefault.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/componentControl/componentControlWithDisabledDefault.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/componentControl/componentControlWithParameters.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/componentControl/componentControlWithParameters.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComponentControlTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComponentControlTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComponentControlTest.java 2009-01-10
14:50:33 UTC (rev 12198)
@@ -0,0 +1,192 @@
+/**
+ *
+ */
+package org.richfaces.testng;
+
+import junit.framework.Assert;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.SeleniumTestBase;
+import org.testng.annotations.Test;
+
+/**
+ * @author Alexandr Levkovsky
+ *
+ */
+public class ComponentControlTest extends SeleniumTestBase {
+
+ private final static String TEST_COMPONENT_CONTROL_WITH_ATTACH_TO =
"pages/componentControl/componentControlWithAttachTo.xhtml";
+ private final static String TEST_COMPONENT_CONTROL_WITH_DISABLE_DEFAULT =
"pages/componentControl/componentControlWithDisabledDefault.xhtml";
+ private final static String TEST_COMPONENT_CONTROL_WITH_PARAMETERS =
"pages/componentControl/componentControlWithParameters.xhtml";
+
+ private String formId;
+ private String panelId;
+ private String panelShowLinkId;
+ private String panelHideLinkId;
+ private String tableId;
+ private String outputTextId;
+ private String panelSecondShowLinkId;
+ private String fparamsTestLinkId;
+ private String paramsTestLinkId;
+ private String clearLinkId;
+ private String testComponentId;
+
+
+ private void initIds(String parentId){
+ formId = parentId + "_form:";
+ panelId = formId + "panel";
+ panelHideLinkId = formId + "hidelink";
+ panelShowLinkId = formId + "showlink";
+ tableId = formId + "table";
+ outputTextId = "outputText";
+ panelSecondShowLinkId = formId + "showlink2";
+ fparamsTestLinkId = formId + "link1";
+ paramsTestLinkId = formId + "link2";
+ clearLinkId = formId + "link3";
+ testComponentId = formId + "comp";
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.SeleniumTestBase#getTestUrl()
+ */
+ @Override
+ public String getTestUrl() {
+ return "pages/componentControl/componentControl.xhtml";
+ }
+
+ @Test
+ public void testAttachingToEventHandlerOfParentComponent(Template template) {
+ renderPage(template);
+ initIds(getParentId());
+
+ //check attaching
+ AssertPresent(panelShowLinkId);
+ String onclick = selenium.getAttribute("//a[@id='" +
panelShowLinkId + "']/@onclick");
+ Assert.assertNotNull("Component conytrol not attached to parent component
event handler", onclick);
+
Assert.assertTrue(onclick.contains("Richfaces.componentControl.performOperation"));
+
+ AssertPresent(tableId);
+ for(int i=1; i < 8; i++){
+ onclick = selenium.getAttribute("//table[@id='" + tableId +
"']/tbody/tr[" + i + "]/@onclick");
+ Assert.assertNotNull("Component conytrol not attached to parent component
event handler", onclick);
+
Assert.assertTrue(onclick.contains("Richfaces.componentControl.performOperation"));
+ }
+
+
+ //check functional working
+ asserPanel(false);
+ clickById(panelShowLinkId);
+ asserPanel(true);
+ clickById(panelHideLinkId);
+
+ for(int i=0; i < 8; i++){
+ asserPanel(false);
+ clickById(tableId + ":" + i + ":" + outputTextId);
+ asserPanel(true);
+ clickById(panelHideLinkId);
+ }
+ }
+
+ @Test
+ public void testAttachingToEventHandlerWithAttachToAttribute(Template template) {
+ renderPage(TEST_COMPONENT_CONTROL_WITH_ATTACH_TO, template, null);
+ initIds(getParentId());
+
+ //check functional with attach to working
+
+ //attach to in same naming container
+ asserPanel(false);
+ clickById(panelShowLinkId);
+ asserPanel(true);
+ clickById(panelHideLinkId);
+
+ //attach to in another naming container
+ asserPanel(false);
+ clickById(panelSecondShowLinkId);
+ asserPanel(true);
+ clickById(panelHideLinkId);
+ }
+
+ @Test
+ public void testForAndOperationAttribute(Template template) {
+ //same as testAttachingToEventHandlerOfParentComponent
+
+ renderPage(template);
+ initIds(getParentId());
+
+
+ //check operations show and hide for modal panel working
+ asserPanel(false);
+ clickById(panelShowLinkId);
+ asserPanel(true);
+ clickById(panelHideLinkId);
+
+ for(int i=0; i < 8; i++){
+ asserPanel(false);
+ clickById(tableId + ":" + i + ":" + outputTextId);
+ asserPanel(true);
+ clickById(panelHideLinkId);
+ }
+ }
+
+ @Test
+ public void testDisableDefaultAttribute(Template template) {
+ //Not working:
https://jira.jboss.org/jira/browse/RF-5607 - waiting for fix
+
+ renderPage(TEST_COMPONENT_CONTROL_WITH_DISABLE_DEFAULT, template, null);
+ initIds(getParentId());
+
+ // check attaching and firing event with disabledDefault="true"
+
+ //attach to in same naming container
+ asserPanel(false);
+ clickCommandAndWait(panelShowLinkId);
+ asserPanel(true);
+ clickById(panelHideLinkId);
+
+ //attach to in another naming container
+ asserPanel(false);
+ clickCommandAndWait(panelSecondShowLinkId);
+ asserPanel(true);
+ clickById(panelHideLinkId);
+ }
+
+ @Test
+ public void testParamsAttribute(Template template) {
+
+ renderPage(TEST_COMPONENT_CONTROL_WITH_PARAMETERS, template, null);
+ initIds(getParentId());
+
+ AssertPresent(testComponentId);
+ AssertTextEquals(testComponentId, "");
+ clickById(paramsTestLinkId);
+ AssertTextEquals(testComponentId, "2");
+ clickById(clearLinkId);
+ }
+
+ @Test
+ public void testpassingFParams(Template template) {
+
+ renderPage(TEST_COMPONENT_CONTROL_WITH_PARAMETERS, template, null);
+ initIds(getParentId());
+
+ AssertPresent(testComponentId);
+ AssertTextEquals(testComponentId, "");
+ clickById(fparamsTestLinkId);
+ AssertTextEquals(testComponentId, "1");
+ clickById(clearLinkId);
+ }
+
+
+ private void asserPanel(boolean visible){
+ AssertPresent(panelId);
+ AssertPresent(panelId + "CDiv");
+ if(visible){
+ AssertVisible(panelId + "CDiv");
+ }else{
+ AssertNotVisible(panelId + "CDiv");
+ }
+
+ }
+
+}
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComponentControlTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native